The RTC Real Time Clock Pi is based on the DS1307. The Raspberry Pi is connected via the I2C bus.The real time clock counts seconds, minutes, hours, day of the month, day of the week including the leap year up to 2100. The clock operates in 24 or 12 hour mode with AM/PM (morning/evening) indicator. If you want the module to continue to calculate the time after disconnecting the Raspberry Pi from the power supply, you must install a CR1225 3 V lithium battery.

Buy now

Properties

  • Works with Raspberry Pi 2/ 3 B/B+ Zero
  • Calculates seconds, minutes, hours, days of the week, month, year
  • Operates in 24 or 12-hour mode with AM/PM indicator (morning/evening)
  • 56-bit non-volatile (NV) RAM with battery backup for data storage
  • Dual-wire serial interface
  • Programmable rectangular waveform output signal
  • Automatic detection of power or switch circuit failure

Specification

FeatureValue
Operating voltage 5 V
Interface I2C
I2C address 0x68

Typical applications

Each application for Raspberry Pi requires real time

Exit scheme

Note

RX/TX was not used with this module, but the strip with 5x2 pins occupies the RX/TX pin with Raspberry Pi, so we exit the RX/TX and come out with a 2-pin plug.

Diagram

Bi-directional level changer

This is a typical bi-directional level switch converter for connecting two different voltage sections of the I2C bus. The I2C bus to Raspberry Pi uses 3.3V and the DS1307 chip works at 5V so the converter will be necessary. In the above diagram Q1 and Q2 is an N-channel MOSFET 2N7002A, which works as a two-way switch. To better understand this part, you can refer to AN10441.

How to get started

Required equipment

Raspberry PiPi RTC (DS1307)
Buy now Buy now

Note

Please connect to the USB port carefully, otherwise it may be destroyed. Please use USB cables with 4 wires inside, those with 2 wires do not transmit data. If you are not sure about your cable, you can buy it here.

Installation

The driver we provide only applies to Raspbian Jessie/Stretch.

Tip
If
you do not know how to use Raspberry Pi, go here beforeyou start.
    • Step 1: Installation of the driver

    Enter the following command into the terminal

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

    When the download is complete, enter the following command into the terminal

    cd pi-hats
    sudo ./install.sh -u rtc_ds1307
    

    • Step 2: Disconnect the power supply to Raspberry Pi

    sudo shutdown -h now
    

    • Step 3: Insert the cap into Raspberry Pi

    Make sure to connect pin 1 of the cap to pin 1 on the GPIO Raspberry Pi plug, exactly as shown above.

    • Step 4: Connect the power supply to the Raspberry Pi

    Applications

    Now you can enter the following command to check if the driver is installed correctly.

    ./install.sh -l
    

    If you want to uninstall the driver, use the command below:

    sudo ./install.sh -u
    

    Now let's see what the RTC real-time clock module can do:

    Read the hardware clock and print out the 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 applications

    hwclock --help

    Links

    Project

    This is a video of the product

    Botland.store - shop for makers!