For this year's Halloween, some friends and I decided to go all out and build an immersive laser maze. This quickly became the largest project I have ever undertaken, and challenged me to learn new things. Feel free to use this code for your own laser maze.
- Hardware Setup
- Other code written for this project
- iOS App (Swift)
- MQTT to Core MIDI (Python)
- MQTT Video Trigger (Processing)
- Leaderboard (Processing)
Tested on a Raspberry Pi 2 Model B running Raspbian GNU/Linux 10 (buster).
- Setup virtual environment.
$ pip install virtualenv
$ virtualenv laser-maze
$ source laser-maze/bin/activate- Inside that virtual environment, clone the repository.
$ cd laser-maze
$ git clone https://github.com/samhorne2/lasermaze2019.git- Install the requirements.
$ pip install -r requirements.txt- Install and start mosquitto.
$ sudo apt install mosquitto
$ sudo systemctl enable mosquitto- Edit mqtt_send.py and mqtt-recieve.py with the IP address of your new MQTT broker.
- mqtt_recieve.py -> line 25
- mqtt_send.py -> line 22
client.connect("192.168.1.133", 1883, 60) #Your MQTT broker IP address here.- Run mqtt_recieve.py to begin listening for the following messages on the topic "maze".
$ python3 mqtt_recieve.py| MQTT Message | Description |
|---|---|
| "arm" | Activates all lasers and begins detecting sensors intrusions. |
| "aimblink" | Blinks lasers whose sensors are intruded for aiming purposes. |
| "thresh" | Set thresholds for each beam (the average brightness between laser on and off). |
| "reset" | End the current game or stop aimblink. |
| "exit" | Exit the entire game. |
If you haven't setup the custom iOS app I made for this, you can easily use a tool such as MQTTool.
Like this project? Check out my other projects here!
