You are currently viewing Basic methods to update rtc in raspberry pi
Basic methods to update RTC

Basic methods to update rtc in raspberry pi

Spread the love

Hello everyone in this article we will see different methods to update rtc using ntp server for raspberry so let’s see:

We know that Raspberry Pi does not include any hardware clock on board so It uses internet or net access to set the time with the help of NTP servers. Using the hardware real time clock (RTC) , the Raspberry Pi to be used without internet access and still provide real time services.

Basic methods to update RTC
Basic methods to update RTC

Commonly available I2C based RTC IC is DS1307. This IC help you to update Real time in device.

Hardware Setup for RTC in python:

  1. Use DS1307 IC
  2. I2C data and clock lines (SDA and SCL) does not use any pull-up resistors.
  3. Connect a battery backup to the DS1307.
  4. Check the connections to the Raspberry Pi.

Software Setup for RTC in python:

Enable i2c on the Raspberry Pi.

Enable i2c module on the Raspberry Pi

Run sudo cd /etc/modprobe.d/raspi-blacklist.conf
Locate the line blacklist i2c-bcm2708 (comment out this module command)

We need to import following modules

Run sudo cd /etc/modules
use this command
i2c-bcm2708
i2c-dev
rtc-ds1307

Next Install i2c-tools

go to python cell and Run

apt-get install i2c-tools

Reboot (It’s only start i2c module )

How to Update RTC Module

How to Initialize the hardware clock

Run i2cdetect -y 0 on Model A
Run i2cdetect -y 1 on Model B

Run i2cdetect -y 0 on Model A
Run i2cdetect -y 1 on Model B


Run hwclock --systohc -D --noadjfile --utc
Above command will set the time on the DS1307.
Run hwclock -r //Verify the hardware clock

Conclusion :

In this article we saw Basic methods to update rtc in raspberry pi so about this article you have any query then free to ask me.

sachin Pagar

I am Mr. Sachin pagar Embedded software engineer, the founder of Sach Educational Support(Pythonslearning), a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.

Leave a Reply