Some 2 year ago I came across the “Blender Defender“, a nifty DIY solution to train cats to stay off the counter. You should have a look at the original site, the video’s there are great!
We have cats, so you can imagine that we also have need for one… I started implementing my own version quite some time ago, but shortly after finishing it, it broke down somehow and I never came to diagnose the problem and fix it. Today I did: it turned out that rather than a fried RM module (what I was afraid for), it was simply a wire that came loose.
The design I followed for the Blender Defender is based on a Passive Infrared (PIR) sensor, linked to an Arduino that subsequently controls a KlikAanKlikUit RF switch.
In the end it is of course simply a movement sensor that can switch anything connected to the KAKU switch. But since we have a blender, I also added that to the photo.
The components I used are:
– Arduino Mini, about 20 Euro (see below)
– PIR sensor, about 1 Euro
– SparkFun 5V Step-Up Breakout – NCP1402, about 5 euro
– RFM12b module, about 4 Euro
– KlikAanKlikUit switch, about 10 euro
– 2 NiMH rechargeable batteries
– dual AA battery holder
– ABS project box
The reason for using the Arduino Mini is that I had it lying around 2 years ago and had no other use for it. Nowadays I would not use a Mini, but rather an Arduino Pro Mini. The Pro Mini is cheaper (especially if you get a clone of Ebay or DX.com) and easier to hook up to an FTDI cable. Also the choice of the RFM12B was based on me having it lying around and not having any other use for it. For my other RF projects I am using 868 MHz radio modules. A simpler (non SPI) 433 MHz radio transmitter module would also work, although the code (see below) would have to be modified.
Wiring it all up is quite easy. Besides 5V (VDD) and ground (GND), these connections need to be made between the radio module and the Arduino:
RFM12b Arduino 3 SDI 11 4 SCK 13 5 SS 10 6 SDO 12 7 IRQ 2
The output of the PIR sensor is connected to pin 9 of the Arduino, the button to pin 4, a green LED (placed under the button) to pin 3 and a red LED (also under the button) to pin 5.
The combination of the green and red LED allows to monitor the state of the sensor and to toggle between disarmed/armed:
– at startup the sensor is disarmed and the button is green
– click button -> blinking red for 5 seconds (about to be armed)
– after 5 seconds -> constant red (armed)
– upon movement -> yellow (both LEDs on) and the Blender switches on
– click button -> green (disarmed)
The sensitivity of the PIR sensor and the duration that it remains on can be adjusted with two small screws under the sensor.
The source code is available from my GitHub repository.