Introduction: PIR Motion Activated Audio Switch
Second Prize in the
A friend of mine reached out on social media asking if anyone knew of a product that would play audio from a TV only when someone was watching it. She was wanting to put a looping video in a lobby, but didn't want the redundancy of the audio playing all day long. After searching for a while online for a suitable product, I couldn't find anything so I started brainstorming. After talking to her and getting more details I found out that it would be a dvd player hooked to a TV. I had never messed with any motion sensors before, but had seen some battery powered motion sensor lights and figured that'd be a good place to start. The idea that I had was to use the circuit from the light, but instead of turning on a light, it would trigger a relay which would act as a switch for the audio signal to go to the TV. Well, after many hours of research, trial and error, and a lot of solder fumes, I accomplished my goal. If you're interested in a detailed explanation keep reading. Otherwise, you can watch the video to get a rundown and see it in action.
Also, I'll be entering into the Home Automation and the Reuse contest - so if you like this be sure to come back and vote.
Step 1: The Donor Light
In the town I live in, there's virtually no source for electronic components. We have a very poorly stocked Radio Shack and a locally owned electronics store that carries some stuff that's usually overpriced and mostly deals in surveillance cameras. I wanted to get something started quickly so I didn't want to wait for a purpose built piece to be shipped to me. I started searching for motion lights on the websites for local big box stores and found this one at a local Menards. The description made it sound like exactly what I was looking for
The mounted motion sensor light is a versatile and convenient way to add light in an efficient and cost-effective manner. When the switch is turned on, the 3-LED light turns on when movement is detected and stays on for 30 seconds after movement ceases. The light can also be switched off to conserve energy. Hook and loop tape is included and can be attached to a variety of surfaces or simply placed on a flat surface. Place it in the garage, RV, tool box, cabinet or locker. It features: 3-LED lights, hook and loop tape and an on/off switch. It requires 3 AAA batteries (not included).
Well, was it ever wrong. First I unfolded and quickly scanned the single page instructions. First clue was the line stating that the light stayed on for 90 seconds after no movement was detected. But...didn't I read 30 seconds on the website? I powered it up and waved my hand in front of it and started counting. while I held still. 30...31...32......89...90...91....???....122...123...124... and then the light goes off! So what I originally thought was only going to be 'ON' for 30 seconds actually stays on for 4X that length. Hmmm...
I decided to just do some preliminary investigation to see if it would work despite the length of time it stayed on. I popped the case open and found two large circuit boards and one small one with a switch. One of the larger boards just had three copper paths with 2 LEDs. The other large board had a PIR and two capacitors on one side and a IC chip and a bunch of tiny surface mount components on the other. Upon closer inspection I figured out that the IC was a BISS0001.
I knew I didn't want the LEDs so I unsoldered them so I could use those solder pads for a relay.
Step 2: Experimentation
I picked up a couple of SPST relays from Radio Shack. Both were 12v relays, one a reed style and the other a typical automotive style relay. My original thought was that I could use a 12V wall wart to power this circuit. After discovering that the BISS0001 was rated for a 3V - 5V supply voltage, I dug out a 4.5V wall wart. I decided to at least try a proof of concept with the 12V relays to see if a lower voltage would be enough to trigger the relay. Neither of the relays would trigger with the 4.5V power supply, but the reed relay if tapped forcefully enough to trigger would hold the relay closed. I was going to need a different relay.
Something else that I discovered in this phase is that my original plan to use a SPST relay to just interrupt the common wire of the audio cable wouldn't work. The video cable shares the same common as the audio - hence the name 'common'. I'd have to interrupt the signal wire for both left and right audio cables. I was off to find a SPDT relay.
I mentioned earlier about a lack of electronic suppliers near me. Another trip to Radio Shack, and visiting several auto parts stores, I couldn't find a SPDT relay anywhere. I even struggled online. I love the selection of Mouser, Jameco, and the handful of other online suppliers, but it pains me to pay $7-8 shipping costs on a $2 part - so I kept my search limited to eBay items with free shipping. I eventually found a 3V DPDT relay online for ~$3 shipped.
Step 3: Scavenging Parts
Since I figured out that I wouldn't be able to utilize the common wire, I decided that for simplicity of use, instead of using a separate cable(s) for a direct video signal to the TV and an additional cable for the audio routed through this switch, I'd just route the video signal through this device as well. I could just cut one end off of two sets of cables, but then I remembered that I had an old analog TV that was getting ready to go in the trash...and it had A/V inputs on the back. l pulled the handful of screws out of the back case of the TV and found the board with the A/V inputs. I disconnected a few connectors and pulled the board out. A quick touch with the iron and a my solder sucker freed the RCA jacks from the board.
I'd also put a lot of thought to where I was going to mount this switch where the PIR would be positioned to sense movement without making the area look like a tangled web of cords hanging everywhere. After looking in the forgotten drawers and shelves of my basement, I found an old 900mhz cordless phone that had a wired handset. This was perfect for what I had in mind. A quick disassembly presented two RJ-9 jacks (one out of the handset and one out of the base) and a 3' coiled four wire cord. PERFECT! You'll see how I used those in a couple of steps.
Step 4: Enhancements
Enhancements? But we've barely started. Well, I'd been thinking a lot about the amount of time that the light stayed on. Two minutes just seems excessive. And then there's the motion detection range. A few not so quick tests revealed that this thing would pick up movement from over 20' away. I don't think the room this is going in is even 20' wide. That would mean that anytime someone walked in the room the switch would turn on. That defeats the whole purpose of this.
I started studying the datasheet for the BISS0001 (found here) and did some research online. The time 'ON' is determined by the resistor and capacitor values used going to pin 3 and 4 respectively. The formula on the datasheet is Tx ≈ 24576 x Resistance x Capacitance；Surface mount resistors are marked - usually with a 3 digit number which indicates resistance. Surface mount capacitors do NOT have any markings. Here's where some basic algebra comes in handy. I know that the resistor used was a 433. The first two digits are the resistance value. The third digit indicates how many zeros should follow - 43000 ohm (43k ohm). I also know the Tx value from counting how long the LEDs stayed on, so I just need to solve for capacitance. 120 seconds / (24576 x 43000) = 0.000000113 farad (0.113 microfarad).
Now that I've got a capacitance value, I can figure out what size resistor I need to use for the desired time. I decided to shoot for the originally anticipated 30 seconds. That formula is: 30 seconds / (24576 x .000000113) = 10802 ohm.
Moving on to the sensitivity. I found a discussion online (here) that talks about calculating the gain of the amplification from the PIR by dividing the resistance values. After referencing the datasheet and looking at my circuit, I determined that the only amplification I had was on pin 15. The original resistance values were 205 (2M ohm) and 203 (20k ohm) which equates to 2000000/20000 = 100X gain. I needed to reduce the gain to reduce the range of the PIR.
I then decided that since I had a whole box of random components, instead of swapping resistors out I'd just use a couple of potentiometers as variable resistors. I grabbed some tweezers and my (newly purchased for this project) third hand with magnifying glass and removed the tiny 433 resistor off of pin 3 and the 203 resistor off of pin 15. I was able to dig a 503 and a 504 potentiometer out of my spare parts box. The 503 would be used in place of the 433 resistor. This would give adjustability from 0 - 50k ohm - or roughly 4 seconds to 2 minutes. The 504 would be used in place of the 203 resistor. This would adjust the gain all the way down to 4X when the resistance was dialed to 500k ohm. I soldered the pots to some perf board and connected to the surface mount solder pads with some small gauge wire. This was a temporary step to test functionality.
Step 5: Going Remote...
I mentioned the phone jacks and cord earlier. I wanted to place a small unit on the front of the TV to do the sensing and the main workhorse hidden behind the TV. I unsoldered the PIR from the circuit board, being sure to mark which pins went where. After brainstorming and scrounging for a suitable housing for the sensor and phone jack, I discovered a plastic cap on an aerosol can in my garage. It had some plastic vertical ridges on the inside that seemed like they were specifically made to hold a RJ-9 jack snuggly between them. It was about the perfect size for a housing and definitely stayed on the theme of reusing. The only downside was that it had no back. I'd figure something out, so I pressed on.
I started by soldering the wires from the jack to the PIR. I clipped the remaining wire off. I actually went back and added some heat shrink tubing over these leads, but it turned out to be unnecessary. I then plugged the cord into the sensor jack and plugged the other end of the cord into the loose jack and checked to make sure that the wire colors kept continuity through the cord. All was good, so I soldered the appropriate wires to the board where the PIR had once been. I tested to make sure everything still worked before proceeding.
With the plastic cap in hand, I drilled a appropriate sized hole in the top. This plastic was very thin and I accidentally made the hole slightly oblong. I measured, marked and cut a hole through the side of the cap for the cord to fit through and hot glued the components in place...and then disaster struck. I had the bright idea of filling the cap with epoxy. This would provide a solid back to the hollow form. I had some acrylic casting resin. Unfortunately, as soon as I got it mixed up and poured in, I noticed that the resin started flowing out of the small nooks around the sensor and jack and actually filled the jack full of resin. I quickly poured the resin out and pryed the hot glue loose from the inside of the cap. I wiped everything off as well as I could and used my air compressor to blow any residual out of the jack. Maybe two part epoxy would have been thicker and done better? I wasn't going to find out. I decided to fill the entire thing with hot glue. I knew it was thick enough and I already had it on hand. The neat thing about having the hot glue for the back surface is that it'll be very easy to mount. Just heat the glue with a lighter and stick it in place. It'll hold well enough but won't be permanent.
Step 6: Time to Get Creative
I knew the pinout of my relay, the RCA jacks, and the pinout from the original LED board. I sketched out a circuit design on paper. I found the datasheets for the first two components and drew them to scale in AutoCAD (a really old version of Autocad 2000 LT from college). I came back later and added some circuitry to include the two potentiometers as well as changing the layout so everything fit into a project enclosure that I found in my tool box. It was time to make a printed circuit board - DIY style.
Step 7: Drilling, Cutting, and Etching
There's plenty of methods of making a circuit board. I think this is the easiest. I taped my design onto a copper clad board and used a dental pick to center "punch" each hole. I started out with a self-twisting pin vise, but decided that chucking a 1mm drill bit into a pin vise chucked into my power drill worked much faster. I have since purchased a keyless chuck for my dremel that will adjust down to 1/32". After all the holes were drilled, I cut the board out on the bandsaw.
Here's where the plethora of different techniques come in to play. I've done the toner transfer method before and it worked pretty well, but I don't have a laser printer. I DO have a permanent marker and can draw semi-straight lines. This is the hand drawn permanent marker etch resist method. Clean the board thoroughly, draw out your circuit and plop it in some ferric chloride. Keep it swirling. Once all the copper has been dissolved, rinse the board under water and use some rubbing alcohol to clean off the marker.
Step 8: Next Stop, Solderville...
This is probably the easiest step. Solder the components to the board. 'Nuff said.
Step 9: Prep the Box and Final Assembly
The easiest step followed by the most time consuming, detailed, precision work of the whole project - prepping the box. When redesigning the new circuit I was smart and foolish. The smart thing was to give myself a to scale drilling template for the A/V jacks. The foolish part was failing to realize that with the A/V jacks slid into said holes, there would be no way to slide the switch into its hole. Doh!!! You can see in the second picture that the switch is no longer soldered to the board. I removed it until I could get holes drilled for all the other inputs and access holes.
Since anyone and everyone will have access to the trim pots, I wanted a way to keep stray tools from snagging, shorting or causing damage if they tried to adjust the time or sensitivity. I found that a cap from a Bic pen fit nicely over the trim pots. I cut them to length and glued them into place during final assembly.
With all the necessary holes cut I soldered the A/V cable to the relay board and connected the trim pot wires to the appropriate pads on the sensor board and connected wires between the relay board and sensor board. Once ready for final fitting, I put the switch in the box, held it with forceps while I lowered the board into place and painstakingly lined up the four switch pins with the holes in the board and quickly soldered one pin to hold it in place while I finished soldering the other pins. What a pain. I used an existing hole in the sensor board to screw it to the box and held the RJ-9 jack in place with hot glue.
Step 10: Near Miss
I got everything assembled and connected. I tested it out in the garage and was overjoyed watching the LED come on and go off after the set time only to come on again when I moved. I put the lid on the box and headed inside for a final test. I hook everything up and....it DOESN'T WORK! I felt sick to my stomach.
Back to the garage and I get out my meter. Testing indicates that the relay isn't switching. I unsolder the relay coil leads and make sure they're not touching the copper pads. I use the battery pack from the original light to test the relay. Still doesn't work. Switch polarity and voila. It clicks. If you refer back to the notepad drawing of the circuit you'll see that I marked a (+) and (-) near the coil leads. When redesigning the circuit, I turned things completely around and forgot all about the polarity of the coil.
Luckily it was a simple fix. I used my Dremel with a small cutting bit and ground off the copper traces leading to the relay coil. I snipped some LED leads off and used them to jump the correct copper trace to the correct pins. All was right in the world again.
To seal things up and protect the copper traces, I used green nail enamel. I just got the cheapest stuff that was close to the same color as the sensor board solder mask.
Step 11: Final Touches and Comments.
I know this is going to be used on a flat panel TV. The mounting holes on the back are typically 8mm. I used the metal plate that came with the project enclosure and made a small bracket that can be used to hang this box. I snazzied up the bracket by 'engine turning' it by using a technique that I discovered several years ago on youtube, but had never tried it. For mine, I used a 1/4" poplar dowel chucked in the drill press and applied polishing compound to the end of the dowel. I did the pattern free hand and went a little crooked, but I think it turned out pretty good for what it is.
And this is what it looks like in its entirety. I didn't have any white labels large enough to cover the top so - duct tape to the rescue!!! The only thing I can't really explain is when I was testing the sensitivity in my garage so I could mark the label, I had to be within a foot of the PIR and moving a lot. Once I hooked it to the TV, around 6' is where it was detecting when sensitivity was at its lowest. Not sure why it wouldn't detect me at 6' or fewer feet in my garage though. I talked to my friend and she said that 6' should be fine.
One final comment about using this particular sensor circuit. There's a huge discrepancy between the web description vs. the included instructions vs. the actual functioning of the circuit. Not only as far as the number of LED's and the time it stays on, but the overall behavior of the circuit. The BISS0001 chip can be setup to be retriggerable or non-retriggerable. If it's retriggerable, it means that the circuit will stay on as long as motion is being detected. Once no more motion, the time ticks away and it turns off. Non-retriggerable means that motion triggers, the LEDs turn on and stay on for the Tx time period and then goes off - regardless if there is still motion present. It then waits for a Ti time period (as specified in the datasheet) in which motion detection is inhibited. Once that time expires, it can detect motion again. This particular circuit is setup for non-retriggerable mode. The Ti delay is less than a second, but it's still not ideal. I tried to modify the circuit to be retriggerable, but then it never turned off. It stayed triggered, so I reverted it back to non-retriggerable. If you have plans to do something similar, just keep that in mind.
This project has been a lot of fun and a huge learning experience. If you've read to the end, thank you. You can see it in action if you jump to the 12:45 mark in the video on the first page. I look forward to hearing your questions/comments and I'd appreciate your vote in any contests it's entered in.
We have a be nice policy.
Please be positive and constructive.