Introduction: Laser Trip Wire Security System With Combination Lock and Epic Siren!

About: Hi there! My name is Patrick, and I am an electronics engineering technician who works full time as a lab tech, and part time as an electronics engineer/salesman. I own an ebay store, and two websites, which …
Hi Everyone!  Welcome To My Instructable!
My laser trip-wire security system employs a programmable combination lock that acts to arm and disarm the system, as well as indicate to the microprocessor if someone has entered in a faulty code (Tampering).  There is also a really awesome and LOUD Siren with strobing indicator LEDs.  The laser trip-wire is bounced across several carefully aligned mirrors and back to the laser detection circuit.  The costs to create this project are pretty low. The only real cost is in the siren ($19) , the LS7222 ($6), and the keypad ($5).

Aligning the mirrors was the most difficult part, as I had to purchase sticky tack to stick them to the wall, and to be able to adjust the mirrors in different directions.  The sticky tack kept moving over time, which made it extremely difficult. However, patience persevered, and I was able to get a nice video demonstration. I was able to purchase the Mirrors and the sticky tack at the local dollar store!

If there was more time, I would have added an extremely sensitive laser detection circuit, and a battery backup but instead I've added these schematics and instructions into the EXTRAS section so that you can use them in your future projects.  I've posted three videos relating to this project::
1) A demonstration of my design with the mirror set-up that I have in my hallway.
2) A breakdown video of the electronics involved for those of you who don't want to have to read through the electronic block sections of this instructable.
3) A second up-close demonstration of the system with an explanation of the program algorithm.


I have worked extremely hard to offer as much detail as humanly possible regarding each aspect of the electronic hardware.  I've included copies of thoroughly commented software, and a block diagram of the program algorithm.

For the better part, I don't expect anyone to fully re-create this project, but I have detailed so much information that the viewer will be able to use many blocks and schematics, or variations of them in their own projects.  Thanks for viewing.  As always, I appreciate your comments and perhaps your votes, if you find I deserve them =)

I've designed and implemented this model into a DIY kit.  While I haven't integrated it yet, it will be available at www.engineeringshock.com and www.electroniclessons.com (Ebay Store) By mid February 2013.  It will include the circuit, a pulsing siren, and an AC adapter.  Below is the demonstration video:

Step 1: Device Features + Demonstration

Design Features:

1) A combination lock circuit that employs the versatile LS7222 combination lock IC.  The code can be re-programmed with ease using the matrix keypad.  The same code is used to arm and disarm the system.  If someone enters in an incorrect character, the tamper output pulses a warning to the microprocessor, and initiates the alarm sequence.

2) Two light sensing circuits.  One of them is aimed at the ceiling, and indicates to the microprocessor whether or not there is enough light in the room for the system to work.  After the ARM code in entered in, the system waits for the light to go out in the room before it enables the laser and starts scanning for a laser breach/tamper/or DISARM code to be entered into the keypad.  Check out the program algorithm block diagram in step#9 for more information.  The second light sensor is used to detect the laser beam.

3) The extremely loud EPIC siren with Strobing LEDs.  This siren is activated by the microprocessor via a driver circuit.  When the laser program is enabled, if someone breaks the beam that is being mirrored all over the doorway, the alarm is triggered.  As well, if someone enters in an incorrect character.... ALARM.  If the alarm goes off, the user must enter in the ARM/DISARM code to disable the program, and reset them system.

4) A 5mW red laser with a manual enable (Push button) and a software trigger/driver.  We use the manual enable to align the laser through a series of mirrors, and back to the laser detection light sensor circuit.  Once we've done that, we turn the laser off, and enable the system.  From there, the software will dictate when the laser is turned on or off.  See Step#6 (Laser electronic Block).

5) The microprocessor is a PIC18F1220 from Microchip Technologies.  It takes the signals from the light sensors and the combination locks, and outputs signals to the on-board piezo buzzer indicator, the siren, and acts to enable/disable the 5mW laser.

6) Please note that I've added in some fun extras in the EXTRAS section, such as how to employ a battery backup, and how to make an extremely sensitive laser detector.

Here is the first of three videos.  This video is the mirror demonstration.  See Step#2 for the video version of the electronic summary, and Step#9 for an up close demonstration with a program algorithm discussion.



Step 2: The Hardware (Electronic Discussion)

Don't worry =)  I'm not going to break down this circuit using this hard-to-read schematic.  You can either go step by step through broken down electronic blocks from step#3 to step#8, or you can follow along with the following video.  In this video, I go through each of these electronic blocks and talk about how each of them work, and what could be improved in future revisions. 

NOTE: IF YOU WANT TO LEARN ABOUT A BETTER WAY TO DETECT LASERS, GO TO STEP#11 (EXTRAS)
NOTE: IF YOU WANT TO LEARN ABOUT A SIMPLE BATTERY BACKUP CIRCUIT, TO TO STEP#11 (EXTRAS)

If you don't want to follow along with the electronic blocks, I do a brief rundown in this video:

Step 3: Block#1 the Voltage Regulator Circuits

The first thing we have to worry about is our DC voltages.  Our PIC18F1220 requires a 5v source, which is common to most ICs, and we want to use 5v for our LM324 comparator circuits as well.  However, 3v is required for our 5mW laser and for our siren, so we have the task of finding an optimum 3v source.  Of course, I chose the LM317 variable power supply IC which we can easily tune to 3VDC.

Setting up our LM7805:
Easy as pie!  If you have battery power at the input, you don't even really need the 100uF capacitor at the input.  However, we are using a wall wart, so we WILL use one =)  That 100uF is a smoothing capacitor.   There is also a 0.1uF decoupling capacitor at the output.  This is to filter any high frequency spikes, should they occur.  Very simple.  Pin#1 is your DC input (7VDC or higher will give you a regulated 5v output), pin#2 is your ground pin, and pin#3 (With the decoupling capacitor) is your regulated 5v output.  

Setting up our LM317:
The LM317 circuit is a tiny bit more complicated, as it requires more external hardware.  The pin-out is also different.  By turning the variable resistor (5k), you can tune the output to your required voltage.  In this case, 3v.  When you're done, glue down the turnable head of the variable resistor.  Now, some of you might say, "Hey!  Why not just do the calculation and put a fixed resistor in place of the potentiometer???".  Well most resistors have a 5% tolerance, and I want a perfect 3v on my Laser and my Siren.  I have just that by having a precision tunable output.   There is an additonal 100uF capacitor at the output because when the siren is turned on, it may induce some ripple on the line.  This capacitor will smooth it. 

The DC Power Supply:
A reliable DC source is required to power our circuit.  We need at least 1A of current to be safe, and a voltage of higher than 7VDC.  I used a wall transformer with an output of 8.4VDC at 1.7A.  This was over-kill, but it is always better to be safe than sorry =)  When the system is not enabled, the circuit requires very little current.  The only time the circuit consumes any real current is when the alarm is going off.  If you want to take a wall wart and use it in your projects, follow these steps:
1) Strip off the end wires and separate them far enough so that they won't short together.
2) Set your multimeter to read at least 10VDC (Some multimeters have variable voltage settings).
3) Place the red probe of the multimeter on one of the stripped wires, and the black probe on the other wire.
4) Plug in the wall transformer, making sure that the wires are NOT shorting.
5) If the voltage meter gives you a negative voltage, then you have the probes mixed up, and you have the black probe probing the positive DC wire, and the red probe probing the negative DC wire (DC Ground).
6) If that is the case, just to be sure, unplug your wall transformer, and switch your probes to be connected to the opposite wires. and repeat step#4
7) If you are reading a positive DC voltage (In this case 8.4VDC or so), then label the wire connected to your red probe with a (+), and the wire connected to your black probe with a (-).  Now you know which wire is your positive DC source, and which one is your DC ground.  You can now apply it to your LM317/LM7805 circuits.
8) MAKE SURE THAT THERE ARE NO SHORTS IN YOUR CIRCUIT WHEN YOU DO THIS! 

Voltage regulator assortments can be purchased here: http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=170605899893&ssPageName=STRK:MESE:IT

Now that we have our 5v and 3v sources, let's see what the next block has in store for us!

Step 4: Block#2 the Combination Lock

Okay, so this is the combination lock circuit.  It may look complicated, but it really isn't.  The data sheet has a sample circuit that is similar to this, but I have made some modifications.  From a hardware perspective, there are essentially four things we have to worry about:

1) The Keypad - Matrix keypads such as the one I've used should all have the same pin-out.  You can make your own with some monetary push buttons, or you can purchase one off ebay.  We actually sell 16-button matrix keypads (As seen in one of the images in this block), which can be interfaced just as easily to the LS7222.  There are 4x 10k resistors placed on pins#3, 4, 5, and 6.  These resistors are not required, but it is a good idea to use them.  They protect the circuit from potential ESD discharges.  The lines on the matrix keypad (X1-4, and Y1-3) help you to understand how to program the LS7222, and are mentioned in reference in the data sheet, which can be found here:
http://www.lsicsi.com/pdfs/Data_Sheets/LS7222.pdf

2) The RC Oscillator:  If you have a capacitor between 50p and 300p, it will work.  You need a resistor between 500k and 2M Ohms.  This combination creates the internal frequency at which the LS7220 will function.  The RC oscillator circuit is located at the first two pins of the IC.

3) The two timing capacitors CAP-M and CAP-K:   The LS7220 has many outputs, but we are only using the ARM and TAMPER outputs.  When the ARM code is entered, the ARM output goes high for a duration that is based on the value of CAP-M.  A table relative to the pulse-duration to capacitor value relation can be found in the data sheet.  The value of CAP-K determine how long the user has to input a code.  There is also a table in the data sheet that gives the code enter timing to capacitor value relation.  If you use 4u7 caps for both CAP-K and CAP-M, you're going to have a good day =)

4) The PROGRAM MODE Indicator LED: I've simply added a 470R current limiting resistor and a yellow LED to the PROGRAM MODE Indicator.  When you power on the device, the DEFAULT ARM/DISARM code is 1254.  This will act to arm and disarm the system by sending a pulse to the MCU via the ARM/DISARM line.  If you press 1252** (1252 star star), then the program LED will turn on and you will be able to re-enter a new code.  Now, there are essentially three enter-able codes for the LS7222, but we are only worrying about one.  However, when entering a new code, you have to enter in a factor of all three.  The first three digits of all three codes are the same.

To enter into Programming mode (Please note that this isn't essential to the circuit, and can be skipped if you're not interested):
1) Power the device on.
2) Enter default code (1254 + **)  This will turn on the yellow program LED indicator.
3) Type in the new code (6 digits).  Remember we only care about one code, but we have to enter in the information for all three. 
4) Since the first three digits are common, and the last three are relative to the end digits to each code, if we press 123456
then the first code will be 1234, the second will be 1235, and the ARM/DISARM code will be 1236.  It is a little complicated, but you really have to spend some time playing with it.  HOWEVER, the LS7222 has a much simpler little brother named the LS7220.  If you're interested in a really simple combination lock, check out the data sheet here:
http://www.google.ca/#sclient=psy&hl=en&site=&source=hp&q=ls7220&aq=f&aqi=&aql=&oq=&pbx=1&fp=af8369df22e4f31a
Both the LS7220 and LS7222 can be purchased here: http://stores.ebay.com/engineeringshockelectronics

If you have any questions, I will do my best to answer, but check out the electronic HW SW video I've enclosed.  I give demonstrations!

Step 5: Block#3 the Laser Driver

Ah, a very simple step!  This is a handy circuit.  We have a simple 5mW laser that is connected to the 3v source provided by the LM317 (Red wire), and the negative (black wire) is connected to a transistor switch to ground.  When power is applied to the base of this NPN transistor, the transistor acts to sink power from the collector (Connected to the black wire) through to the emitter, which is connected to the ground line (Completing the circuit).  The PIC18F1220 output RB0 acts to apply power to the base of the transistor through a protective 10k resistor when the program is enabled. 

However, since I wanted to use mirrors, it is necessary to be able to turn the laser on and off manually when the program is not running so that you can line the lasers up through the mirror to the laser detector circuit.  The "Manual Laser Enable Button" acts to to just this.  it does exactly what the transistor does when power is applied tot he base.  If connects the negative (black wire) to ground.

The program will tell the PIC18F1220 to turn this laser on and off as the program initiates, and deactivates.

On to the next Block!

Step 6: Block#4 the Light and Laser Detectors

The Room Light Sensor and The Laser Sensor circuits:
As I mentioned earlier, there are two identical light detection circuits being used in this device.  The first sensor is aimed at the ceiling and acts to tell the PIC18F1220 when the lights have turned out.  When the system is powered on, it waits for the ARM/DISARM code to be inputted into the keypad.  Once that happens, the system must wait for the first light sensor circuit to indicate that the lights have gone out, and that the laser system must be turned on.  I had three reasons for why I chose to do this:
1) It looks really cool =)
2) Since I am using photo resistors, the laser detection circuit would not be able to differentiate between room light and the laser, and the system would get confused.
3) I am using a 5mW laser, which is pretty darn weak.  If I was using a stronger laser, it would work in room lighting, but I'd have to use the special laser detection circuit that I talk about in the EXTRAS section.

Anyhow, to break it down, one circuit tells the MCU if the lights are on and off, and one circuit acts to sense the laser.  Let's break down the circuitry.   Remember that both the light sensor and the laser sensor circuits are the identical (GO TO THE SECOND, THIRD, AND FOURTH IMAGES).

IMAGE#2
What we have here is a comparator circuit.  For this, we use two voltage dividers and one of four operational amplifiers that are located within the LM324 IC.  The first voltage divider network consists of the left 10k resistor, and the photo resistor.  The second voltage divider circuit is on the right hand side, and it consists of another 10k resistor, and a 15k resistor.  Both voltage dividers are being supplied 5v.  We'll get back to this in a minute.

The comparator configuration is extremely simple!  If there is more voltage at the negative (-) input than there is at the positive input (+), then the output will be low (0v).  If there is more voltage at the positive (+) input of the comparator than there is at the negative (-) input, then the output will be high (5v).  

The right voltage divider is fixed, as there are just two plain old resistors in series here.  The voltage between them is 3v, and we can determine this by an easy formula.  Consider the 10k to be RA, the 15k to be RB, and the voltage in the middle (connected to the negative input) to be Voltage-X.
Voltage-X = [5v / (RA+RB)] x RB
Voltage-X = [5 / (25000)] x 15000
Voltage-X = 3v   (Try the same equation if both resistor were 10k.  The answer would be 2.5v.  The voltage in a divider is proportional)

So we always have 3v at the negative input of the comparator.  That is our fixed variable. 

IMAGE#3 - CIRCUIT REACTION WHEN EXPOSED TO LIGHT
Time to talk about our left divider.  The is our light dependent variable.  We have the 10k resistor in series with the photo resistor.  For those of you who are not familiar with photo resistors, they have a variable resistance that depends on how much light they are exposed to.  In this case, I am using some photo resistors that, when exposed to light have about 1k (1000) ohms of resistance, and about 25k (25000) ohms of resistance when exposed to darkness.  In the case of Image#3, we are doing a calculation under the assumption that there is a lot of light in the room (Or a laser hitting the sensor).  If there is a lot of light, then the photo resistor will have about 1k ohms of resistance, so let's do the same calculation as before for the left voltage divider.
Voltage-X = [5v / (RA+RB)] x RB (Where RB is the Photo Resistor)
Voltage-X = [5 / (11000)] x 1000
Voltage-X = 0.4545 (455mV)

So now we know the voltage at the positive (+) input of the comparator.  There is 3v at the negative input, and 455mV at the positive input, then the output will be LOW!  I'll bet you don't even have to look at the fourth image, do you?  =)  Let's do, for good measure.

IMAGE#4 - SENSOR CIRCUIT EXPOSED TO DARKNESS
The only thing here that has changed is the value of the light sensor.  The lights are off in the room!  The resistance of the light sensor has shot from 1k ohms up to 25k ohms!  This changes everything!
Voltage-X = [5v / (RA+RB)] x RB (Where RB is the Photo Resistor)
Voltage-X = [5 / (35000)] x 25000
Voltage-X = 3.57v

So now the voltage at the positive input is 3.57v, and is truly higher than the fixed voltage that we have at the negative input, which is 3v.  So what happens?  the output swings from low to high!  This signal will activate our system, assuming that the ARM code has been punched in.

PHEW!  On to the next block!





Step 7: Block#5 the Siren Driver Circuit

THE SIREN AND DRIVER:
Hurray!  The Siren!  So loud!  So Proud!
....Unfortunately, it was not initially meant to be configured this way.  I had to remove an on-board reed switch, and simply use the positive and negative leads to activate and deactivate the thing.  Initially, I just used a transistor to drive the siren, but I found that the transistors that I had in stock would not sink enough current to drive it =(   However, the transistor did not go to waste!  No transistors were trashed in the making of this system!

I used the same transistor (Another 2N5551 NPN transistor) to drive a 5v relay.  For those of you who are not familiar with relays, here is a very short lesson.  Here we have a 5-pin Single Pole Double Throw relay.  Two pins are connected internally through a coil of wire.  When power (5v) is applied to that coil of wire, it creates a magnetic field within the relay, and acts to switch the COMMON pin (Which is the middle pin connected to the ground line in the schematic) to the (NORMALLY OPEN) pin of the relay, which is connected to the negative (black) wire of the siren.  The COMMON pin is by default connected to the NORMALLY CONNECTED pin, which we don't have anything connected to.   Since the positive (red) wire is connected to our 3v source, as soon as the negative wire is connected to ground, the siren sounds.    The transistor acts to sink power through the relay coil when the PIC18F1220 sends a pulse to the base.  When this happens, the magnetic field is created, switching the relay on, connecting the negative wire of the siren to the COMMON pin of the relay, which is grounded - Completing the circuit, and creating one hell of a racket!

We have a protective 1N4004 diode that is placed along the coil (anode (+) to the 5v source), and cathode (-) to the collector of the transistor).  This is a safety component.   When the relay is turned off, the magnetic field created on the coil collapses, which causes a very fast voltage spike which can harm ICs and transistors.  This diode shunt protects the circuitry from this spike.

There is a 10k protective resistor on the base of the transistor, and a 10uF capacitor between the signal line (RB1) and ground.  This acts as somewhat if a power-on-reset circuit in the sense that if this capacitor is not here when you power on the device, there may be a quick spike on the line, which will activate the transistor, which will activate the relay, which will activate the SIREN!  If only for a split second.  This capacitor will absorb that spike.

The Siren can be purchased here:
http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=170625583199&ssPageName=STRK:MESE:IT

On to the final block!

Step 8: Final Block: the PIC18F1220 MCU

The Brain (PIC18F1220):
Good golly, we're just about done!  This is our microprocessor: The PIC18F1220 by Microchip Technologies.  If I had something smaller handy, I may have used it, but I trust this chip.  I've fought many battles along side this chip =)  PROGRAMMING BATTLES!
Anyhow, this chip acts to interpret input conditions, process them, and output signals under software control.  If you go to the algorithm page, you'll have a better idea of what I'm talking about.  We have a piezo DC 5v buzzer on the RA5 pin, which has been configured as an output.  This piezo tell us when the ARM code has been entered, when the lights have gone out (When the laser program starts), and when the system has been disarmed. 
System ARM = 3 beeps
Laser Program Enable = 8 beeps

The chip requires a 5v source.  If you can get your hands on an ICD2 programmer, you can literally take my .ASM code, and program one of these chips in 5 minutes.  They are extremely easy to use, and the assembly code instruction set, while primitive, is extremely practical.  Let me give you a really limited idea of what the chip is doing here.  I'll leave the rest to the program algoritm page.

1) Power on
2) Chip reads start-up settings (Oscillator configurations, I/O configurations), etc. 
3) Program starts - Waits for ARM code
4) Once arm code signal is received, (Three beeps from piezo).  System then waits for the room light detector circuit to indicate that the room is dark enough for the laser system to work)
5) System receives signal indicating that room is dark (Eight beeps from piezo).
6) Laser turns on.  If no laser is detected, (3 beeps) system reset.  LASER NOT DETECTED - You haven't lined up the laser properly.
7) If laser is detected, wait for laser detector circuit to indicate a breach, or wait for the ARM/DISARM code.
8) If laser is breached, enable alarm, and hold until ARM/DISARM code is entered.
9) If ARM/DISARM code is entered, turn off laser and disable security system (Three Beeps from piezo)
10) System Reset

The PIC follows certain instructions that I've programmed into it.  See the program algorithm page and the software page if you want to know more!  I've done my best to comment on the software as best I can.  Check out the attached .TXT file.

