My front door is an enclosed PVC 5 bolt super secure door with reinforced frame. To get a doorbell on this door I chose to employ a wireless solution, rather than drill through all of that. The bell button is pretty simple and it is stuck to the frame with a bit of sticky velcro.
Out of interest, I recently decided to rig up a system to record the number of times the door bell is rung during the day; when there is no-one at home. Especially useful, if the postman says he’s called but I really don’t think he has. It can also send me an email so that if I’m not far away I can pop back to see who is waiting for me. A bit of If This Then That communication to my phone.
RF Receiver Module
First thing I did, was buy an RF Receiver (and Transmitter). The receiver I got has XY-MK-5V written on the back of it. It is a RF receiver that can cope with 433Mhz. This is written on the inside of the bell button, so I knew the transmitter in the bell ought to be compatible.
Arduino & Raspberry Pi
Connecting the receiver to an Arduino or Raspberry Pi simply requires the data line to be connected to an input on either device and setting up some code which will read data from that line. The output from the receiver is a high frequency data stream that must be read quickly.
rc-switch
https://code.google.com/p/rc-switch/wiki/HowTo_Send
On Arduino and the Raspberry Pi there is a library available for detecting the incoming data stream. All reports suggested to me that it would ‘work-out-the-box’ but I spent a few fruitless hours trying to get it to work. In the end, I stepped back through all the code and compared the data that I was getting.
For the module I have, XY-MK-5V, the longest unchanging stream of data was 4800 microseconds. The code for rc-switch, expects the longest stream to be greater than 5000 microseconds; after which it will start parsing the stream of data to get a code.
So on both the Raspberry Pi and the Arduino; the code for rc-switch would never hit the point where it would start decoding. Thus it would never give me a response.
By altering the two instances of ‘5000’ inside RCSwitch::handleInterrupt() to read ‘4500’, I got the whole system to work.
I hope this helps other people that have had similar problems to me getting rc-switch, arduino and a 433Mhz receiver to work.
I still need to complete the rest of my doorbell project, but after hours of trying to detect the button being pressed, I’ll do that tomorrow!
Alternative using Analogue
http://arduinobasics.blogspot.co.uk/2014/06/433-mhz-rf-module-with-arduino-tutorial.html
Filed under: Diary | Comments Off on Detecting a wireless door bell on Arduino & Raspberry Pi