Dog lovers and those who keep dogs as pets know that every dog has its own personality and like us humans, they too, often succumb to temptations. Some canines just cannot resist chewing those delicious new sandals, while others must investigate the leftover food scraps on the dining table. And, as working people cannot monitor their pet’s behavior the whole day, Dave Young took up a project involving lasers and the single board computer, the Raspberry Pi or RBPi, to help their pet keep its nose out of food scraps.
Dave Young’s Laser Dog Watcher consists of a laser tripwire, which silently alerts the RBPi as soon as the dog trips the invisible beam. The RBPi then takes a snap of the situation and plays an audio clip to dissuade the dog from its intentions. The project borrows the laser tripwire from an earlier design of a silent doorbell that Dave had installed at his home.
The laser tripwire system is of a simple reflection type. Both the laser source and its detector are in the same enclosure on one side of the room. On the other side is a small mirror placed to reflect the laser light back to the photo-resistive detector. Anything interrupting the beam also trips the detector, which sends out a signal. As ambient light plays an important role when detecting interruptions of the laser beam, Dave added a threshold level adjustment. In addition, to make it easier for the laser to hit the detector, he added a Fresnel lens in front of it.
The tripwire system is wirelessly linked to the RBPi. For this, Dave used an XBee module, series 1 by Digi, who has a starter kit for users. The integrated AD converter on the module transmits the detected light level digitally, which serves two purposes. Setting the threshold level for detection becomes simpler and there is no noise involved as during an analog transmission.
The XBee interface transmits the digital value to the receiver as a PWM signal. The XBee receiver filters this PWM signal to produce a DC voltage level. You need a second AD converter to translate the DC voltage level to a digital value. Although this method of converting the signal twice is somewhat cumbersome, the XBee module makes it very easy to create the wireless link.
XBee provides their XCTU setup utility, which helps in setting up the XBee radio transmitter and receiver. The starter kit also includes an XBee USB Adapter board that connects to the RBPi, which may need FTDI VCP or Virtual Com Port drivers.
When there is a break in the laser beam, the XBee radio alerts the RBPi, which then triggers its GPIO to play an audio file as well as takes a photo with the Pi camera. The audio file changes so that the dog does not get accustomed to the same reprimand each time it tries to break the rules. According to Dave, the camera is not essential, but it serves to detect false alarms and to record the surprised look on the dog’s face.