Casing The Joint

A fine site

Laser Tripwire Circuit

Circuit Diagram and Equations<—-Actually a link, even though it’s brown.

So this is something that I made to be used as part of a larger circuit/system, which I never got around to designing. I was envisioning it being used to trigger lights as people enter and exit a room (you would need two lasers to determine whether people were going in or out), or, obviously, as a security system. As it stands, blocking or breaking the laser beam in this case simply powers another circuit, which would be connected to a relay for a higher current/voltage external use. See above for a basic circuit diagram and the equations that govern a voltage divider circuit.

I started with the laser pointer from a free promotional pen, which came with a built in blacklight led that I just ignored really. I then modified this to make it able to be software controlled:

Initially, I used some pliers to pull the laser out of the pen case, after removing the batteries:

Ignore the yellow wire for the time being…I then soldered on a yellow wire (surprise!) to the rear spring, which is the positive or power contact. The negative/ground is actually the outer case of the pen, but first, we need to do away with the buttons, so it comes on when we supply power. This was done by simply soldering two contacts of the button together (the strip of solder near the bottom edge). The same could have been done with the led button, but then both would have come on when any power was supplied. To avoid this, you could solder wires to the contacts of the led button. I drilled a small hole in the outer case, and soldered a wire on there too:

Finally, I inserted the laser bit back into the pen case:

Powered with 5V, it works perfectly. The circuit to run it as a tripwire was essentially (well, entirely) a voltage divider, with one section over a resistor of known value, and the other a photodiode, connected in series to one another. The photodiode alters its resistance depending on how much light is hitting it (more light = lower resistance), and this affects the ratio of voltages between it and the resistor, in turn changing how much voltage is lost across each one. The voltage is measured using the microcontroller (an Arduino Uno in this case), and is time averaged to avoid the huge amount of noise that occurred with the analog input pins. A second circuit was connected as the “reaction” circuit; in this case, it was either an led, or a small buzzer, chosen by a switch. The video at the top of the page shows it in action, as well as the wiring to the controller.

Aaaaaaand this is the code I used:

/* Sketch to run laser trip wire circuit and power
another reactive circuit when the laser beam is
broken. By Alex Linossier */

int analogPin=A5; //Set pins to correct values
int laserPin=3;
int reactionPin=6;
long photov; //This variable requires a long variable type because of the summation in the for loop below before the average is taken.
int x;

void setup(){
Serial.begin(9600); //Begin Serial for output reading (not necessary once calibrated)
digitalWrite(reactionPin, LOW);
digitalWrite(laserPin, HIGH);

/* In the loop section, a run of 100 readings is then averaged to produce the printed value of photov,
in order to smooth out the analog readings. This can be increased, however there is a point (~1000)
at which readings become slow, leading to a reduced reaction time. There is no discernible increase
in accuracy. The values are printed, and the circuit is set to turn on at photov values of 200 or less,
obtained through testing and calibration. */

void loop(){
for (x=0; x<=99; x++){
if (photov<200){
analogWrite(reactionPin, 200);
analogWrite(reactionPin, 0);

The serial commands output the voltage values to the computer via the USB cable, allowing for proper calibration (which is how I obtained the cut-off value of 200). This value might change depending on the ambient light in the area of usage, etc. A fully lit room was still below this value, as the laser is VERY bright in comparison. The total cost for this project was $0, although obviously costs would arise if you had to buy the laser, the photodiode, microcontroller, etc.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


This entry was posted on August 9, 2012 by and tagged , , , , , , .
%d bloggers like this: