Hardware parts required for building:
-DS3231 RTC board
-20X4 LCD display
-I2C Arduino LCD Display Module
-RC5 protocol IR remote control
-220 Ohm resistor
The basic code is taken from simple-circuit web page And I made a few changes : For simplicity, I added an I2C module to the LCD display and modified the code accordingly. I also added a small buzzer that generates sound with a given frequency while the alarm is active.
The DS3231 board is supplied with 5V as the 20x4 LCD and the IR receiver, this 5V comes from the Arduino board, there are 3 data lined connected between this board and the Arduino, SCL line is connected to analog pin 5, SDA is connected to analog pin 4 and INT line is connected to digital pin 2 which is the external interrupt pin of the Arduino (INT0). The DS3231 interrupts the microcontroller when there is an alarm (alarm1 or alarm2).
The IR receiver has 3 pins: GND, VCC and OUT where the OUT pin is connected to Arduino pin 3 which is external interrupt pin (INT1).
The LED which is connected to Arduino pin 10 is used as an alarm indicator (alarm1 or alarm2), so if there is an alarm the DS3231 pulls down the INT pin which interrupts the microcontroller (ATmega328P) and the microcontroller turns the LED ON, here a button on the remote control turns both the LED and the occurred alarm OFF.
We need to decode our remote control in order to know the code of each button because we’ve to add it in the Arduino software (code).
The remote control used in this project is a TV IR remote control with RC5 protocol, it’s the one shown below (used buttons are numbered):
Button Function Code (hex format)
1 Increment 0x20
2 Set time and calendar 0x10
3 Decrement 0x21
4 Set alarms 0x11
5 Reset alarms 0x0C
Note that this code must use the remote control with the RC5 protocol, and most often such remote devices are used by older Philips devices. Below is a simple code "IR protocol finder" that allows you to easily determine the protocol of any remote control, as well as the value of each button.
The picture shows the remote control I used with the marked values and functions of the buttons.