I will be gutting the camera and using the plastic housing to mount the laser. Since I'll be destroying the camera, I decided to use one of the "wired" cameras. The wireless cameras are still quite useful to me, so I've put them off limits for my projects...for now. The water sensor will be used as a contact/no contact interface into the Homesight system. I used a water sensor rather than a door or temperature sensor because I won't really lose anything if I fry it during my experimentation. I still find the door and temperature sensors useful. The challenge is to build a small circuit that can open or close the sensor's contacts based on presence/absence of the laser light and squeeze that circuit into the battery compartment of the water...er...I mean, laser sensor.
I should mention that I will be using a laser ripped out of a really cheap laser level that I found on clearance for ~$0.50. Cheap. You get what you pay for when dealing with lasers. In this case, that's a good thing. If you hook up a really powerful laser to this, you'll burn through your sensor, your house, your neighbors house, potentially setting fire to your sensor, your house, your neighbor's house. Heck, you might get lucky enough to blind your intruder or slice his legs off at the knee, or burn the hair off the neighbor's cat, etc. The risks outweigh the rewards though, so just go with your typical laser pointer style laser. K?
Step 1: Gutting the Camera, Mounting the Laser
Not sure that I need to go into how to take the plastics apart on the camera. It's pretty straight forward. The camera case does have a lot of potential that I won't be taking advantage of right away.
The lens hole is perfect for mounting a laser harvested from a laser pointer, laser level, or laser whatever. There are many cheap sources of red lasers, so I won't go into that, but that lens hole is where the laser is going to shoot from.
The white section below the lens hole is an infrared transparent lens for the camera's passive infrared motion sensor. I ripped it out before I realized how useful this could be in the future. (Thinking invisible infrared lasers...eye safety could be an issue though...)
So, anyway, take out the camera, being sure to not damage the plastic case. Then, hot glue the laser in place. Solder some longer leads onto the laser, wrap the solder joints in electrical tape or heatshrink tubing, and then feed the wires through the hole provided and down the neck of the camera case.
Incidentally, the camera circuit board itself is pretty neat. The connector makes one think that its a s-video connection, but its not. The pins on the connector are for the composite video, analog mono audio, and the motion sensor trigger (oh, and power and ground too). Very useful, so I've bagged it, tagged it, and thrown it into the closet for some other project, later on, in the future, at some point...honest...would you believe that my wife is rolling her eyes at me right now?
Okay, back on track. How to power the laser? Read on.
Step 2: Powering the Laser and the Other Stuff
If you rip open the bottom, its pretty easy to modify this base to power the laser. The problem, though, is that the wall warts that come with the Homesight equipment are 9V and 12V. Since the laser runs on roughly 3.3V (3 x button cells), I'm going to have to do something about that lest I burn out the laser before my intruder comes a knocking.
So, how do you step down a 9VDC source to ~3.3V? Well, you use a Voltage Regulator circuit, of course. Doing a bit of Googling, I found a tutorial on http://www.sparkfun.com/ on how to build a breadboard power supply. Perfect for my needs. I adapted it somewhat to reduce the components, etched my own PCB (tutorials abound on this topic), and, VOILA! a regulated 3.3VDC source.
Step 3: The Water...er...i Mean, the Laser Sensor
How do you turn a water sensor into a laser sensor? Well, the underlying technology is the same. It is a simple "contact closure" sensor whereby the sensor is triggered when the circuit between two contacts is closed. For a water sensor, the conductivity of the water closes the circuit between the two probes and triggers the sensor. For a laser sensor, we have to figure out how to close the contacts with a beam of red light.
Here's where you're going to have to really pay attention to the pictures. I'm not a terribly descriptive person, so work with me here...
Figure 1 shows a ripped open water sensor. Actually, the large majority of the sensors of this form factor in the Motorola line are virtually identical to this. The difference is that the sensing technology is populated differently.
So, here's the cool thing. See those door sensor pads? If you connect them together with a wire, the sensor triggers, you disconnect them, they reset. See how it's a contact closure type system?
So, how do you get a laser to bridge that gap? With a light sensor. Read on, and I'll show you how to build one.
Step 4: Building the Laser Sensor
First, find a ball point pen. You know, the kind you steal from hotel rooms? The kind you used for spit wads in elementary school? Yeah, those. Disassemble the pen and throw away the cap and the ink cartridge. This leaves you with the tube and the little plug at the end. Take the plug out because this is where the photoresistor is going.
Straighten the legs of the photoresistor and slide it into the tube about 1/2 inch or so. Bend the leads of the photoresistor around the edge of the tube. Jam the plug back into its place, pinning the two leads between the side of the tube and the plug.
Congratulations! You've just made a photosensor.
A few notes... First, the pen doesn't need to be black, but if it is not, then wind a bit of electrical tape around the tube. In fact, even if its black, wind some electrical tape around the tube. The idea is that only light that comes in from the end of the tube will reach the photoresistor. White pens, in particular, bleed light through the sides of the tube. Gotta put a stop to that because it'll cause false readings later on. Also, this is where if you have a laser that is too powerful, it'll burn out your photoresistor. Stick to cheap laser pointers and you'll be fine. Once this thing works reliably, I'm planning on experimenting with shorter tube lengths. Having a 5" tube as a sensor isn't terribly flexible. With some tweaking, I'd like to get it under 1" and in the camera..er...laser head.
Now, this next part is important and I hope you have an ohm-meter handy.
Grab your ohm-meter and hook it up to the leads of the photocell. We're going to take readings on the resistance of the photoresistor in complete darkness and in laser lit conditions.
First, darkness. Rather than put your finger over the end of the sensor (your skin actually bleeds a crazy amount of light), tape it up and throw it in a drawer. Take your ohm-meter reading. It should be a very high number, so make sure your meter is set correctly. My photocell exceeded 2,000,000 Ohms in complete darkness, which topped out my meter, so I just called it 2MOhms. Write it down! Rdark = 2MOhms
Next, grab your laser camera and shine the laser into the open end of the sensor. Take your reading as the lowest resistance measured. Its going to be pretty darned low, so just get close. My reading was around 100Ohms. Write it down! Rlaser = 100Ohms
Why am I doing this? Good question, but I can't tell you yet, you're going to have to read the next step. I'll give you a hint, voltage divider.
Step 5: Building the Contact Closure
Remember the water closure circuit board? Well, I decided to use the door sensor pads to connect my sensor. So, here's what we're dealing with:
One of the pads is connected directly to ground. The other pad is connected to pin 19 on the PIC down on the skinny part of the board on the underside. That pin is a digital input/output pin. Now here's where I'm a bit confused, but I didn't let it stop me. Measuring the voltage on that pad, I get 0.85V. That's quite a bit lower than I expected. However, even with the lower than expected voltage, if I ground that pad, it activates the trigger. So, I just need to devise a circuit that will open and close this connection. A perfect task for a transistor.
I don't know much about transistors other than they are, at my most simple understanding, an electrically controlled on/off switch. You put enough voltage on the base and that causes electricity to flow between the collector and the emitter. That's all I know, and its projects like these that will help me learn more.
Now, we could just hook the photosensor up to the transistor, but we wouldn't get the effect we are going for, resistors limit current, not voltage. We want on and off states, black and white, not shades of gray and we want to control it with voltage. For photoresistors, a typical "on when dark" circuit uses what's called a voltage divider. It uses two resistors in series (one of them being the photoresistor) and the load of the circuit, a light in most cases, is connected to the point between the resistors. The voltage at that point is a fraction of the original voltage based on the proportion of R1/R2. Simple, right? I don't think so. I still can't get my head around why this even works, but it does.
Anyway, the base of the transistor is connected to the point in between the resistors. I learned this (and many other things) at Society of Robots website, specifically http://www.societyofrobots.com/schematics_photoresistor.shtml. Check it out. Good stuff. Not just for robot stuff, which is excellent, but for many things electrical, mechanical, and softwarical.
So, take a look at my schematic and try not to laugh. I'm learning, okay?
I have to power the sensor circuit from a power supply rather than just from the door sensor pad because there simply isn't enough voltage/current on that pad to trigger the transistor. I tried, oh, I tried and I couldn't get it to work. So, VCC and GND are connected to the battery terminals inside the water sensor module. SIG is connected to one of the door sensor pads. Make sure you connect it to the one that goes to the PIC, not the one that goes to GND.
To figure out what resistor you need for R2, grab the paper that you wrote Rdark and Rlaser on in the last step. Do this calculation:
R2 = sqrt(Rdark * Rlaser), then pick the closest resistor you have to that value.
The capacitor at C1 is optional. I added it to my board in case I wanted to adjust the reaction time of the trigger. This capacitor will cause the trigger to delay slightly. This is both good and bad. The good is that it protects you from false alarms when, lets say, the garbage man comes and creates vibrations in the air and ground that could misalign your laser for a split second. The capacitor will keep the sensor from tripping. The bad thing is that if you use too large a capacitor, your intruder could actually run right through your sensor without setting it off. I found that a 1uF capacitor worked pretty well. I could still pass through the sensor with a pencil without triggering it, but I doubt any intruder could even if they were aware of the laser (they'd just step over it. DOH!)
So, take a look at my circuit board, burned to a crisp and dripping with flux from all the iterations of...on the breadboard it works, on the circuit board it doesn't, back and forth, back and forth. Finally it works. Finally. Again, try not to laugh, but if you do, I understand. I'll laugh about it someday...when the psychological pain starts to fade.
Anywhoo, so it works. I've got it set up to protect my Girl Scout Cookies from my wife and daughters. Yeah, they're thin mints...like you even have to ask... ;-)
Update: For some reason the first circuit isn't working reliably. I am testing a second circuit that uses a 3V relay. A picture of the circuit has been uploaded, so check it out. I haven't built it yet, so stay tuned to see what happens.
More on how I have it set up in the next section.
Step 6: Setting It Up.
There are two ways you can connect this. Laser and sensor on the same side, or laser on one side and sensor on the other. Either way works. Let's talk about the pros and cons of each approach.
Laser and Sensor on the same side:
Pros: Laser camera and Laser Sensor can be powered from the same supply. Simply put both near an outlet and you're good to go. Power switch on the laser can power off the sensor too. Nice. This enables you to do advanced things like using a Power Module to only power up the laser sensor if one of the wireless cameras sees movement with its Infrared sensor. Being an intruder, how would you like to walk up to a house only to see a laser detection system arm itself as you approach. Too cool.
Cons: You need a mirror to bounce the laser back to the sensor. No big deal, but the mechanics of such a thing are a bit tricky. Also, the mirror can, and probably will, distort the laser beam. This is because most mirrors are rear reflective, meaning the laser has to pass through a layer of glass before being reflected. Also, as a more practical matter, the mirror could just get dirty. I'm using a mirror that I "borrowed" from my wife and it seems to be fine so far. I'll likely replace it with something less likely to get me in trouble.
Laser and Sensor on opposite sides:
Pros: No mirrors to worry about, less distance traveled for the laser.
Cons: Need a power supply on both sides. You could power the sensor module with the AAA batteries as designed, but I haven't tested/calculated the current draw of my modifications so it could potentially go through batteries like crazy.
In the Motorola Homesight software, the Water Module is discovered and works as expected. In this case, the module shows "Dry" when normal, and "Wet" when the laser has been interrupted. Sweet!