You can find many motion detection systems that come with an app and promise you spectacular performance for a low price. Most of those apps may seem fine at first glance but create all kinds of restrictions. What if I want to receive an SMS text when motion is detected and the app does not support it? What if I want to make my camera start recording when the infrared system detects motion? An app cannot do that!
So, instead of buying a pre-packaged infrared solution, I decided to make one myself.
I wanted at least 30 meters of coverage with a long-range infrared detector, so I can be alerted when a car or person is coming down the driveway. I had used the Bosch DS794Z passive infrared detector before and was very impressed with its reliability and range. It can detect motion up to 60 meters away and has very straightforward power requirements (12 volt DC) and detection interface (a normally open relay closes when motion is detected). So I decided to use the Bosch DS794Z again. I found a refurbished one on Amazon for $100.00, shipping included.
Then I also want short-range detection near doors and the back porch. For that I discovered the Tarts motion sensor. These are fairly cheap: around $35.00 per sensor, but you need one wireless gateway 'cape' (around $65) to communicate with the sensors.
And then of course I need a little computer to hook up to all these sensors and send an alarm over the internet. For that I use the BeagleBone
The whole thing should connect to my Wifi and run off a 110 volt outlet. I want to mount it near my greenhouse door, about 8 feet off the ground. There is an receptacle near that door that is powered by my off-grid battery system and using that is a lot easier than trying to use batteries and a panel and solar charger.
Power supply
Since
I need both 12 volt (for the Bosch) and 5 volt (for the BeagleBone and the
Wifi), I started with a 12 volt DC transformer that plugs into an outlet. I run
its wire into the plastic box that I use for enclosure, and inside use a
DC-DC boost buck converter that is adjustable to 1.24 V to 35 Volt. I set
it to produce 5 volt DC on the output and run a barrel connector to a little
USB hub, where I plug both the BeagleBone and the Wifi router.
The Tarts sensor
The Tarts gateway cape has C++ libraries for the
beaglebone. I spent days trying to make the code work with the latest
debian 9.5 image finally I gave up and put the
debian 8.6 image on the beaglebone with kernel 4.4. With that kernel, it
was fairly easy to adapt
the example c++ code from tarts
The Tarts cape has a large Wifi antenna for communicating with the sensors. I attached that antenna to the outside of my plastic box. The antenna connects to the cape with a micro FL connector. Because of the large antennas used by these tarts sensors, they can be up to 300 feet away from the receiver, which lets me put several of them all around the house and use a single receiver.
The Bosch DS794Z
The long-range passive IR detector closes a relay when it detects motion. To
read this with the beaglebone, I came up with this wiring diagram . The
ralay closing will create a voltage across a 220 ohm resistor connected to pin
40 on the P9 header.
Since the Tarts cape was inserted into the BeagleBone's P8 and P9 headers
and was effectively blocking all the pins, I had to solder wires onto the cape
to get to pins. I used a blob of epoxy to attach the wires to the cape so they
won't pull off easily.
I can read pin 40 with this
little python program
Wifi
I had a GL-AR150 travel router lying around. It runs openWRT and can be used as a wireless bridge. It is powered via USB so it needs a +5V DC connection. It has two ethernet port; I connect the "WAN" port to the beaglebone's ethernet port with a short Cat5 cable and switch the router to a wireless bridge.
I have an MQTT server collecting information and alerts from all the gadgets I
have been building. More about that in the next post!