We have different types of doorbell projects such as Arduino doorbell with 3 LEDs, ESP32 Arduino which sends push notification on button press. We Need to Connect Our Electric or Battery Operated Doorbell With the Project to Make it Functional. Here is How to Interface/Connect Doorbell Switch with Arduino ESP32 Pushbutton. Commonly projects all over the internet ends describing from sending notification to adding camera. They do not describe attaching with traditional loud doorbells.
Determine the Type of Your Doorbell and Plan
There are mainly two types of doorbells – transformer based AC driven and two AA battery operated. Transformer based, AC driven doorbells are common in medium to large houses. We have such in our one old house. They have a metal bell and a hammer. The technology is vintage, taught in tenth grade physics yet it is very powerful to make loud sound – cring. More will be the duration of holding the doorbell switch more longer will be the duration of “cring” sound. It is funny to press for longer to disturb.
Dual AA battery operated electronic doorbells are common in apartments and small houses. They makes beautiful chimes but can not be programmed.
First type of doorbell (transformer based AC driven) are enough risky for the development boards. I can remember in our old house the wire to doorbell used to electrify the wall during the rainy season (the door/gate is after crossing a large open field guarded by walls). Those doorbell wires can carry up to 14V AC. You read it correct, it can be AC.
Second type of doorbell (two AA battery operated) are not risky for the development boards. Their maximum carried voltage is 3.3V DC. In reality with long cables it drops to 1.5V. Some of these doorbells’ wires for buttons operate with making the ground connected (they use a transistor) to complete the circuit and carry no voltage at all.
Your first work is to take out your multimeter (we have a basic guide on multimeter for dummies). Measure the voltage during off and button pressed.
How to Interface/Connect Doorbell Switch with Arduino
Your Arduino/ESP32 just need 1.5v to 3v pulse from pushbutton (HIGH). If your two AA battery operated doorbell already have closest voltage, you just need a resistor, a voltage regulator IC to make sure that more than 3V will never come towards your Arduino/ESP32. Also add diodes to both positive and negative wires of the doorbell to make sure the direction of current is only towards the Arduino/ESP32. Practically these kind of doorbells need little precaution as maximum voltage unlikely to be over 3V. Make the grounds (GND) of doorbell wire and Arduino/ESP32 common to complete the circuit.
Now about the transformer based doorbells. They are enough dangerous and really using a relay module is practical.
Both types of doorbells can use relay. In this use-case, the relay becoming input to Arduino/ESP32. Here you have to use the optocoupler circuit of relay (externally power the relay). All kind of doorbells are easy, doorbell press is like pushbutton press but :
(i) circuits needs isolation with relay
(ii) a diode required to prevent current going back towards the relay
(iii) minimum one resistor required at GND to make sure GND has zero voltage. Voltage can be minus
(iv) make the grounds (GND) of doorbell wire and Arduino/ESP32 common to complete the circuit.
There are three wires to connect to Arduino/ESP32, one from the relay common terminal to the external 5V supply, second is from the relay NO terminal (this is signal to I/O port of Arduino/GND), and third connected to that NO terminal with the 100K Ohm pull up resistor to Arduino’s GND. Diode added to prevent destruction of relay’s coil. The diagram is approximate (I have not checked ports of relay, direction of diode etc minor matters).
Finally, you’ll measure the voltage, current coming from relay towards ESP32/Arduino. The above system is basic way of interfacing. Detecting AC current presence/flow with digital logic is another way. To detect AC we can use a IC which can detect AC zero-crossing.