Skip to content

Repository files navigation

Magic Book

About

This project was made for the Washington renfaire that I went to in August 2026.

Resources

This project used the following hardware:

  1. Raspberry Pi 4B (a Raspberry Pi 3B or lower works just as well, however it requires the LED strip to be powered externally)
  2. 1-metre BTF-Lighting WF2812B IC LED Strip (60 LEDs/m)
  3. 10,000 mAh power bank
  4. Male-to-female, male-to-male, and female-to-female cables (only 3 male-to-female cables were used, but the other might come in handy if soldering work is needed)
  5. A thick hard-cover book (preferrably leather-like cover to look more like a spell book)

Installation

Manual Usage

To install the source code and run the program:

  1. Install the following packages in apt:
sudo apt update
sudo apt upgrade
sudo apt install git swig build-essential python3-dev python3-setuptools liblgpio-dev
  1. Clone the repository at https://github.com/WhenLifeHandsYouLemons/Magic-Book.git with:
git clone https://github.com/WhenLifeHandsYouLemons/Magic-Book.git
  1. Then, create the virtual environment in the project folder:
cd MagicBook
python -m venv .venv
  1. Once the virtual environment is installed, activate it with:
source .venv/bin/activate
  1. And finally install the PIP packages required for the project with:
pip install -r requirements.txt
  1. Once you've completed the hardware setup, run the program with (this is needed instead of simply running python magic_book.py as neopixels needs sudo to run but we're using a virtual environment):
sudo -E env PATH=$PATH python3 magic_book.py

Automatic Usage

This section explains how to set up the project to run on startup. Follow steps 1-5 from the Manual Usage section before doing the following:

  1. Run the following to open the scheduler so that we can tell it to run the startup.sh file on startup:
sudo crontab -e
  1. In the file that it opened, add the following line (replace [USER] with the current user folder you've cloned the project in):
@reboot /home/[USER]/Magic-Book/startup.sh
  1. Save and exit the file.
  2. Set the startup.sh file to be executable with:
chmod -x /home/[USER]/Magic-Book/startup.sh

Hardware Setup

Just connect the data pin of the LED strip to GPIO 18 (in the code this is written as board.D12), connect the power and ground pins either to the Raspberry Pi's (4B or higher model) power and ground pins, or connect them to an external power source (for a Raspberry Pi 3B or a lower model)!

Raspberry Pi 40-pin GPIO layout: GPIO Pinout Diagram (Taken from: https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#gpio)

License

This project was made by Sooraj S and provided for free for anyone to use, modify, and distribute (given it's also under the same license). To know more about the license, please see the LICENSE file.

About

A book with hidden LEDs to simulate a spell being cast. Built for the August 2026 Washington renfaire.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages