Logo avisador de timbre
Arduino,  Hardware

Homemade doorbell notifier

Ding-dong!

Every house has a doorbell. Maybe old, maybe basic… But we don’t always notice when someone rings it. Maybe we are in the exactly opposite side of the house, maybe we are listening to music a bit too high, maybe we are doing some noisy repairs, or because this, our marvelous auditive system was on vacation, and it didn’t pick up the sounds of your doorbell when the Amazon delivery guy rang it.

Adding push notifications to your phone could be the best solution here (and if you have a smartwatch too, even better, because it is even more difficult to not notice the notification). I have not searched a whole lot, but I am sure there are at least a couple of market models of smart doorbells out there, with their fancy melodies and useless apps for your phone, but why should I change my beloved unbranded totally generic classic doorbell? I don’t need an app specifically for the doorbell. I could use PushBullet, which I am already using for my washing machine and will use it for future projects too.

Why not design a homemade solution then? Let’s go 🙂

My basic doorbell receives an AC 230v line when the push button is pressed, not being powered while it is not in use, so the first thing we will need is to detect that 230v signal, as securely as we can, so a fault does not fry our small microcontroller. Talking about them, we will need one with WiFi connection, so why not the same ESP-01 we have used for the previous projects? It is cheap, small and easy to use.

For detecting those 230v we could use an already made board, like this one. The board uses an optocoupler, to put a physical barrier between the 230v and 3.3/5v of the microcontroller (optocouplers activate with light instead of electricity. Inside there is a small LED and a detector). In my case, what I did was replicate the board with discrete components, which are easily available and can be mounted relatively quickly. You can find the original schematic of that little board and more info in the creator’s website.

Our microcontroller works with 3.3v, so we need a proper power supply. As I don’t have any 3.3v AC adaptors, I used a 5v one and stepped it down to 3.3v using an LM317T power regulator.

The complete schematic is below. You can also find it at the bottom of the post, in EAGLE format.

Once more I mounted the components in a perfboard (someday I will start etching my own PCBs, I promise 😊), leaving an especially wide isolation between the power part, where the 230v are and the microcontroller and power regulator.

I started designing a 3D printed box for the project too. As a curiosity, the sum of the widths of the microcontroller board, the power supply and a small chamber for the cable connections was almost the same as the width of the doorbell. Lucky 🙂

The 3D design
The printed box, with all the components already mounted.

In the connection strip I connected the live wire from the old doorbell, a new direct live wire (the box needs power all the time) and the neutral.

For the software, the sketch defines pin 3, normally used as RX (part of the serial port) as an interrupt, to execute the subroutine onDoorbellStateChange(), which defines the state as true and updates a time variable in milliseconds, used to reset the status some seconds later.

.
.
.

attachInterrupt(digitalPinToInterrupt(sensePin), onDoorbellStateChange, FALLING);

.
.
.

void ICACHE_RAM_ATTR onDoorbellStateChange() {
  lastTrueState = millis();
  doorbellState = true;
}

void loop() {
  .
  .
  .

  //After some time, reset doorbell state
  if (doorbellState && (now - lastTrueState) > 5000) {
    doorbellState = false;
    isStateSent = false;
  }

  .
  .
  .
}

You can find the entire sketch at the end of the post.

My MQTT server is located within my OpenHAB server, so it is necessary to define a Thing and an Item, and, to send the notification, the plugin we like most. In my case it is PushBullet, but there are at least a couple more. We also need a new automation rule, that gets triggered when the state goes from OFF to ON:

rule "<NombreRegla>"
when
    Item <NombreItem> changed from OFF to ON
then
    val actions = getActions("pushbullet", "<NombreItemPushbulletBot>")
    if (actions !== null)
    {
        actions.sendPushbulletNote("Timbre puerta principal", "Timbre puerta principal", "Alguien llama a la puerta principal")
    }
end
And working! A bit too Spanish, I know 😜

Only the installation is left. I had to pass a new live wire up to the doorbell, but it was easy, because the conduit had space left and the connection box was nearby.

Once mounted on the wall
And closed!

You can find everything you need to replicate the project on my GitHub and down below. See you in the next post!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Esta web utiliza cookies propias y de terceros para su correcto funcionamiento y para fines analíticos. Al hacer clic en el botón Aceptar, acepta el uso de estas tecnologías y el procesamiento de tus datos para estos propósitos. Ver
Privacidad