Hands-on DS1307 Clock Module With Arduino

by Lisleapex Blog in Circuits > Arduino

122 Views, 2 Favorites, 0 Comments

Hands-on DS1307 Clock Module With Arduino

Tiny RTC.png

DS1307 is an I2C bus interface real-time clock chip launched by the American company DALLAS. It can work independently of the CPU and is not affected by the CPU main crystal oscillator and its capacitance. It has accurate timing and the monthly cumulative error is generally less than 10 seconds.

Supplies

ds1307.png
  • DS1307 clock module
  • Tiny RTC I2C module
  • 24C32 memory clock (with battery)

DS1307 Features

DS1307..jpg
  • 56 bytes of non-volatile RAM
  • two-wire serial interface
  • Programmable square wave output
  • Automatic power-off detection and switching circuit
  • In battery backup mode, power consumption is less than 500nA
  • Industrial grade operating temperature: -40 to 80
  • 8-pin DIP and SOIC packages
  • It can count seconds, hours, minutes, days of the month, months, and days of the week, and has a leap year compensation function. The annual limit is 2100.

Module Features

Module Features.png

1. Using DS1307 I2C real-time clock chip (RTC)


2. Use 24C32 32K I2C EEPROM memory


3. Use LIR2032 rechargeable lithium battery with charging circuit


4. Solve the problem that DS1307 with backup battery cannot read or write.


5. After fully charged, it can provide DS1307 timing for 1 year.


6. Compact design, 27mm*28mm*8.4mm


7. Lead out the clock pin of DS1307 to provide clock signal for the microcontroller.


8. Can be cascaded with other I2C devices.

Module Wiring Diagram

Module Wiring DiagramModule Wiring Diagram.jpg

Code

 

#include <Wire.h>

#include <RTClib.h>

DS1307 RTC;

void setup () {

Serial.begin(57600);

Wire.begin();

RTC.begin();

RTC.adjust(DateTime(__DATE__, __TIME__));

}

void loop () {

DateTime now = RTC.now();

Serial.print(now.year(), DEC);

Serial.print('/');

Serial.print(now.month(), DEC);

Serial.print('/');

Serial.print(now.day(), DEC);

Serial.print(' ');

Serial.print(now.hour(), DEC);

Serial.print(':');

Serial.print(now.minute(), DEC);

Serial.print(':');

Serial.print(now.second(), DEC);

Serial.println();

delay(3000);

}

Finished

DS1307 finish.png