Introduction: Wireless Arduino Doorbell Playing Your Favorite Tune

My 9 year old son plays piano, so I wanted to test his claim that he can encode any simple tune as a sequence of tones :)

This simple circuit consists of two parts:

1. Transmitter - when doorbell button is pressed, rectangular pulse is generated and transmitted through 415Mhz wireless link

2. Receiver - Arduino plays a pre-programmed melody, when signal is detected.

Step 1: Parts

Step 2: Transmitter

Entire circuit is powered with 9V battery only when doorbell button is pressed. NE555p timer circuit generates rectangular pulse with approximate frequency of: F = 1.44/((Ra+2Rb)*C1) = 960Hz

This signal drives a simple 433 MHz RF transmitter module. To improve signal range solder ~21cm wire to antenna connector of the transmitter. Electrolytic capacitor C2 between power and ground absorbs voltage spikes and can improve reliability.

Step 3: Receiver

Same as for transmitter – don’t forget 21cm antenna wire and electrolytic capacitor between VCC and GND.

When rectangular pulse is detected on pin D4 Arduino plays a pre-programmed melody on pin D10 – one tone at a time. This is essentially a basic MIDI player

I used basic soldering prototype PCB boards for both transmitter and receiver, but circuits are small enough to be assembled even on a piece of cardboard, if you prefer.

Debugging tip: use scope to confirm that Data pins of the receiver generates rectangular ~960Hz pulse when transmitter button is pressed.

Step 4: Arduino Code

There are 2 files attached, make sure to put them in the same directory:

1. pitches.h – it’s a tone frequency encoding for all the notes, for ex: #define NOTE_A1 55

2. WirelessBell.ino – actual program

The somewhat tricky part is related to the behavior of the receiver. When it senses a valid input signal, it reproduces it on its Data output pin which is connected to Arduino input digital pin D4.

In our case we should expect a rectangular pulse of ~960 Hz. However when transmitter is silent, receiver cranks up the gain in attempt to detect a weak signal and catches noise. This results in erratic digital output generated on Data pin.

Thus to recognize that transmitter is really ON (i.e doorbell button is pressed) we need to distinguish between regular pulse and erratic switching. For this purpose we record when 0->1 signal transitions were detected. If these occur at regular intervals, we conclude that a regular pulse signal from transmitter is coming. The probability of an erratic switching to have regular intervals is practically zero. This may not be the most elegant algorithm, but it works. Feel free to share other ideas.

When program concludes that doorbell button is pressed, it turns LED solid and plays a pre-programmed melody. My son has chosen a tune from a famous Russian cartoon :) You’re welcome to replace it with whatever you like.