Friday, 27 March 2015

RTC

I bought an RTC module from China, which can provide the real date and time for the Raspberry Pi at each start-up. I remembered that it had a DS13..whatever chip in it, so i googled it and found that it's name was DS1307 and uses I2C protocol. So i created a connection on the panel for the RTC module on the I2C bus.


After I connected the module and it did not work, i realized that it has a DS1302 chip on it, which does not use I2C, but some special protocol. I had to hack the panel, some re-soldering, but luckily there was two more pins on the Raspberry pi, which were not yet connected.

i found a sample code on: http://www.zedt.eu/tech/hardware/using-ds1302-real-time-clock-module-raspberry-pi/. After integrating the code to my project the module worked fine:

09:44:03 : [RTC  ] -     - 265:   |  > setSystemTime ()
09:44:03 : [RTC  ] -     - 297:   |  |  . setSystemTime (time set: 2015-02-26 14:46:08)
14:46:08 : [RTC  ] -     - 314:   |  < setSystemTime ()


No comments:

Post a Comment