Description
Pinout of DS1307 RTC Module
DS1307 RTC Module Pin Description
The DS1307 RTC (Real-Time Clock) module typically has 8 pins. The pin description is as follows:
- VCC: Power supply pin, usually connected to 5V or 3.3V
- GND: Ground pin
- SDA: I2C data pin, connected to the microcontroller’s SDA pin.
- SCL: I2C clock pin, connected to the microcontroller’s SCL pin.
- SQW: Square wave output pin, used to output a square wave signal with a frequency of 1Hz, 4kHz, 8kHz, or 32kHz.
RTC DS1307 Circuit Diagram Diagram
- The RTC DS1307 is 8 pin IC, shown in above fig.
- The RTC DS1307 uses external crystal of frequency 32.768 kHz, so we need to connect crystal with 32.768 kHz to X1 and X2 pin.
- Connect 3 Volt CMOS battery to Vbat pin. RTC DS1307 has inbuilt mechanism to detect 5 volt VCC, if external 5 volt VCC is not there, then it takes the supply from 3 volt CMOS battery.
- The SDA (Serial Data) and SCL (Serial Clock) pins are I2C serial communication pins which are used to connect with microcontroller’s I2C pins.
- SQW/OUT pin is square wave output driver. The SQW/OUT pin outputs one of four square-wave frequencies 1Hz, 4kHz, 8kHz, 32kHz by setting internal register bits.
Generally, while using RTC (Real Time Clock) first time, we need to set current time and date in RTC. Then RTC keeps updating these values in seconds. In RTC DS1307, we can set this time and date in the Timekeeper Register. After setting time and date value, RTC DS1307 keeps updating it in seconds so we will get updated time later.
Specification of DS1307
- Operating Voltage: 5V DC
- Operating Temperature: -55°C to +125°C
- Accuracy: ±2ppm at 25°C
- Clock Operating Frequency: 32.768KHz
- I2C Interface: Standard I2C interface, with 7-bit addressing
- SRAM Memory: 56 bytes of battery-backed SRAM
- Battery Backup: 3V Lithium Coin Cell CR2032 or equivalent (Battery Not included)
- Operating Current: 55uA (at 3V battery)
- RTC Operating Current: Max. 200uA
- I2C Communication Speed: 100KHz and 400KHz
- Real-Time Clock Counter: Hours, Minutes, Seconds, Day, Date, Month and Year
Board | I2C / TWI pins |
Uno, Ethernet | A4 (SDA), A5 (SCL) |
Mega2560 | 20 (SDA), 21 (SCL) |
Leonardo | 2 (SDA), 3 (SCL) |
Due | 20 (SDA), 21 (SCL), SDA1, SCL1 |
Example code is available here.
Documents
- Schematic
- Eagle Files
- Datasheet (DS1307)
- Wiring Example
- GitHub