The EMF TilDA Badge Doorbell

12-09-2013

This doorbell is one of these projects that has been hanging around for ages, waiting to be finalised. It's the old cliche right? The girlfriend mentions a DIY style problem and you decide to step in. Over a year later, the job is actually done.

We had a problem with several wireless doorbells; they interfered with many others around the area, including some electronic car alarms. At one point our doorbell decided to play sounds that were not even programmed into it in the first place, at least as far as we could tell. In the end, we decided we should just make our own.

I started out using the radio breakout boards from Sparkfun. The noise on these boards was terrible however and I decided that another approach was needed. I spent a bit of time trying to filter the signals but it seemed more effort than it was worth.

My friend, Charles over at Electric Laboratory came up with the idea that I should use the EMF Tilda Badge instead, as they use the nRF24L01 chip. As the plus version of this chip had just been released, the non-plus versions were quite cheap; Charles had a load he wasn't using. I figured this would be a good use for the badge that had laid dormant in the months since EMF.



After working with two EMF badges, I'd managed to get the interface working. There is a pretty good radio library for the Arduino called the Mirf library, which you can find at the arduino playground. This pretty much takes care of the arduino end of things on the badge, however the Tilda is not without it's problems. Make sure that you hit reset just after you hit 'upload' in the arduino software, otherwise it wont write the program to the chip.

With communication working between two badges, the next step is to make some kind of switch to go outside the flat. This needs to run for a long time, drawing very little power. I needed some kind of embedded device. I like to use AVR chips generally as they are quite simple to program with a buspirate under Linux or OSX. I looked around and found out that the ATTiny85 would do the job with a few tweaks. I found the old casing for our previous doorbell and decided the thing to do would be to mount the new chip inside it so people would know intuitively that it was a doorbell.

Doorbell Button

Programming the ATTiny85 was a bit of a challenge. Thankfully there are two really good sites here and also here. Both have really good tutorials on how to use the nRF24l01 with various chips. I ended up using the code from the second page, modified to send just one packet as fast as possible. The problem I had initially was very odd. One press of the button for a second would work, but then one would have to hold the button down for another 3 seconds for the doorbell to work a second time. The next attempt would only require a second, and so on, the pattern repeated. In the end, I stripped out as many delay functions as I could and the button now seems to work if you hold it down for about half a second. A quick tap wont cut it but a good press seems fine.



The excitement when the device finally sparked into life might have seemed excessive to onlookers but it felt so good to finally have something working that required only small amounts of power and could talk to something over distance with some intelligence. The final problem remained however. It needed to make a noise. I have almost no idea about audio electronics. My first thought was to use some powered speakers with the raspberrypi we had lying around but the girlfriend was not so impressed with the extra complications this was presenting. Another solution was needed.

Turns out the arduino can play square wave tones through a speaker just fine. The only problem is that the current through the digital pins is only around 30mA. Not really very much at all. I figured we needed an amplifier, but again, I've never used an op-amp in my life and can just about figure out an amplifier circuit. However, these folks over at the Arduino Playground mentioned that square wave amplification can be performed with a transitor or two and nothing else.

Transistor Amplifier

Essentially, using one NPN and one PNP transistor, one can amplify the square wave. Wiring into the Tilda's 5V thru-hole at the bottom of the board allows for a larger current draw. Wiring this onto some strip board, mounting the board over the digital pins, finally putting the whole thing into a laser cut case completed the build. At present (as of this morning) the doorbell appears to work. On occasion, depending on where the button is mounted, the signal appears not to reach the badge. I've moved things around a bit and it seems to work great. One benefit is the whole system can run off USB without need for a mains transformer. Added bonus!