Add Real Time Clock to OLinuXino and RaspberryPi with MOD-RTC


MOD-RTC is real time clock with battery backup. OLinuXino and RaspberryPi have no RTC so when the boards are powered off they lost their date/time setting.

This could be easily changed with MOD-RTC. OLinuXino have UEXT connector where MOD-RTC could be connected directly, RaspberryPI should have also RPI-UEXT adapter to may use MOD-RTC.

The code for MOD-RTC is on GitHub

It’s written in Python so you have to install it before use. The code allow few things to be done. You can copy your board system clock to MOD-RTC with

#sudo python --verbose --i2c=0 -w

you can read MOD-RTC date/time with

#sudo python --verbose --i2c=0 -r

you can sync system clock to MOD-RTC with:

#sudo python --verbose --i2c=0 -s

the only difference when run on A13, imx233 or RaspberryPi is the I2C address which called as program parameter:

Where I2C-Bus is:
	0 for IMX233
	2 for A13
	0,1 for RPi, depending of the revision

4 Comments (+add yours?)

  1. Weston
    Mar 10, 2013 @ 08:46:18

    Great design, but I think you would be more successful at selling it if the plugs were soldered on at right angles to where the 1.5″ is over the Rpi instead of straight up. As is there are a lot of reasons it will be cumbersome and not work for numerous apps. Judging by the design, it would be an easy change. Can the plug be bent very easily after soldering? That would work I suppose to make the right angle.


  2. Ali
    Mar 28, 2013 @ 22:10:04

    Thanks for the post! do you think if we can also set a wake up alarm for OLinuXino using this module to automatically wake up the board from suspend mode? I can’t find a way to automatically wake up the board at a certain time.


  3. Michal
    Nov 05, 2013 @ 17:46:42

    Unless there is an error in the python. The month of November RTC returns in December.


  4. Stefan
    Jul 15, 2014 @ 16:07:43

    i have downloaded the files for the a20.
    in RTC.c is an error in the SYNC function.
    after the line
    rtc_tm -> tm_year = BCDtoInt(data[6]);
    must be
    rtc_tm -> tm_isdst = -1;

    otherwise the mktime(rtc_tm) will give a wrong daylightsavingtime and will add 1 hour!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: