How Does the Arduino Alarm Clock Work?

The DS3231 real time clock module keeps track of the time even when the module is not powered. It has a built-in 3V battery, which keeps updating the time. We will get the time and date from the RTC module using the library functions and then we will compare this time with the alarm time that we have set in the code.





If the current time matches with the alarm time, then the buzzer will start to beep. The beeping time in our code is 2 minutes, but you can increase it as much you want. The time and date will also be displayed on the LCD.

Circuit Diagram

Connect the LCD to the Arduino as follows:





Pin 1 on the LCD to ground on the Arduino.

Pin 2 on the LCD to 5V on the Arduino.

Pin 3 on the LCD to the middle pin on the 10K potentiometer.

Pin 4 on the LCD to digital pin 2 on the Arduino.

Pin 5 on the LCD to the ground of Arduino. This will put the LCD in read mode.

Pin 6 on the LCD to the pin 3 of Arduino.

Connect the data pins (D4-D7) to the pins 4, 5, 6, 7 on the Arduino.

Pin 15 to the 5V pin on the Arduino through the 220- ohm resistor . This is the positive pin of the backlight.

Pin 16 to ground on the Arduino. This is the negative pin of the backlight.

Then connect the DS3231 real time clock module to the Arduino as follows:

GND on the DS3231 to GND on the Arduino

VCC on the DS3231 to the 5V pin on the Arduino

SCL on the DS3231 to A5 on the Arduino

SDA on the DS3231 to A4 on the Arduino

Finally, connect the positive of the buzzer to pin 11 on the Arduino and the negative the of buzzer to GND on the Arduino.