Inspired by Robert Faludi’s excellent book “Building Wireless Sensor Networks”
… and partly by an old posting by Roo Reynolds, I thought I’d have a go with wireless comms using some XBee modules.
At last, Mrs Techcobweb agrees that if I could get a bell ringing in the study when someone rings the front door bell, that would be useful, as we have left callers on the doorstep for ages on occasion, not knowing there was anyone there.
I have had lots of comments like “you could have just bought a new wireless doorbell”…etc. which would have cost a quarter of the cost, but would not any fun at all, or provide the slightest learning experience.
So… I found a doorbell I had spare, it was a cheap battery-driven by-wire bell.
The batteries supplied 6volts, but the unit runs on a 6-12v supply. I removed the batteries and fitted a power-plug, to which I could attach an old wall-wort I had in the cupboard (an old mobile phone charger I think).
I wanted to experiment with different components so I could try lots of firsts, as I’ve not used a transistor or a relay before. This is going to be slightly overkill, as the relay is probably not necessary. Regardless..
In keeping with the O’Reilly book, I wanted to use an XBee module (3.3v), the relay needed 5v to turn it on/off, and the bell could take the 9v raw from the power supply.
I used two voltage regulators in series, the first converts the 9v to a 5v supply, which feeds the second regulator, delivering the 3.3v needed for the XBee.
Adding a few capacitors (again, probably some overkill for what I’m doing, but it seemed to work on the breadboard), I could put a small power-conversion board into the battery compartment on one side of the bell case.
The other side houses the XBee adapter, which converts the XBee to a 0.1″ strip-board guage, soldered in with a few resistors, a transistor, and the relay. Add to that a small tactile press-to-make switch and I could simulate a “ring the bell” command arriving over Wireless. ie: The switch uses the 3.3v power supply to turn on the relay.
The idea is that normally, everything is off, except the 3.3v supply going to the XBee module. When the XBee module is told “turn on digital output pin 0” it turns the “base” of the transistor to High, which allows the 5v circuit to drive the relay which in turn switches the relay, turning the 9v circuit on. The 9v circuit controls the solenoid in the bell unit, moving the bar inside the coil, which strikes the chime-bar. “Ding” can be heard.
When the XBee is told “turn off digital output pin 0” it drops the “base” of the transistor to Low, which turns off the relay, and the strike-bar in the bell springs back to hit the other chime-bar. This causes the “Dong” to be heard.
Now to control it: I use an arduino with another XBee, mounted in a home-made XBee shield, with an Ethernet shield sandwiched between the two.
Again, overkill. I could have just USB-connected the arduino, but I’ve run out of USB ports on my server, and wanted to site the XBee controller further away than a regular USB lead reached, so it’s in a location with better wireless reception, more central to the house.
The code on this XBee/Lan bridging arduino uses the MQTT library, to connect to the message broker running on my revo over the Lan. It subscribes to a topic “home/study/bell”, so when something publishes to that topic, it rings the doorbell via XBee: Ding-dong.
I’m currently driving this from a very simple PHP web page, which uses the PHP MQTT library to publish to that topic.
This has allowed me the chance to get the actuator half of the project working and tested before I start sensing someone pressing the front door bell switch. That’s next… (update to follow shortly)