跳到主要内容

DS1307 RTC (Real Time Clock) for Raspberry Pi

The Pi RTC is based on the clock chip DS1307, it can provide a real-time clock(RTC) for raspberry pi via the I2C interface. Real-time clock of this module counts seconds,minutes, hours, date of the month,month, day of the week, and year with leap-year compensation valid up to 2100. The clock operates in either the 24-hour or 12-hour format with AM/PM indicator. If you want to keep this module timing when the Raspberry Pi is powered off, you need to put a 3-Volt CR1225 lithium cell in the battery-holder.

备注
    The battery is not included.

Features

  • Support Raspberry Pi 2/ 3 B/B+/4/Zero
  • Suport seconds,minuutes,hours,day of week,month, year
  • Support 24-hour or 12-hour format with AM/PM indicator
  • 56-byte, battery-backed, nonvolatile (NV) RAM for data storage
  • Two-wire serial interface
  • Programmable squarewave output signal
  • Automatic power-fail detect and switch circuitry

Specification

ItemValue
Operating Voltage5V
InterfaceI2C
I2C Address0x68

Typical applications

Any applications need Real Time on Raspberry.

Pin Out

备注

RX/TX is not used in this module, but the 5x2 header takes up the RX/TX pin of the Raspberry Pi, so we bring the RX/TX out and come with a 2pin header.

Schemaitc

Bi-directional level shifter circuit

This is a typical Bi-directional level shifter circuit to connect two different voltage section of an I^2^C bus. The I2C bus of Raspberry Pi uses 3.3V, however the chip DS1307 works at 5V, so this circuit will be needed. In the schematic above, Q1 and Q2 are N-Channel MOSFET 2N7002A, which act as a bidirectional switch. In order to better understand this part, you can refer to the AN10441

Platforms Supported

ArduinoRaspberry Pi

Getting Started

Materials required

Raspberry PiPi RTC(DS1307)
Get One NowGet One Now
备注

Please plug the USB cable gently, otherwise you may damage the port. Please use the USB cable with 4 wires inside, the 2 wires cable can't transfer data. If you are not sure about the wire you have, you can click here to buy

Install

The driver we provide only applied for Raspbian Jessie/Stretch.

提示

If you do not know how to use a raspberry pi, please check here before start.

  • Step 1. Driver Installation

Tap the following command in your terminal

git clone https://github.com/Seeed-Studio/pi-hats.git

When the download finish, tap the following command in your terminal

cd pi-hats
sudo ./install.sh -u rtc_ds1307
  • Step 2. Power off Raspberry Pi
sudo shutdown -h now
  • Step 3. Insert the HAT to Raspberry Pi

Please make sure plug the pin 1 of this hat into the pin 1 of raspberry GPIO, just like the picture above.

  • Step 4. Power up Raspberry Pi

Usage

Now you can use the command to check whether the driver is installed successfully.

./install.sh -l

If you want uninstall the driver you can use the command below:

sudo ./install.sh -u

Now let's see what the RTC module can do:


Read hardware clock and print result

sudo hwclock -r

Set the system time from the hardware clock

sudo hwclock -s

Set the hardware clock from the current system time

sudo hwclock -w

More usage

hwclock --help

Schematic Online Viewer

Resources

Project

This is the introduction Video of this product

Tech Support

Please do not hesitate to submit the issue into our forum


Loading Comments...