It's Halloween night, and trick-or-treaters are walking through the neighborhood. Looking for something fun to do, they find a laser maze! In this competitive showdown, kids carefully navigate the laser beams while their parents plan their own strategy to win. One at a time, each person gets a chance to move through the maze without hitting any beams. If a beam gets hit, red flashing lights and an alarm signal that the game is over. If the person makes it to the end and hits the huge stop button, the win is accompanied by green flashing lights.
HistoryMy original laser maze began in 2014, when I was just getting started with Arduino. The maze consisted of a single laser and multiple mirrors. While it was a fun experience, the many mirrors caused quite a bit of frustration. I knew I could improve, so I decided to replace the many mirrors with 15 laser modules. Each laser now corresponds to its own sensor, so any issue is now isolated much better. In addition to this improvement, the latest version features LED strips, DMX lighting, game-play music, sound effects, and Bluetooth control with the Arduino Manager app.
Pan/Tilt Brackets for LasersEach laser module is embedded into its own pan/tilt bracket. The brackets are made of scrap wood and contain three parts as seen in these pictures. The laser module is hot glued into the recessed hole and a barrel jack connection allows for easy setup.
In order for Arduino to detect when someone breaks a beam, photo-resistors are used to read the light intensity. Once the level drops below a certain threshold set by Arduino Manager, the fail sequence is triggered. Each of the 15 photo-resistors is hot glued within its own plastic container and covered with plastic wrap to diffuse the laser beam. Diffusing the laser beam once it reaches the sensor housing makes the aiming process much easier, because the beam does not have to be precisely focused on the photo-resistor.
Each corner of the maze contains a wooden post with multiple lasers and sensors. The posts are cemented into buckets for stability. In addition to the 4 posts, lasers and sensors are fixed to the back, left, and right sides of the maze using pieces of wood. This creates even more possibilities for beam angles.
In order to make things easy, each post / cluster uses its own cat5 cable instead of having a separate cable for each sensor and laser. The pairs are color coded for each location, and all cables lead back to the central hub in the back of the garage. To save pins on Arduino, the sensors are divided into 4 groups and wired in series. The lasers are so bright when on, that even when multiple photo-resistors are wired in series, a broken beam can be easily detected.
All of the cat5 cables feed to the central hub in the back of the garage. Since this project involves two shields (DMX and BLE) that compete for Arduino pins, two separate Arduinos are used, connected using I2C and the Wire library. Arduino Uno (master) uses the BLE shield to connect with Arduino Manager on an iPad. It also receives sensor data, controls laser status, reads button pushes, and sends messages to Arduino Pro Mini (slave). Since shields do not fit Arduino Pro Mini, each needed pin from the board is connected to the DMX shield with jumper wires. Arduino Uno sends lighting commands through the Wire Library, and Arduino Pro Mini receives them and fires the appropriate lighting cues via DMX. This project uses a large DMX LED wash light and LED strips for lighting.
An iPad controls the entire experience with Arduino Manager. The "LASER" button toggles laser visibility and enables game mode. The "aim" button can disable the the alarm and lights. S0-S3 are sensor values and T0-T3 are the respective thresholds, meaning if any of the sensor values goes below its threshold, the alarm and lights trigger. The threshold values can be changed on the fly from Arduino Manager. The "sound" icon represents the "sound" variable in the sketch. If any of the sensors go below their thresholds, sound = 1, and the alarm is played.
The iPad is also connected to a Bluetooth speaker which plays game music from Spotify. Check out my playlist here!
Comments