BobLight

The BobLight ( named after my Father in-law ) was conceived of as a Christmas Present for my in-laws that have a cottage in Northern Ontario.† The cottage has generator power, but at night the generator is off.†† Getting to the bathroom in the middle of the night (when you forget your flashlight Ö read, me) can be a challenge, so, I thought that a battery powered Ďpath of lightí from the bedrooms to the bathroom would be useful to them, but, really useful to Ďforgot my flashlightí me.

 

I wanted several lights in different locations to all come on simultaneously when motion was detected, so, in addition to motion detection, they would need a way to signal one another.† Also, I didnít want them to come on in the daytime, to conserve battery power, so, a light sensor was also necessary.

 

I had a bunch of extra X10 MS14A motion sensors hanging around, and they are perfect for this as they contain a motion sensor, light sensor, and 310MHz RF transmitter.† They are cheap on e-Bay, about $5 each.† Most importantly, they are based on the PIC 12C508 microcontroller in a DIP package, which means they can easily be replaced with another 8 pin DIP PIC ( I chose the 12F509 because I had a bunch of them hanging around too ).†† The only thing missing was a 310MHz RF receiver.†† I had used the inexpensive ( ~$4 ) Radiotronix RPR series receivers before, and the 315MHz version can easily be re-tuned down to 310MHz by adjusting the tuning slug.† ( there are other manufacturers similar 315Mhz modules, such as this one from SparkFun ) The only thing left was the LED light itself.† I found a suitable one at Home Depot for $7.† This keeps me within our $30 Christmas gift spending limit.†† Iím going to build 3 of them, one each for my Father in-law, Mother In-law, and Brother in-law.

 

The complete assembler project in MPLAB IDE format for the PIC 12F509, can be downloaded HERE.† The source contains notes on the theory of operation of the code, so Iím not going into that detail here.

 

 

Here are the main components needed.†† A suitable battery powered LED lamp Ö I chose this one because it was cheap, and was powered by 4 AA batteries, so, I could have plenty of voltage to drive the leds, and, I could tap 4.5V to run the MS14A and RF receiver ( although the MS14A runs on 2 AAA batterys, at 3v, it operates fine at 4.5v ).† The MS14A, and the Radiotronix RCR-315-MPR RF receiver module.† I sourced the Radiotronix module at dcomponents.com.

First, a big thanks to NASA Engineer Dr. Ed. Cheung ( www.edcheung.com ) for doing the leg work of tracing the MS14A circuit.† He has an excellent description of operation of the circuit on his site as well.

 

I needed the motion sensor input and light sensor input already in the circuit, plus, I needed an input for the Radio receiver data, as well as an output to drive power to the radio receiver ( so I could de-activate it during the day to save power ), and an output to control the LED light drive transistor ( on the Aux board ).† Since GP3 can only be an input, I chose it for the Radio Data in.† GP1 was connected to a programming switch, which I didnít need, so I used it for the Radio power output ( the PIC can source up to 25mA, and the receiver only draws 2.5mA so Iím well within spec ).† Finally, GP4 was being used to de-activate the motion sensor.† I could keep the motion sensor active, and just ignore pulses I didnít need in firmware, so I used GP4 for the LED out.

 

I had to cut the trace from GP4 to the comparator divider, and then jumper R15 directly to ground.

 

