Previously I discussed my intentions to smart-ify my doorbell – I want to know if I’ve missed a delivery while I’m out, and this seemed like a good way to go about it.
I already opened up the doorbell receiver last time – now let’s take a look inside.
Hmm, the electronics are large enough that we should be able to play around with them – I was worried the PCB would be covered in tiny SMD components, but it seems like that’s not the case – excellent!
I’m interested in two things at this point – a way to power a small micro-controller / WiFi module (3.3-5V) and some sort of signal that I can read to check if the doorbell is currently ringing.
I want to give an ESP8266 module a try for this – I’ve played around with
Adafruit recently released their Feather HUZZAH boards which use the ESP8266 and add a voltage regulator (5V->3.3V), battery charging, USB comms and a bread-boardable layout – so I thought I’d give one of these a try.
To run the Feather HUZZAH, I’ll need 3.3-5V power with at least 150-200mA headroom, and I’ll need a 3.3V compatible logic signal to indicate if the doorbell is ringing.
Let’s take a closer look at the PCB:
Jackpot – it looks like there are connections for an expansion module on the left – VSS, VDD and LED – probably so the PCB can be used in a more full-featured doorbell receiver.
The LED output sounds particularly interesting – perhaps it’s to add on an LED that lights up when the doorbell is ringing?
VDD and VSS should be positive and ground –
I grabbed the doorbell transmitter, pressed the multimeter probes against VSS and LED, and rang the doorbell. The sound chimed, and a moment later I saw the multimeter register 12V – victory!
So there’s 12V power and a 12V signal to indicate that the doorbell is ringing – we can work with that. A simple voltage divider from a couple of resistors should get the signal down to where we need it, but for the power we’ll probably need a voltage regulator.
First things first – 12V signal to 3.3V IO. Simple resistor divider should do it, let’s figure out the values. SparkFun have a great tutorial on voltage dividers here, it’s well worth a read if you’re forgetful like I am.
R1 will go from our 12V signal to the IO pin, and R2 will go from the IO pin to ground. Vin is 12V, and Vout should be as close to 3.3V (but under) as possible.
We can re-arrange the above equation to solve for the numbers we want, but honestly it’s probably quicker to bring up a voltage divider calculator – here’s one here.
We have two unknowns – the two resistors – so let’s pick one so we can calculate the other. 100K for R1 sounds like a good starting point. Solving for R2, we get a value of 37.9K – that doesn’t sound like a very common value, but 33K is pretty common – recalculating at 33K gives us a voltage output of 2.9-3.0V, which sounds good enough. Let’s go with 100K and 33K, two common resistor values.
That’s signal sorted. For power, I had a spare Pololu buck-regulator on hand (D24V22F5) which will regulate down to 5V at up to 2.5A – plenty of headroom there, but to be honest I suspect we’ll run into problems with the power supply circuitry on the doorbell’s PCB before the regulator runs into any trouble.
I soldered in the regulator and R1:
I plugged the doorbell back in and quickly measured the output of the voltage regulator – a steady 5V, good so far but no load yet, so who can say.
I soldered R2 directly on to the Feather HUZZAH board, from the IO pin to ground. Next I soldered R1 into the IO pin, and the output from the voltage regulator into the 5V input on the board. At this point, I gave it a quick test to see if things worked – no LEDs on the Feather board, so it wasn’t looking good so far. I pressed the doorbell button to make sure I hadn’t broken it – no noise, not good.
Moving the doorbell button closer and closer to the receiver, eventually, the receiver was actuated and started ringing – but at
Looking at the power supply section of the PCB, there’s a large X-rated AC capacitor, two large 1W resistors, what looks like a bridge rectifier, and what might be a Zener diode – so we’re dealing with some basic transformerless power supply, with the Zener perhaps regulating the maximum DC voltage. There looks to be a 5V linear regulator to power elements of the receiver’s circuitry – but increasing the current draw there will cause the 12V rail to sag, just as when I drew from 12V directly (if not
This meant I wasn’t going to be able to get away with running anything as demanding as the ESP8266 off of the receiver’s power supply – curses.
This left two options – either add an AC-DC regulator that can supply the ESP8266 into the receiver, or power it from an external source. Because I didn’t have any small AC-DC regulators handy, I decided to go with the external option.
USB power supplies
The resistors were soldered in dead-bug style between the relevant points. I enclosed them in heat-shrink first, to minimise the chance of anything accidentally shorting out. Once I was able to figure out where everything would fit into place, I also put a length of heat-shrink around the Feather board to protect it too.
Before closing it up, I needed to upload the code to the board – but I hadn’t written the sketch to actually monitor the doorbell yet. Luckily, the clever folks working on the Arduino-implementation for the ESP8266 have got code working for over-the-air (OTA) sketch uploading – all I needed to do was upload this example (with my network SSID / password added in) and I was good to go.
I did a quick test to make sure I could upload OTA before packing the doorbell back up – this stuff works! OTA updating is something I’ve really been interested in seeing working for a long time, and I’m really impressed people were able to get it figured out. I spent a while trying to figure out an implementation when I was playing around with XBEE modules on regular AVR based Arduinos, and I couldn’t find a way to do what I wanted – it’s crazy how quickly this stuff has been solved, and how well it works!
After confirming that I’d still be able to update the Arduino remotely, I put the doorbell back together. I wrapped a lot of tape around the USB cable, both to provide a little strain-relief (not too important here) and to make sure it was definitely protected from the mains wiring / prongs that it runs past (pretty important). A rubber-band to hold the two halves of the receiver together, and I was ready to plug it in.
I’ll be honest, having to power it externally kind of ruined the clean / magical feel I was hoping for. It’s pretty clear this doorbell has seen some surgery.
Nevertheless, a quick press of the doorbell button – and it works! The doorbell rings as it always did, so I’ve not broken anything – success!
The next step was to figure out how I’d remotely monitor the status of the doorbell, and what I’d do with that information (with great power, etc…). For that, you’ll have to wait for next time!
Riveting, I know.
Leave a Reply