Introduction: Laser Trip Wire Using an LED
Did you know that LEDs can be used as both light emitters as well as light detectors? The ever amazing Forrest Mims discovered this decades ago and has several projects highlighting this concept. It's what makes photodiodes work, and why your IR emitting TV remote can control your TV. I decided to go crazy with the idea and build a fully analog laser trip wire alarm.
While this project works well, it is more of an exercise in analog circuit building than anything else. I built it because 1) I could, 2) I haven't used LEDs like this before, and 3) I really like analog circuits. It starts with using an LED to indicate when the laser beam has been broken. Photoresistors work very well for this and I've seen several applications with that. Photodiodes use the same idea as using an LED but are purpose built as light detectors. I specifically wanted to use an LED in a way it wasn't designed, but not go into the potentially dangerous side of misusing components. After the LED detects the break in the beam, the rest of the circuit is just a series of really simple analog circuits. The beauty is that each piece can be broken off and used in an entirely separate and unrelated circuit.
So get ready, cuz we're gonna get some learnin' done!!
Step 1: The Mims Effect
LED stands for Light Emitting Diode. A diode is an electronic component that only allows current to flow in one direction. They make great protectors to keep stray currents out of the wrong places. When the diode junction is doped with a material that emits light when electrically excited, and then encased in a transparent or translucent casing, we get an LED. This emission of light requires a measurable amount of power. (Wikipedia has a pretty good section on the working principle behind LEDs.)
But this idea can also be reversed. Emitted light has a quantifiable amount of energy called a photon. If we reverse this and bombard the diode junction with this same energy, it stands to reason that we should expect some measurable amount of power out of the LED. Turns out you do, and it's known as the Mims Effect. You can see below that by using a red laser pointer, the LED generated ~15μA.
That idea is the genesis for this project. As mentioned before, the rest of the circuit is just a collection of various analog circuits smooshed together. So let's take a look at what we will need for this project.
Step 2: The Parts
Here are the parts I used for the circuit as I built it. Good luck!
No? Ok, here's the real list.
nominal value quantity 10MΩ 2 100kΩ 2 47kΩ 1 20kΩ 2 10kΩ 2 6.8kΩ 1 2.2kΩ 1 1kΩ 1 470Ω 2
nominal value quantity 10μF electrolytic 2 100nF (104) ceramic 2 47nF (473) ceramic 1 10nF (103) ceramic 2
nominal value quantity 1N4001 4 5mm LED 1
In theory you could use any LED for this. I chose a red LED with a clear and colorless lens because I had a simple red laser pointer at my disposal. The same circuit works with the LED flashlight on my phone. My 5mm IR LED didn't work nearly as well and a red LED with a red and cloudy lens didn't work at all. Try different combinations to see what works for you.
type quantity 3906 PNP BJT 3
Any PNP BJT that compares to the 3906, like the 2N2907, should work here.
IC quantity OP27 op-amp 2 555 timer 2
Op-amps come in a huge variety of options. Most of them should work here, including the ubiquitous 741.
item type quantity SPDT 9V relay 1 8Ω speaker 1 power supply or 9V batteries as needed wire jumpers as needed solderless breadboards as needed Electronics Explorer Board 1 Waveforms 2015 software 1
I used the Electronics Explorer Board in order to get the +/-9V needed for the op-amps. It has a full suite of tools when paired with the Waveforms 2015 software, like user defined power supplies and oscilloscope, among others. You could also use two 9V batteries to get +/-9V with GND in between.
Step 3: The Circuit
This is the entire circuit schematic, from start to finish.
Since that is less than easy to see clearly, here's a link to the original schematic file
And here is the whole thing laid out on a virtual breadboard.
Again, not super easy to see, so here's another link to the original breadboard file.
The next few steps will detail each portion of the circuit and why I built it that way. There is a lot of good analog stuff involved here, so you may find it worth the read. Or you may want to just go and build, to which I say "Carry on!" Now, on to the individual parts.
Step 4: Detecting Light
The first part is what this entire project was based on, the light detector itself. As stated, I used a 5mm red LED with a clear and colorless lens, reverse biased so that the cathode (the short leg, also indicated by the flat spot on the side of the LED) is connected to +9V and the anode (long leg) is connect to the base of Q1, a 3906 PNP BJT. (Check out my previous Instructable on BJT basics for more info.) The emitter of Q1 is connected to +9V, the collector is connected to the input of the op-amp (next step), and a 10MΩ pull-down resistor is connected between the base and GND.
Q1 is a BJT, or bi-polar junction transistor, and acts like a gate that opens up when a negative current is present on the gate pin. The problem is that the LED puts out VERY little positive current when exposed to a bright light, so the 10MΩ pull-down resistor is there to ensure that Q1 opens unless the LED is fully exposed to a strong light source. As long as the LED is exposed to a strong source, it has enough current output to override the pull-down resistor and keep Q1 from opening and sending a signal to the op-amp.
The LED will also put out a measurable voltage, somewhere around +1.5V. I could have used that to trigger the rest of the circuit, but I didn't want to. Hence using a current sensitive PNP BJT.
Step 5: Amplifying and Stabilizing the Signal
Once Q1 opens, the next step is to amplify that signal with an op-amp. I set up U1 as a simple amplifier with a 20X gain to ensure that the output of U1 would be as high as the op-amp could go. R2 is there to pull the + input pin to GND if Q1 is not open. It is not uncommon to get anomalous readings that the circuit could read as a signal and trigger on when that's not what you want. This keeps that from happening. (For more on op-amp basics, check out my previous Instructables. Part 1. Part 2.)
The signal from U1 goes straight on to U3, a second OP27 op-amp set up as a voltage follower.
The signal coming out of U1 had enough voltage to engage the relay (next step), but not enough current to hold it. U3 buffers the signal to maintain ~+9V, but boosts the current because it is an active component and has additional power input pins that can provide that extra current. These additional power pins are the only place where the -9V is needed in this circuit. In theory, I should have been able to get it to work fine with only +9V and GND, but the whole thing worked way better when the OP27s also had -9V applied.
Step 6: Latching the Circuit ON
Without a latch of some kind, the circuit would simply turn off once the laser beam hit the LED again. The point is to alarm when it is broken and stay alarmed, regardless of what happens next, so I added a latching relay. The circuit is super simple, but I added some diodes for this specific application as detailed below. The signal from U3 connects through D1 to one of the relay coil pins. A slide switch (S1) goes between the second coil pin and GND. D2 connects between the NO pin and the coil pin that D1 is connected to. The NO pin also connects to the oscillation circuit (next step). The relay's common pin goes to +9V. This connection to +9V will power the rest of the circuit. The NC contact is not used in this application.
The signal comes out of U2 through D1. Once the relay is latched open, the connection between U3 and U2 is at +9V, regardless of whether Q1 is open and therefore sending a signal through to U3. D1 prevents current from going back into U3 when U3 is turned off. D2 is there to ensure that the rest of the circuit only receives power when the relay is latched open. S1 allows the user to install and power the circuit without having it go off. The relay will not power, and therefore not latch, if S1 is open, keeping the alarm from going off until the user has the laser placed and centered on the LED.
Step 7: Siren Oscillation
No alarm system is complete without a siren, which of course requires an oscillator. I could easily use a pre-built siren module, but where's the fun and learning in that? Besides, this particular circuit is dead simple. Connect both emitters from Q2 and Q3 to the output of the latched relay. Connect R6 between the base pin of Q2 and GND. Do the same with R5 and the base pin of Q3. Connect the cathode of C1 to the base pin of Q3 and the anode of C1 to the collector pin of Q2. Connect the C2 in a similar manner, with the cathode to the base pin of Q2 and the anode to the collector of Q3. R7 connects between the collector of Q2 and U4 (next step). R8 connects between the collector of Q3 and U5.
This oscillator simply switches between turning on the two 555 audio frequency oscillators that follow. The timing of this oscillator is about 0.8Hz, set by the R/C combos of R5/C1 and R6/C2. Changing any of those values will result in a different oscillation pattern. Play around with it and have fun. You can't really hurt this part of the circuit. R7 and R8 are simply there to add a load to the output of this oscillator so that the rest of the circuit works well. Using the Explorer Board's oscilloscope tool, I captured this image of the siren oscillator, sampling the signals where R7 and R8 are tied to the collector pins of Q2 and Q3 respectively.
You can see that the two signals alternate between hi/lo. The signals also aren't perfectly timed to be the exact same length. Exact precision was not remotely needed for this circuit, so I didn't worry about it. With some trial and error you could really dial in the circuit.
Step 8: 555 Frequency Generators
The 555 is a truly elegant piece of engineering. For some history and basics on using it, check out my previous Instructable. This particular configuration is the astable multivibrator mode, which just means that the output will oscillate between on/off at a frequency and duty cycle determined by the resistors and capacitors. Note that in the schematic image C3 is listed as 100nF. Fritzing is limited for some reason to only a handful of capacitor values. C3 should be 47nF. I'll be using Multisim from now on for that reason, among others. Anyway, the images.
As the signal from the previous oscillator alternates between the two BJT collector pins, the 555s take turns turning on and off. U4 turns on for a half second, then it shuts off as U5 turns on for a half second. The outputs from both U4 and U5 are tied to the same speaker, but with D3 and D4 in between. D3 keeps the signal from U5 going back into U4 when U4 is off and U5 is on. D4 does the same thing for U5. Capacitors C4 and C7 are just there to help the 555s work properly and do not play a part in calculating the frequency/duty cycle of their respective 555.
With the Explorer Board scope channels sampling between the D3/D4 and their respective 555s, you get the following image.
Step 9: The End
The completed circuit.
So that's it. As I said, it's more of a practical exercise in analog circuits than anything. Each of the portions highlighted can be used independently in completely different applications. You can modify this circuit to suit your own needs. You can replace the entire 555 circuitry with a couple of LEDs between R7 and R8 and GND. You could add those same LEDs in series with R7 and R8 to the circuit as shown, giving a visual as well as audible signal. Make it your own. Just be sure to share what you do with the rest of us so we can all learn together.
Thanks for reading my Laser Trip-Wire Instructable. If you have questions, please ask them in the comments below, though PM's are always welcome as well. You just never know when someone else has the same question and that way we can all learn and help each other get better. Have fun building!
Also, please check out the Digilent blog where I contribute from time to time.
We have a be nice policy.
Please be positive and constructive.