Step 9: The Program Algorithm

Here is the final video the shows some up close demonstrations, and a discussion on the below program algorithm: 

The Program Algorithm:
This is the order of the steps that the program will follow under varying conditions. Here is a block diagram that starts in the upper left at the SYSTEM START block (When power is first applied to the device).  This algorithm has already been explained, but not in detail.  It follow these steps:

1) Has the ARM code been entered?  If not, scan again.  This instruction keeps looping until a signal is received from the ARM/DISARM line of the LS7222.

2) Once the PIC has been told that the ARM/DISARM code has been entered, the DC piezo buzzer beeps three times, indicating that it is now waiting for the lights to go out.  I did not have room to add this block. 

3) The system then looks for a signal (high) from the room light detection circuit.  It keeps scanning (waiting) until it receives this signal.

4)  Once this signal is received, it is because the lights in the room have been turned off.  Please note again that I used two light detectors instead of one because I wanted one to face the ceiling for this purpose.

5) When the lights go out, and the signal is received, the piezo will beep eight times to indicate that the laser trip-wire circuit will be initiating.  The laser is then enabled, and the laser detection circuit is then scanned to determine if the laser is indeed lined up properly with the light sensor.  I used 6 mirrors to do this, and it was a HUGE PAIN to get the laser to bounce around 6 mirrors and line up back with the sensor! Oy!

6) If it is not lined up, the piezo buzzer indicates with three beeps that the system is being disabled, as the laser is NOT lined up properly with the laser detector circuit.  The laser turns off, and the system resets.

7) If the laser is lined up properly with the laser detection circuit, then the real fun begins.  There are three scans in the loop here.  The program scans to see if the laser beam has been broken by scanning the laser detection circuit.  It then scans to see if there is any pulse at the TAMPER pin of the LS7222, which would indicate that someone has pressed an incorrect character into the keypad, then finally it scans to see if the ARM/DISARM code has been entered.

8) If either the PIC senses that the beam has been broken, or if a wrong character has been entered into the keypad, the ALARM will sound, and boy it is nasty! 

9) If the alarm has been triggered, the alarm will stay on until the ARM/DISARM code has been entered.  It will keep scanning for the ARM/DISARM signal.  When the PIC detects a signal from the ARM/DISARM line of the LS7222, the piezo beeps three times to indicate that the system is restarting.  The laser turns off, and the system starts over at the PROGRAM START block.

10) If during the scan, the PIC detects a pulse from the ARM/DISARM line of the LS7222, then the piezo will beep three times, the laser will turn off, and the system will reset back to the PROGRAM START block.




Step 10: The Program (PIC18F1220) ASM Code)

THE CODE:
I used the default instruction set .ASM code to program my PIC18F1220.  I employed my trusty ICD 2 MPLAB PIC programmer by Microchip tecnnologies.  It can be found here:
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010046

A Text file that contains all of my code is here: http://www.electroniclessons.com/LaserSystem.txt
The .ASM code that can be loaded into your PIC is here: http://www.electroniclessons.com/LaserSystem.asm

The reason why I am not posting it directly in the instructable is because when I tried it, it looked nasty.  Asterisks and semicolons were everywhere.  I've done my best to comment the software, so if you look at it, and follow along with the program algorithm, you should be able to follow along, even if you are new to PIC programming, or assembly code.  If you have any questions about the software, I am happy to answer them =)

Step 11: Extras

The Sensitive Laser Detector:
If I had more time, I would have put an old design of mine to work.  I was in a bit of a hurry, so I used the lesser sensitive design.  You see, most laser detection circuits you see are not sensitive. Photo resistors, while sensitive to changes in light, will not change from (In this case) 1k (Light) to 25k (Darkness) as quickly as you might like.  You could likely swing your arm or at least a finger through the laser beam without the resistor having much of a change.  The design below, while a bit more complicated, is extremely sensitive, and I designed it about a year ago for a customer who wanted to detect his golf swing. 

If you read the captions, you should be able to figure the circuit out, but I'll run you through it relatively quickly.

