ESP32 Alarm Clock with DS1302 RTC Module

ESP32 23-02-26
13 0

Tutorial plan

1- Objective of the project

2- Required Components

3- Circuit Connections of system

4- Micropython program of ESP32 Alarm Clock

 

Objective of the project

The objective of this project is to design and implement a digital alarm clock system using an ESP32 microcontroller, a DS1302 Real-Time Clock (RTC) module, an I2C LCD display, and a buzzer. The system is capable of displaying the current time in real time and activating an audible alarm at a predefined time, such as 07:00:00. This project demonstrates how to integrate timekeeping hardware with a microcontroller to create a practical and interactive embedded system.

Functioning of the System

The system operates by using the DS1302 RTC module to keep track of the current time continuously, even when the ESP32 is powered off, thanks to its backup battery. The ESP32 communicates with the RTC module to read the current hour, minute, and second.

The ESP32 then sends this time information to the LCD I2C display, which shows the current time in a clear format, such as: Hour: 07:00:00

The ESP32 constantly compares the current time from the RTC module with the preset alarm time (07:00:00). When the current time matches the alarm time, the ESP32 activates the buzzer to produce a sound and displays an alarm message on the LCD screen: Alarm 07:00 !!!

The buzzer turns on and off repeatedly to create an audible alert, while the message remains visible on the LCD to inform the user that the alarm has been triggered.

After the alarm duration is completed, the buzzer stops, and the system continues to operate normally, displaying the current time and waiting for the next alarm condition.

 

Required Components

1. BBC Micro:bit (Microcontroller)

The ESP32 is the main controller of the system. It reads the current time from the DS1302 RTC module, processes the alarm condition, updates the LCD display, and controls the buzzer.

2. DS1302 RTC Module

The DS1302 is a Real-Time Clock (RTC) module used to keep track of the current time and date. It can maintain accurate time even when the ESP32 is powered off because it uses a backup battery. It provides information such as year, month, day, hour, minute, and second. The ESP32 reads this data through digital communication pins.

3. Buzzer

The buzzer is an electronic sound device that produces sound when activated by the ESP32. It is used to alert the user when the alarm time is reached.

4. LCD Display with I2C Module

The LCD display is used to show the current time and alarm messages.

5. Breadboard 

Breadboard

A breadboard is used to build the circuit without soldering.

6. Jumper Wires

Jumper wires

Jumper wires are used to connect the ESP32 to the RTC module, the LCD display and the Buzzer. They allow electrical signals and power to flow between the components.

 

Circuit Connections of system

 

1- Connection of DS1302 RTC Module to ESP32

DS1302 RTC ESP32 board
CLK GPIO 19
DAT GPIO 18
RST GPIO 5
VCC 5V
GND GND

 

2- Connection of LCD I2C display to ESP32

LCD display ESP32 board
VCC 5V
GND GND
SDA GPIO 21
SCL GPIO 22

 

3- Connection of Buzzer to ESP32

Buzzer  ESP32 board
Pin (+) GPIO 23
Pin (-) GND

 

Micropython program of ESP32 Alarm Clock

This MicroPython program implements a digital alarm clock system using an ESP32 microcontroller, a DS1302 Real-Time Clock (RTC) module, an I2C LCD display, and a buzzer.

The purpose of the program is to display the current time continuously and activate an audible alarm when a predefined time is reached.

You need to install this libraries :

i2c_lcd et lcd_api for I2C LCD screen

ds1302 for DS1302 RTC module

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by Mohamed Ali Haj Salah - Teacher info