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


ImageImage

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 https://github.com/OLIMEX/OLINUXINO/tree/master/SOFTWARE/A13/MOD-RTC

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 MOD-RTC.py --verbose --i2c=0 -w

you can read MOD-RTC date/time with

#sudo python MOD-RTC.py --verbose --i2c=0 -r

you can sync system clock to MOD-RTC with:

#sudo python MOD-RTC.py --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.

    Reply

  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.

    Reply

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

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

    Reply

  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!

    Reply

Leave a comment