1) Starting from the photo resistor.  We don't care about the voltage divider aspect of this light sensor circuit.  If you pulse a laser at the photo resistor at a high frequency, say 40,000+ Hz, then you are going to see no DC change on the line.  The photo resistor can't change resistance that fast. So what happens if we have a very fast intruder who is able to swing an arm or a finger through the laser? What if we wanted an intruder to breach the laser quickly?  This is what we have here.

2) We have a 0.1uf coupling capacitor between the photo resistor and the positive input of the operational amplifier.  This capacitor blocks all DC voltage from the voltage divider side to the (+) input, but it DOES conduct AC.  When the intruder break the beam either slowly or quickly, an extremely small AC signal is coupled from the photo resistor side, to the (+) input of the operational amplifier. 

3) The non-inverting operational amplifier configuration (LM324) requires a high resistance pull-down resistor at the (+) input in order for this amplifier to work, and a series of resistors at the (-) and ground, and between the (-) input and the output.  These two resistors determine the voltage gain of the amplifier. 
***
Input voltage x Voltage Gain = Output Voltage
If VIN = 200mV, and the voltage gain is 5, then VOUT = (0.200 x 5) = 1v. 
***
The formula that determines voltage gain in a non-inverting amplifier is (1+RF/RA)
In this case, RA is the 10k resistor between the (-) input and ground, and RF being the feedback resistor, which is the 100k variable resistor between the (-) input and the output.  RF is a variable resistor so that you can vary the gain. In this case, the max gain is [1+(100k/10k)], which is 11. 

4) We can amplify that spike and feed it through a comparator circuit so that we can turn it into a perfect square wave, which would be great for digital devices.  We could use the amplified spike to activate a monostable multivibrator circuit, such as a 555 timer set up in one-shop monostable mode, or perhaps a 74LS123, which would turn the spike into a pulse that has a variable duration based on external combination of a resistor and a capacitor, or we could interface the spike with a very fast MCU if we wanted.  If you want to see this circuit in action, here is a video I created about a year ago when I initially designed it.  Skip to 1:50 so you don't have to hear me blab on! 

Here are some other laser related circuits I've played with, if you're interested:
http://www.youtube.com/watch?v=lArT7xHBJGE&feature=related
http://www.youtube.com/watch?v=jVPLIX5G55o




THE BATTERY BACK-UP
Last but not least, the battery back-up circuit. If I had more time, I would have used a battery backup on this circuit.  This would prevent the the LS7222 from losing power, and going back to default code settings should the power go out.  It would also prevent the system from being disarmed should an intruder have wire snips!    I'm going to give you a brief description of this circuit.  As you can see, we have a wall transformer that is outputting 9-10v, and a 9v battery, which is output 9v.  We have one blocking diode that acts to block voltage from the battery (+) port from entering back through the wall transformer (+) port, and another blocking the (+) wall transformer voltage from entering the battery (+) port.  The dominant voltage will power the load.  When the dominant source dies (the transformer is unplugged), the battery takes over, and the LOAD will be none the wiser.  If you wanted to keep the battery back-up circuit on only at certain times, you could add a switch between the positive (+) port of the battery and the anode of the diode.

To reiterate, the diodes create directional walls protecting them from power entering back into them from the opposite source, but allow for power to reach the load from both sources at all times.  Please note that the diodes will have a voltage drop of about 700mV to 1.4v, depending on which diodes you use. 

Step 12: SAFETY AND THANKS

Safety:
1) Don't burn yourself with your soldering Iron
2) Don't point lasers in your eyes, or in the eyes of others!  It is NOT pleasant and you can do serious damage!
3) Don't irritate your neighbors with sirens.  They do retaliate!  In my defense, they had it coming!

Thanks:
Many thanks to you all for looking at this instructable.  Thanks as well to Instructables.com for having such a wonderful and useful site.  I have a few other instructables that I hope you all choose to look at.  I always do my very best to include as much information as I can.
Come visit my hobby store at http://www.engineeringshock.com
My ebay store at: http://www.electroniclessons.com
My youtube account at: http://www.youtube.com/user/patrickikis

Please vote for me in the WICKED LASER CONTEST!  I really appreciate it!  Have a great day, everyone!
Sincerely,
Pat

Wicked Lasers Contest

Third Prize in the
Wicked Lasers Contest

MakerBot Challenge

Participated in the
MakerBot Challenge