Introduction: Lazer Maze

Picture of Lazer Maze

The Lazer maze was our processing and arduino powered event in a state level Tech fest called ENIGMA. a monitor first displays "press START" on which a video giving the instructions about the maze. then a stop button. when pressed, the timings along with the number of times the lazer was cut is shown. I'm showing how to make the lazer maze with only 4 lazers. we increase the number of rays by using mirrors or increasing the number of lasers.

Step 1: Materials Required

Picture of Materials Required

The required materials are:

1) a big room

2) laptop

3) monitor

4)arduino Uno or any uno with a minimum of 6 input pins

5) 4 red lasers. green can also do

6) 4 1k resistors

7) 4 LDRs

8) 3 push buttons

9) 1 breadboard

10) 1 servo (if wanting a seperate alarm system)

11) extension box

12) beacon( used only if using the servo)

13) fog machine

tape, cardboard soldering iron, caps, cardboardtubes

Step 2: How It Works

The 4 green lasers are lined along one side of the room, all wired in
parallel to 3 D cell batteries. They are not connected to the Arduino in any way. On the opposite side of the room, there are 4 Light Dependent Resisters inside of plastic tubes. The LDR cells detect the laser light, and the tube helps filter out other unwanted light from strobe lights. The Arduino is programmed to watch the LDR cells, and the stop, start, and reset buttons. The Arduino sends 4 signals back to the Processing code on the laptop: start, stop, alarm, or reset. The Arduino also powers a servo that turns on a spinning red light when the alarm is set off.(you can delete the code if you don't want a beacon) The Processing code accepts the signals from the Arduino, and displays the state of the game on the monitor outside. The Processing code has 5 different states: PRESS START > Intro Video > 3, 2, 1, GO > Active Game (show time and score) > Display Final Score. The Processing code starts and stops the game, and increments the score as it receives the signals from the Arduino. The music playing in the background is just shuffling on the computer, it is not connected to Processing or Arduino.

Step 3: Floorplan

you can decide on any design that you want. i used mirrors to reflect the light in diffent paths but it ultimately ends up into the LDR cell. Also you can use 4 parallel paths that makes a total of 4*4=26 lazer lines to pass through. In the middle we had another mini laser game for which i'll make a new Instructable later. only after completing the mini game is th player allowed to move further.

Step 4: The Arduino Code

Picture of The Arduino Code

The Arduino code has a pretty simple function; monitor 3 buttons and the
light dependent resisters, and send signals to Processing through the serial port. When the Arduino first powers on, it finds a normal value for each LDR cell by averaging 3 readings together. This means the lasers must be on and pointed at the LDR cells before the Arduino is powered on. The reset button will cause the Arduino to find a new average for each LDR cell. This was done so we could recalibrate if the fog conditions changed too much.

There is also a sensitivity level that can be set. We test for a broken laser by checking if the current LDR cell reading is less than the average-sensitivity. When a break is detected, we send the alarm signal to the serial port, and we activate the servo that turns on the red light. The push buttons for start, stop, and reset use the internal pull up resisters in the Arduino. The push button pins read high when they are not pressed, and low when they are pressed. The stop, start, and reset signals are only sent to the serial port one time when a high to low edge is detected. This prevents the Arduino from needlessly spamming the serial port. The schematic shows how the buttons, LDR cells, and servro should be connected to the Arduino.

Step 5: The Processing Video

The Processing code accepts 4 serial commands from the Arduino, and
displays the state of the game on the monitor based on those commands.

The basic flow of the program through the 5 states is:

1. Display PRESS START screen (start button pressed)

2. Display intro movie (start button pressed a second time, or end of movie)

3. Display 3, 2, 1, GO countdown

4. Display game timer and number of alarms (stop button pressed)

5. Display final time and number of alarms (start button to return to beginning)

If the reset button is pressed at any time, the game goes back to the PRESS START screen. The code is full of comments to help you figure out what is going on. Most of it is very similar to the examples I found on the Processing website. The default video library did not work well for me, so I used GSVideo instead.

The alarm sound should be placed in the root folder of C drive. I have attached the alarm sound too.

Step 6: The Hardware

Picture of The Hardware

Since the fest was over i wasn;t able to take a proper phot of a few hardware pieces, but the lasers are attached to an L-Bracket. For the LDR cell i used old deo caps instead of cardboard tubes. and covered them with frosting paper.

Step 7: Enjoy the Laser Maze

you can even daisy chain 2 arduinos and use multiple laser so that a tag team laser match can go on.

Comments

About This Instructable

1,122views

13favorites

License:

More by AyushP19:Lazer Maze
Add instructable to: