This project was made for the Washington renfaire that I went to in August 2026.
This project used the following hardware:
- Raspberry Pi 4B (a Raspberry Pi 3B or lower works just as well, however it requires the LED strip to be powered externally)
- 1-metre BTF-Lighting WF2812B IC LED Strip (60 LEDs/m)
- 10,000 mAh power bank
- 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)
- A thick hard-cover book (preferrably leather-like cover to look more like a spell book)
To install the source code and run the program:
- 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- Clone the repository at https://github.com/WhenLifeHandsYouLemons/Magic-Book.git with:
git clone https://github.com/WhenLifeHandsYouLemons/Magic-Book.git- Then, create the virtual environment in the project folder:
cd MagicBook
python -m venv .venv- Once the virtual environment is installed, activate it with:
source .venv/bin/activate- And finally install the PIP packages required for the project with:
pip install -r requirements.txt- Once you've completed the hardware setup, run the program with (this is needed instead of simply running
python magic_book.pyas neopixels needssudoto run but we're using a virtual environment):
sudo -E env PATH=$PATH python3 magic_book.pyThis 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:
- Run the following to open the scheduler so that we can tell it to run the
startup.shfile on startup:
sudo crontab -e- 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- Save and exit the file.
- Set the
startup.shfile to be executable with:
chmod -x /home/[USER]/Magic-Book/startup.shJust 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:
(Taken from: https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#gpio)
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.