I removed R16, since I didnít want a pull-up as this is now an output ( also provided a good attach point for the LED OUT wire.

 

I also removed LED1 ( the red led ) as I didnít need it.

Pictured above left is the MS14A board sitting in the housing.† It can just be popped out.† Keep the housing, as youíll need the Fresnel lens later.† Below left is a top view of the board after my mods and attaching the IO wires.† After de-soldering the PIC, I replaced it with a socket so I could easily try new firmware versions.†† The photo on the right is the underside of the board after the mods, showing where I cut the trace from GP4 to the comparator, and bridged the comparator reference divider to ground.† Also, it shows the attach points for the Radio Power Out, Radio Data In, and LED power out.

Hereís a schematic of the small Auxiliary board to hold the RF Receiver module and the drive transistor for the LEDS.† VCC to the Receiver module is decoupled at both pins with .1uF poly caps, with the addition of a 2.2uF electrolytic.† Technically I should have put a small (10 ohm or so ) resistor in line to limit the inrush current, as the PIC is driving it directly, but, I didnít.† The proper way to do this would be to add another transistor to switch the power to the radio module.†† I added a 1Mohm resistor from the module analogue out to ground.† Without this, the receiverís data out will continuously be switching.† While the firmware will handle this, it keeps the microcontroller busy, and could potentially lead to a false detect.† Adding the resistor raises the data slicer threshold slightly ( moving it above the general RF background noise) , and quiets the output at the cost of slightly less range.†† I used a 22.6cm wire antenna to the antenna pin.†† Finally, the 2N2222 NPN transistor is used in an open collector configuration to switch the LEDS 6V power.†† At 6V, and with these particular LEDS,† the 10ohm limit resistor will allow a about 120mA through the 4 parallel wired LEDS.† The inset photo shows my initial prototype on protoboard.

I used a small piece of veroboard as the Aux board.† I trimmed it with a dremel cut-off wheel so that I had 1 horizontal strip as a ground bus, and multiple vertical 3 perf strips for the components.† I used the component leads for the internal wiring as much as possible.† Left below is the completed board, and right is the board interconnected to the modified MS14A.† At this point Iíve removed the battery clips from the MS14A and added power wires.† The radio module is powered from the MS14A, and all that needs to be added is the wire from the collector of the transistor to the cathode side of the LED sub-boards.† I tuned the module to 310MHz by using an X10 keypad transmitter, and adjusting the tuning slug on the receiver module while observing the analogue out pin of the module on my scope.

Above are pics of the original Light, before removing it from the package.† It comes apart with 4 screws on the bottom so you can remove the bezel and light dome ( which arenít attached, as you Ďpushí the dome to turn on the lightó more on that later).†† After that I removed the tiny switch / timer board and discarded it .. This is where Iím going to attach my Aux board.† The little LED sub-boards just pop off.† The two boards each have 2 white LEDS wired in parallel.† I lengthened the wires between the two boards to accommodate the extra room needed by the MS14A board.† Notice that the tabs for the battery clips are exposed.† This gives you access to GND, +1.5, +3, +4.5, and +6V.† Originally I ran the MS14A / Radio at 3V.† The radio was a little cranky, as itís rated for 4.5V minimum according to the datasheet, so, I tried running the MS14A ( originally designed for 3V ), at 4.5v and it worked fine ( the PIC is rated for 2ó5V ).† The only thing I noticed at the higher voltage was some leakage current in the RED led that used to do double duty with the photo sensor, so,I just snipped it off, as I didnít need it.

Ok, in the final stretch!†† On the left is the final test before the hot-glue.†† On the right is with all the boards hot-glued in place.† It also shows where I tapped the battery compartment for ground, +4.5v for the MS14A / Radio, and +6V routed to the LED boards anode input rail.† The antenna is wrapped around the circumference

Hereís the final assembly of the first one ( I completed the other 2 shortly after ).†† Originally, I had hoped that the pyroelectric motion sensor on the MS14A could Ďseeí through the light dome ( abeit with less sensitivity / range )without the aid of the Fresnel lens that is used on the MS14A case Ö alas not.† The dome renders it totally blind.† So, I used my trusty dremel tool to cut out an aperture slightly smaller than the Fresnel lens that came with the MS14A.† To remove the Fresnel from the MS14A case, just bend the case, and you can pull it out, itís not glued.†† I then affixed it over the aperture with Crazy Glue, to give it that true MacGyver look.† ( My Mother-in-law will hate this ).†† Oh well.† Itís art.

 

The final step was to hot glue the dome to the bezel, and then re-assemble with the original 4 screws.

 

After a bit of real-world beta testing and firmware tweaks ( I discovered why they had a dedicated hardware pin to silence the motion detector for 10 seconds after detection ) theyíre working like a charm!† The pics below show them in their test environment on my stairwell .. I actually have them farther apart than this. ( Mother and Father in-laws Wedding photo included here )

 

You walk by when itís daylight, nothing happens ( but you can see the internal green LED flash to indicate itís seen you ).† If itís dark, all 3 will turn on whenever any of them see you.† They will then stay on for 20 seconds ( firmware selectable ) unless any of them see motion, in which case the 20 second countdown timer is reset and they stay on.†† If they donít see motion for more than 24 hours, they go into deep sleep until they see motion again.† Otherwise they are active at night ( turning the radio receiver on ) and inactive in the day.† Much like I was in my teenage years.

 

 

A path of light when you need it the most!

Imagined and realized by jrwhite

Free Web Hit Counter By CSS HTML Tutorial