DIY musical doorbell

A doorbell is not the most important equipment of a home, however it is necessary and it still matters in a way. It is the thing that makes the first impression of your home to any visitor. The standard school-bell type doorbells hurts the ears and freaks out everyone who dares to touch the button and anyone who is unfortunate to be home at the time. A musical doorbell can be really expensive and the sound of the cheaper ones are simply annoying. Why not try to build one at home?

Hardware

It can be easier than it seems at first glance. Almost every part of it can be found in the drawer of an average hardware hacker:

  • Any speaker scooped from an old PC
  • A cheap MCU
  • An NPN transistor
  • An 1K resistor
  • Optionally a potmeter for volume control
  • 4 diodes
  • 2 capacitors
  • An 5V linear regulator (L7805)

The theory of operation is really simple: the MCU drives the speaker with a square wave on an arbitrary frequency to make a sound. Because the MCU usually cannot bear high current enough to make it loud, a transistor is used to drive the speaker.

The power source may be a standard bell transformer, which makes 12V AC from the 230V AC. In my case it was given as in our apartment building there is one generator for more apartments. To provide a stable 5V for the MCU, a simple Graetz-bridge can be used along with a linear regulator.

Doorbell schematic (https://www.circuitlab.com/circuit/3x9m3u/doorbell/)
Doorbell schematic (https://www.circuitlab.com/circuit/3x9m3u/doorbell/)

Software

The software part is just as simple. The first problem is to make the proper frequency for the square wave output. The simplest approach for this is to use a timer integrated into the MCU, and toggle the output on the timer interrupt. Now the frequency can be set by the timer options.

The other task of the MCU to switch the settings of the mentioned timer after a time to make a series of sounds. I’ve used another timer to interrupt in every ~0.2sec, which decrements a counter to determine the delay for the sound. If the counter reaches zero, the new timer settings and delay counter are loaded from the program memory tables.

Calculation of timer settings

The music you want the bell to play, is a series of sounds with determined frequency. This must be converted to a series of timer settings. For the PIC16F1824 I’ve used, this settings includes the compare register value along with the pre- and postscaler settings. To determine the best settings for each sound frequency (best = real frequency closest to nominal within the available set of register values) is a straightforward task, but requires a lot of calculations. It is much easier to write a script that makes all the calculations and generates the proper code tables for the program. This way it is easy to change the music to whatever you want.

Finish the bell

All is left is a bit of soldering and putting it in a suitable box:

https://i1.wp.com/lh5.googleusercontent.com/-bCo7Z1mv3Jo/UBps6axVuLI/AAAAAAAAL00/Du4SNKyLdjg/s640/IMG_1373_cut.JPG?resize=512%2C450&ssl=1
The finished doorbell

References

2 thoughts on “DIY musical doorbell”

  1. Hello,
    I’m using a wireless doorbell, but the tune it plays is VERY annoying. I am a newbie at remote controlled objects, and well, at coding…. I do not really understand coding as of yet. Is there perhaps an easy way to change the music played by the bell? If not, is it possible for you to put up a step-by-step tutorial for doing so?

  2. Hi!

    It’s hard to tell without knowing exactly which type of device you have and what kind of microcontroller is used in it. Most mCs have some possibilities of protection against reprogramming or at least reading its program, which (if enabled by the manufacturer) makes it really hard to reverse engineer it – it is impossible without some special equipment.

    You can try to determine the type of the microcontroller: there is a slight chance it has it’s manufacturer and device code on the top of the IC. (Also, it can be a custom IC which is a show stopper, as you won’t get any documentation about it)

    If you succeed, you should get a programmer device for that specific microcontroller (these can be expensive depending on the mC, but hopefully you have a friend who can lend you one), and try to read out its current program, modify it and rewrite to the device. (you may need some soldering if the doorbell does not have a programmer connector)

    You may have more chance if you simply replace the mC with your own and you rewrite the program from scratch. In this case you need to analyze and reverse engineer the hardware (how is the sound generated, what kind of radio commincation is used, etc..).

    Reverse engineering is a good game and you can learn a lot from it, but it involves a lot of money and time. If you just need a doorbell which is less annoying, you should consider buying another one, or if you insist on the DIY way, build one from scratch.

Leave a Reply