Laser Triggered Countdown

2,409

20

This is a simple arduino based project that consists of a laser tripwire that, when triggered, will begin a countdown sequence on red, orange and green LEDs. I designed this to be an easy project for someone learning how arduinos work (like me).

This is my first instructable so please bare with me :)
(I'll apologies in advance the picture quality, my phone's camera isn't too great)

Let's Go!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Materials

Materials needed for this project:

-  Arduino Uno (or similar)
-  LEDs (3x Red, 2x Orange, and 1 Green)
-  3x 150 Ohm Resistors (or similar)
-  1x 10K Resistor
-  LDR (Light dependent resistor)
-  Laser
-  Electrical tape
-  Power Supply for Arduino (USB or battery)
-  Arduino Prototype shield (optional)

Step 2: Connecting the Components

Connect all the components using the diagram as a guide.

The ldr will have one leg hooked up to the arduino's 5volt and the other connected to the arduino's ground through the 10k resistor. The ldr will also have one leg connected to analog 0.

All the LEDs are connecting in parallel with their positive terminals connected to the arduino (Red - digital pin 13, Orange - digital pin 12 and green - digital pin 11) and their negative terminals connected to ground through a 150 ohm resistor.

I hope the diagram (Made with Fritzing) explains this better than I have.

Step 3: Programming

First of all we need to calibrate the laser to its surroundings.
Take the now completed circuit to the location that this will be used. Connect the arduino to a laptop or computer and open the arduino software installed on it.

Copy + paste this sketch into the window:

// Laser Calibration

void setup()
{
Serial.begin(9600);
}

void loop()
{
}

With the serial window open point your laser so it shines directly upon the ldr.
You will notice that the numbers in the serial window rise up to around 900ish. (if this doesn't happen go back to step 2 and check that all your wiring is correct)
Note down the average number seen and take 50 away from it (mine was around 950 so I ended up with 900)
This number stops the ldr from reacting to the atmospheric light and just the light emitted from the laser.

Now copy and paste the following sketch into the arduino window:

// LASAR TRIGGERED COUNTDOWN

#define Red 13
#define Orange 12
#define Green 11

void setup()

{
pinMode(Red, OUTPUT);
pinMode(Orange, OUTPUT);
pinMode(Green, OUTPUT);
}

void loop()
{

if(analogRead(0) < 900) // Enter the value you got when calibrating here, mine was 900
{
digitalWrite(Red, HIGH); // 5
delay (950);
digitalWrite(Red, LOW);
delay (50);
digitalWrite(Red, HIGH); // 4
delay (950);
digitalWrite(Red, LOW);
delay (50);
digitalWrite(Red, HIGH); // 3
delay (950);
digitalWrite(Red, LOW);
delay (50);
digitalWrite(Red, HIGH); // 2
delay (950);
digitalWrite(Red, LOW);
delay (50);
digitalWrite(Orange, HIGH); // 1
delay (950);
digitalWrite(Orange, LOW);
delay (50);
digitalWrite(Green, HIGH); // GO!
delay (5000);
digitalWrite(Green, LOW);
}

else
{
digitalWrite(Red, LOW);
digitalWrite(Orange, LOW);
digitalWrite(Green, LOW);
}

}

Find the line *if(analogRead(0) < 900)* and replace 900 with your calibration number

Step 4: Setting Up

Now that all the code has been uploaded the laser triggered countdown device is ready!
Take the device to the desired location and place it on a stable surface.
Now take your laser and from a reasonable distance away focus the laser on the ldr. (Lasers can be dangerous, use them carefully. I am not responsible for any injuries you may inflict upon yourself or others while using a laser)
At this point, tape down the 'on' button for the laser and find something you can leave it on which won't be disturbed. Taping the laser to the stable surface is also recommended.
Now just connect the arduino to a suitable power source and you're ready to go!
Test the device by breaking the laser beam with your hand... and if all goes well the LEDs will begin counting down from 5.
If the countdown doesn't begin after breaking the beam then your calibration number isn't correct.
Lower or rise the number until the device is working perfectly.

Step 5: Final Words

Congratulations! You have created your very own laser controlled countdown device. What you do with it now is up to you. The possibilities are endless! Buzzers, flashing lights and even alarms can be added. Mess around with the code and come up with something unique to you.

Have fun!

Participated in the
Pocket Sized Electronics

Participated in the
Battery Powered Contest

Participated in the
Arduino Contest

Recommendations

• Internet of Things Class

22,773 Enrolled