Nowadays, security systems are one of the most researched fields. With the increase in security threats, companies are introducing new intelligent security products to counter these threats. The Internet of Things (IoT) is an additional advantage in this field; it can automatically trigger events in any emergency, such as alarms, fire brigades, or your neighbors. Today, we'll construct a smart Wi-Fi doorbell using an ESP32 and a camera.
Table of content
ESP32-CAM
FTDI programming board
220V AC to 5V DC converter
buzzer
button
Light emitting diode (2)
The circuit diagram of this smart Wi-Fi doorbell is as simple as connecting two LEDs, a button, and a buzzer to the ESP32 GPIO pins. The buzzer will sound whenever the button is pressed. One LED indicates power status and the other LED indicates network status. If the ESP is connected to the network, the network LED will be high, otherwise, it will flash.
This is what the Wi-Fi video doorbell setup looks like in a 3D-printed case:
IFTTT is a free web-based service that allows users to create chains of simple conditional statements called "recipes" triggered based on changes to other web services such as Gmail, Facebook, Instagram, and Pinterest. IFTTT stands for “If This Then That.”
In this project, IFTTT is used to send an email when the temperature or humidity exceeds predefined limits. We have previously used IFTTT in many IoT-based projects to send emails or SMS for specific events like excessive power usage, high pulse rate, intruder entry, etc.
First, log into IFTTT using your credentials or sign up if you don't have an account.
Now search for “Webhooks” and click on “Webhooks” in the Services section.
Now, click on Documents in the upper right corner of the Webhooks window to get the private key.
Copy this key. It is a part of the curriculum.
After obtaining the private key, we will create a small program using webhooks and email services. Click on your profile and then select Create to create an applet.
Now in the next window, click on the "This" icon.
Proceed to the search section, type in "Webhooks," and choose it.
Now select the "Receive Web Request" trigger and in the next window, enter the event name as button_pressed and click on Create Trigger.
Now to complete the applet, click "that" to create a reaction for the button_pressed event.
Here, the phone will play a pre-designated song when the IoT doorbell button is pressed. Search for "Android devices" in the search section.
Now on your Android device, select the "Play specific song" trigger.
Now enter the name of the song that you want to play when the doorbell button is pressed. In my case, I was playing a song called "123" from my Google Play Music. You can also use Spotify or other music apps.
After that, click on Create Action and then click on Finish to complete the process.
Now create another applet that sends a message with a web link to your phone when the doorbell button is pressed.
So, to create this applet, select "Webhooks" in the "this" section and "Android SMS" in the "that" section.
Now it will ask for the phone number and message body. For this Wi-Fi doorbell project, we are sending a message with a link to the web server so that you can see the live video stream directly.
Some of the code's most significant components are explained below.
First, include all the required library files for this code.
#include "esp_camera.h"
#include <WiFi.h>
Then enter the Wi-Fi credentials.
const char* ssid = "Wi-Fi Name";
const char* password = "Wi-Fi Password";
After that, enter the IFTTT hostname and private key that you copied from the IFTTT website.
const char *host = "maker.ifttt.com";
const char *privateKey = "Your Private Key";
Define all the pins that you are using in this project. I'm connecting the push button, LED, and buzzer using the GPIO 2, 14, and 15 pins.
const int buttonPin = 2;
const int led1 = 14;
const int buzzer = 15;
Inside the void setup loop, define the button pin as input and the LED and buzzer pins as output.
void setup() {
pinMode(buttonPin, INPUT);
pinMode(led1, OUTPUT);
pinMode(buzzer, OUTPUT);
It will attempt to establish a Wi-Fi connection with the provided credentials, and upon successful connection, the LED status will transition from low to high.
WiFi.begin(ssid, password);
int led = LOW;
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
digitalWrite(led1, led);
led = !led;
}
Serial.println("");
Serial.println("WiFi connected");
digitalWrite(led1, HIGH);
The ESP32 will restart when it is not connected to a network until it does so.
while (WiFi.status() == WL_DISCONNECTED) {
ESP.restart();
digitalWrite(led1, LOW);
Serial.print("Connection Lost");
When the ESP32 detects that a button has been pressed and is in the LOW state (pulled high), it transmits an event and activates the buzzer for three seconds.
int reading = digitalRead(buttonPin);
if (buttonState == LOW) {
send_event("button_pressed");
Serial.print("button pressed");
digitalWrite(buzzer, HIGH);
delay(3000);
digitalWrite(buzzer, LOW);
The RFB-0505S is a DC-DC converter from RECOM Power, Inc., belonging to the RFB Series. It features a Single In-Line Package (SIP7) and provides a single unregulated output. This converter offers 1 watt of power with an output voltage of 5V and is rated for an isolation voltage of 1kV.
Read More >In the world of electronics, ensuring efficient power management is crucial for the performance and reliability of devices. One of the key components in achieving this is the DC-DC converter. Today, we dive into the specifics of the RFMM-0505S DC-DC converter, exploring its features, applications, and benefits.
Read More >A DC-DC converter is an essential electronic device to convert a direct current (DC) source from one voltage level to another. These converters are widely employed in various applications, including portable electronic devices, automotive systems, and renewable energy installations.
Read More >The LM3900 consists of four independent dual-input internally compensated amplifiers. These amplifiers are specifically designed to operate on a single power supply voltage and provide a large output voltage swing. They utilize current mirrors to achieve in-phase input functionality. Applications include AC amplifiers, RC active filters, low-frequency triangle waves, square wave, and pulse waveform generation circuits, tachometers, and low-speed, high-voltage digital logic gates.
Read More >The goal of the Taiwan Semiconductor MMBT3906 PNP Bipolar Transistor is to provide a high surge current capability with minimal power loss. This transistor is perfect for automated installation and has high efficiency.
Read More >