Part

Real-time clock, DS1307

The older clock: the same BCD registers, 56 bytes of RAM, and a halt bit that keeps a new one stopped. Five volts only.

See every part
  • 5 pins
  • 2 settings
  • In 1 project
Drawn live by the editor's own code, at the size you see it.
At a glance

The Real-time clock, DS1307 in brief

What it is, and every setting the properties panel gives it.

The DS1307 is the real-time clock of the older starter kits, on the Tiny RTC module with a coin cell. Its pins are GND, VCC, SDA, SCL and SQW, and its I2C address is 0x68, fixed. Unlike the DS3231 it is a 5 V chip: VCC must be 4.5 to 5.5 V. On an Uno that is the 5 V pin with SDA on A4 and SCL on A5. On the 3.3 V of an ESP32 it switches to its cell and drops off the bus, so it keeps time and never answers, in Mokxi too. The time registers are the same BCD layout as the DS3231, but bit 7 of the seconds register is CH, clock halt: a new chip sits stopped at 2000-01-01 until a write clears it, which is what RTClib’s isrunning() reads. The halted property is that new chip, and start sets the time otherwise. Writing the seconds restarts the one-second divider, SQW gives 1 Hz, 4.096 or 8.192 kHz, and 56 bytes of battery-backed RAM sit at 0x08. There are no alarms and no thermometer. The 32 kHz output, crystal drift, the coin cell and the AT24C32 on many modules are not modeled.

Family
Clocks and links
Pins
5
start
2026-01-01 12:00:00
halted
false
Pins

5 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
What it does
GND
Ground.
VCC
Supply, 4.5 to 5.5 V.
SDA
I2C data. The module carries the pull-ups.
SCL
I2C clock.
SQW
Square wave or a plain output, open drain: it needs a pull-up.
How to use it

How to use the DS1307 real-time clock with an Arduino

SDA to A4, SCL to A5, VCC to 5 V and GND to GND. It has to be 5 V: the DS1307 needs 4.5 to 5.5 V, and below that it runs from its cell and stops answering on the bus. SQW can stay open.

With RTClib, create an RTC_DS1307, call begin(), then check isrunning(). A new DS1307 comes up halted at 2000-01-01 00:00:00 and stays there until something starts it, so the sketch calls adjust() with a DateTime when it finds the clock stopped. Tick the part’s halted property to see that path; leave it clear and the clock runs from its start time. rtc.now() then gives the date and time, already converted from BCD.

Part pin
Board pin
SDA
A4
SCL
A5
VCC
5 V
GND
GND

Not on 3.3 V: on an ESP32 or a Pico the DS1307 keeps time but never answers its address. For a 3.3 V board, the DS3231 is the clock that works.

Arduino Uno: real-time clocklive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
Start it if it is stopped, then read it
#include <Wire.h>
#include <RTClib.h>
RTC_DS1307 rtc;
void setup() {
  Serial.begin(9600);
  if (!rtc.begin()) while (true) {}
  if (!rtc.isrunning()) {
    rtc.adjust(DateTime(2026, 9, 23, 12, 0, 0));
  }
}
void loop() {
  DateTime now = rtc.now();
  Serial.print(now.hour());
  Serial.print(':');
  Serial.println(now.minute());
  delay(1000);
}
How it is modeled

What is true about the Real-time clock, DS1307, here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

It is a 5 V chip. Below 4.5 V it switches to its cell and cuts itself off the bus, so on a 3.3 V board (a Pico, an ESP32, a Blue Pill) it keeps time and never answers its address. That is the most common DS1307 question there is, and the part does exactly that.

Writing the seconds register restarts the chip's one-second divider, so a clock set by adjust() ticks a whole second later. The calendar is real: the right number of days in each month and February 29 in every leap year to 2099. SQW gives a 1 Hz, 4.096 kHz or 8.192 kHz square wave, or the level of the OUT bit.

Not modeled

The 32.768 kHz square wave, which would cost 65,536 edges a simulated second; with that rate selected the pin is let go. The crystal's drift: this clock is exact. The coin cell's voltage and life, and the RAM's undefined contents on a new chip, which read as zeros here. The module's other chip: many DS1307 boards also carry an AT24C32 EEPROM at 0x50, and this one does not.

From DS1307 real-time clock, in full.

Projects

See the Real-time clock, DS1307 in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

The boards it is shown on

This board has a built-in project with the Real-time clock, DS1307 in it.

Libraries

Arduino libraries for the Real-time clock, DS1307

Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.

Wire up the Real-time clock, DS1307

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.