Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I have added an RTC to the I2C bus of the Raspberry Pi. If I follow the steps mentioned here (I am using the DS1307 RTC IC), I can run hwclock and read the time.

root@raspberrypi:~# modprobe rtc-ds1307
root@raspberrypi:~# echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device

Once, I run this, I cannot access the RTC from my python script any more. However, I have to do this at each boot. Is there a way I can specify my RTC address on the I2C so than the system recognizes it at boot time?

share|improve this question
Did my answer help? –  Munkeh Dec 20 '12 at 17:02

1 Answer 1

Add the commands to /etc/rc.local for the module to be loaded on each boot.

Depending on your distrobution, the path to rc.local may vary. On Arch ARM it is /etc/rc.d/rc.local

You may want to add an echo command before the module is loaded for some visual feedback, for example:


echo Loading RTC module
modprobe rtc-ds1307
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
echo Done

Keep in mind that rc.local runs last - after all other init scripts have run, so if you have anything else at boot that depends on the hwclock being set, be sure to run those after rc.local has run, ideally append it after the last echo command above.

If you really need to have the hwclock set earlier, you'll need to edit one of the init scripts in /etc/rc.d (or wherever they are located on your distro) to load your module and echo commands.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.