
This circuit interfaces an Arduino UNO with a DS1307 Real-Time Clock (RTC) module. The Arduino communicates with the RTC module using the I2C protocol, with connections from A4 to SDA and A5 to SCL.
The DS1302 Real-Time Clock (RTC) is a widely used electronic component that provides accurate timekeeping and date information in a binary-coded decimal (BCD) format. It includes a built-in clock/calendar and 31 bytes of static RAM. The DS1302 communicates with microcontrollers via a simple serial interface and is commonly used in embedded systems, clocks, data loggers, and other devices that require timekeeping functionality.

This circuit interfaces an Arduino UNO with a DS1307 Real-Time Clock (RTC) module. The Arduino communicates with the RTC module using the I2C protocol, with connections from A4 to SDA and A5 to SCL.

This circuit integrates an Arduino UNO with a DS1307 Real-Time Clock (RTC) module to keep track of the current date and time. The Arduino communicates with the RTC via I2C (SDA and SCL lines) and displays the time on the serial monitor, ensuring accurate timekeeping even during power outages.

This circuit features an Arduino UNO connected to a DS1307 Real Time Clock (RTC) module for timekeeping and a red LED with a series resistor for indication purposes. The Arduino communicates with the RTC via I2C (using A4 and A5 pins for SDA and SCL, respectively), and controls the LED connected to digital pin D8 through a 330-ohm resistor. The embedded code sets the RTC time, checks the current time, and turns the LED on or off based on the specified time condition (between 11:00 AM and 11:43 AM).

This circuit features an Arduino UNO microcontroller connected to a DS3231 Real Time Clock (RTC) module and a 12V single-channel relay. The Arduino provides power to both the RTC and the relay, and it communicates with the RTC via I2C using the SDA and SCL lines connected to A4 and A5 respectively. The relay is controlled by the Arduino through a digital output on pin D13, allowing the Arduino to switch external loads on and off based on time events managed by the RTC.
| Pin Number | Name | Description |
|---|---|---|
| 1 | X1 | Input for the 32.768 kHz crystal oscillator |
| 2 | X2 | Output for the 32.768 kHz crystal oscillator |
| 3 | GND | Ground pin |
| 4 | Vcc | Power supply pin (2.0V to 5.5V) |
| 5 | SCLK | Serial Clock Input |
| 6 | I/O | Serial Data Input/Output |
| 7 | CE | Chip Enable Input |
| 8 | Vbat | Backup Battery Input |
#include <DS1302.h>
// Initialize the DS1302
// CE pin -> Arduino Digital 2, I/O pin -> Arduino Digital 3, SCLK pin -> Arduino Digital 4
DS1302 rtc(2, 3, 4);
void setup() {
Serial.begin(9600);
rtc.halt(false); // Enable the clock
rtc.writeProtect(false); // Disable write protection
// Set the time to 12:00:00 (24hr format), date to 2023-04-01
rtc.setDOW(SATURDAY); // Set Day-of-Week to Saturday
rtc.setTime(12, 0, 0); // Set the time to 12:00:00 (24hr format)
rtc.setDate(1, 4, 2023); // Set the date to April 1, 2023
}
void loop() {
// Print the current date and time to the Serial Monitor
Serial.print(rtc.getDOWStr());
Serial.print(" ");
Serial.print(rtc.getDateStr());
Serial.print(" -- ");
Serial.println(rtc.getTimeStr());
// Wait one second before repeating
delay(1000);
}
Q: Can the DS1302 be used in a 12-hour format? A: Yes, the DS1302 can be configured to use a 12-hour format with an AM/PM indicator.
Q: How long will the backup battery last? A: The backup battery life depends on the battery capacity and the quality of the battery. Typically, a 3V coin cell battery can last several years.
Q: Is the DS1302 Y2K compliant? A: Yes, the DS1302 has leap year compensation and is valid up to the year 2100.