Quiz the Spire

"Quiz The Spire"—an interactive multiplayer quiz game where players compete online or locally via SNES controllers, with dynamic difficulty adjusted by real-world sensor data (temperature and light), power-up items, and a physical servo-motor timer, all managed through a Raspberry Pi-powered web interface.
Supplies

Materials Needed
- Sandpaper
- Wood drill
- Screws
- Screwdriver
- Metal backplate
- Small HDMI screen
- With screw holes
- USB-C power support
- silicone adhesive
- Wooden box (to house the components)
- Raspberry Pi 5
- 16x2 LCD
- Servo motor
- 2 breadboards
- Breadboard power supply
- 18B20 one-wire temperature sensor
- Photoresistor (light-diminishing resistor)
- SNES-style controller (Raspberry Pi compatible)
- Wood rasp
Bill of materials is included of the electronic components.
Measure First
- Use a ruler or calliper to measure the exact dimensions of each component.
- Don’t forget to factor in space for wires, especially GPIO connectors and USB cables.
Mark the Spots




- Use a pencil to draw the locations of each hole on the box lightly.
- Ensure logical placement: e.g. screen on front, GPIO access, screws.
Drill Starter Holes

- Use a wood drill to create the base holes at the marked positions.
Shape With Wood Rasp
- Use the wood rasp to carefully enlarge and shape the holes to match your components.
- Aim for a snug fit, but leave enough room for wiring, especially for GPIO pins and connectors.
Attach a Metal Plate With Silicone Adhesive
- Attach the metal backplate to the back of the front pannel of the box of where you're planning on putting your HDMI screen using silicone adhesive.
Test Fit Components






- Insert each component temporarily to ensure fit.
- Make adjustments as needed before moving on.
Put Code on Raspberry Pi 5
- Put the code on the raspberry pi 5 from this github: https://github.com/howest-mct/2024-2025-projectone-mct-Lukas-Bohez
Run App.py or Make It Start by Default
Setup Instructions for the Backend and Frontend
1. Backend Setup
To start the backend server, run the app.py file using the Python virtual environment:
bash
2. Frontend Setup
Place the frontend files in the Apache2 root directory (typically /var/www/html/):
bash
3. (Recommended) Automatic Startup with System Service
For a seamless experience, set up a system service on your Raspberry Pi to:
- Automatically launch appmonitor_backup.py as root
- Start the browser in fullscreen mode pointing to the Apache2 site
- Map shoulder buttons to safely shut down the Pi
- Run app.py using the virtual environment
Steps to create the service:
- Create a service file (e.g., /etc/systemd/system/appmonitor.service):
- ini
Enable and start the service:
bash
4. Additional Notes
- Ensure file paths in the scripts are updated to match your system.
- For further guidance, refer to the GitHub documentation or consult an AI assistant if any steps are unclear.
Install Ydotool and Set Up Gamepad Script Autostart (optional)
Goal: Install input automation tool ydotool, set up your Python environment, and auto-launch gamepad.py on boot.
1. ✅ Install ydotool
sudo apt update
sudo apt install cmake g++ libevdev-dev libudev-dev libyaml-cpp-dev git -y
git clone https://github.com/ReimuNotMoe/ydotool.git
cd ydotool
cmake .
make
sudo make install
(ydotool is tricky to use, if you have any errors, ask Deepseek)
🔧 Note: ydotoold must be run as root or with appropriate permissions, so keep that in mind for autostart.
2. 🐍 Set Up Python Virtual Environment
sudo apt install python3-venv -y
mkdir ~/gamepad_project
cd ~/gamepad_project
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
3. 📜Gamepad.py Script
- Make sure it’s executable:
chmod +x gamepad.py
4. 🔁 Auto-Start gamepad.py on Reboot Using tmux
Step 1: Install Tmux
sudo apt update && sudo apt install tmux -y
Step 2: Add Auto-Start Script
Edit your user's .profile file:
nano ~/.profile
Paste this at the bottom (replace paths with yours):
# Auto-start gamepad.py in tmux
if [ -n "$PS1" ] && ! tmux has-session -t gamepad 2>/dev/null; then
tmux new -d -s gamepad -c ~/Project/project-one/backend/raspberryPi5
tmux send-keys -t gamepad "source ~/Project/.venv/bin/activate && python gamepad.py" Enter
fi
Save: Ctrl+O → Enter → Ctrl+X
Reload: source ~/.profile
Step 3: Test It
- Log out and log back in (or reboot).
- Check if it’s running: tmux list-sessions
Should show: gamepad: 1 windows (created ...)
View output (optional): tmux attach -t gamepad
Troubleshooting
- Not starting? Manually test the script first:
cd ~/Project/project-one/backend/raspberryPi5
~/Project/.venv/bin/python gamepad.py
Permission issues? Ensure your user owns the files:
sudo chown -R $USER:$USER ~/Project