kghunt
Posts: 383
Joined: Sun Mar 04, 2012 9:28 am

Help with RTC

Thu Oct 11, 2012 4:15 pm

I am using a ds1307 tiny rtc module which I can detect with i2c detect if I momentarily connect it to 5v (naughty I know).

I tried putting a voltage divider on sda and scl from the 1307 to drop it to 3.3v. The voltage divider works fine but the 1307 is no longer connected?

I assume it is not a good idea to connect the rtc to the pi using 5v.

Has anyone used one of these tiny rtc modules.

http://www.ebay.co.uk/itm/170794819927? ... 1439.l2649

LesTroyer
Posts: 14
Joined: Wed Aug 29, 2012 2:38 pm

Re: Help with RTC

Thu Oct 11, 2012 4:33 pm

you don't need a voltage divider - the clock only pulls down the i2c lines - never supplies ANY voltage to them. -- so feed your clock 5V all day - you won't be putting any of it back into the pi. (the PI is providing the voltage thru some pull up resistors).

other protocalls do actively pull the lines high as well as low - so don't extrapolate to other methods - but I2C is "safe" for the pi.

robotworkshop
Posts: 24
Joined: Thu Aug 30, 2012 7:19 pm

Re: Help with RTC

Thu Oct 11, 2012 5:13 pm

There is a good tutorial on adding a RTC here:

http://www.raspberrypi.org/phpBB3/viewt ... 44&t=16218

wallabybob
Posts: 17
Joined: Thu Aug 18, 2011 2:08 am

Re: Help with RTC

Wed Nov 14, 2012 1:37 am

kghunt wrote: Has anyone used one of these tiny rtc modules.

http://www.ebay.co.uk/itm/170794819927? ... 1439.l2649
I bought a similar module on eBay and encountered some challenges getting it to work the way I wanted with Raspbian.

Before connecting the Tiny RTC board I brought my system up to date by

Code: Select all

# apt-get update
# apt-get upgrade 
I soldered a 7 pin header to P1 on the Tiny RTC board then used jumper wires to connect the Tiny RTC module pins SDA, VCC, SCL, GND to pins 3 through 6 (respectively) on the P1 header on the Raspberry Pi board. This connects the Tiny RTC to i2c bus 1 on the 512MB Raspberry Pi I have. Therefore I modified /etc/default/hwclock to include the line

Code: Select all

echo ds1307 0x86 > /sys/class/i2c-adapter/i2c-1/new_device 
just before the end of the file.

Previous replies to the topic have suggested changes to /etc/init.d/hwclock but that file doesn't exist on my system so I made the suggested changes to /etc/init.d/hwclock.sh Unfortunately those changes were insufficient to get the TinyRTC supplying the clock to the system. I also needed to delete the lines

Code: Select all

       if [ -d /run/udev ] || [ -d /dev/.udev ]; then
            		return 0
	    fi 
to get the system clock set from the RTC on startup with no network operational.

This seems to work fairly reliably on a warm restart but not on a cold restart (power cycle).

As far as I have been able to tell so far, the

Code: Select all

echo ds1307 0x86 > /sys/class/i2c-adapter/i2c-1/new_device 
is done only once on startup, yet the startup frequently reports:
[ 13.142534] rtc-ds1307 1-0068: rtc core: registered ds1307 as rtc0
[ 13.168851] rtc-ds1307 1-0068: 56 bytes nvram
[ 13.193369] i2c i2c-1: new_device: Instantiated device ds1307 at 0x68
[ 13.231201] i2c i2c-1: Failed to register i2c client ds1307 at 0x68 (-16)

CbeSolar
Posts: 7
Joined: Mon Sep 24, 2012 10:37 pm

Re: Help with RTC

Sun Dec 16, 2012 7:48 pm

I have the exact RTC (from ebay) - so I too am interested in knowing if the 5V are ok for the PI.

anddr
Posts: 4
Joined: Mon Jan 07, 2013 7:52 am

Re: Help with RTC

Mon Jan 07, 2013 12:51 pm

Hi!

If you want to use the waiman rtc on raspberry pi, you have to remove R2 & R3 @ 332 so SDA and SCL is not pulled up to 5v.

But you have to power the DS1307 from 5V or else it will think it is powered by battery and shut down SDA and SCL.

When done like this the RTC module operates at safe logic levels for the RPI, works like a charm with me. :D

Best regards,
Anders

kghunt
Posts: 383
Joined: Sun Mar 04, 2012 9:28 am

Re: Help with RTC

Tue Jan 15, 2013 2:11 pm

Awesome I removed R2 and R3 on my waiman rtc and it worked first time amazing :-) I got 2 of these rtc's for £1.50 from Chinabay.

Cant say better than that.

asa_g
Posts: 20
Joined: Tue Jan 08, 2013 7:43 am

Re: Help with RTC

Mon Feb 18, 2013 6:24 pm

Do you have any ideas how to use DS18B20 temperature sensor from waiman Tiny RTC boadrd?


asa_g
Posts: 20
Joined: Tue Jan 08, 2013 7:43 am

Re: Help with RTC

Mon Feb 18, 2013 9:11 pm

RTC works fine, but board from waiman also has eeprom and temperature sensor

kghunt
Posts: 383
Joined: Sun Mar 04, 2012 9:28 am

Re: Help with RTC

Mon Feb 18, 2013 10:11 pm

Does it? That's cool. I assume it has EEPROM to store the time settings etc but the temp sensor would be awesome.

asa_g
Posts: 20
Joined: Tue Jan 08, 2013 7:43 am

Re: Help with RTC

Tue Feb 19, 2013 7:07 am


SJF2810
Posts: 3
Joined: Mon Mar 11, 2013 12:04 am

Re: Help with RTC

Tue Mar 12, 2013 5:28 pm

Hi guys,

I have a waiman TinyRTC v1.1 It doesn't look anything like the one in the adafruit.com link in earlier posts which specifically mentions removing R2 & R3. Mine does have R2 & R3 but they are surface mount resistors. Can anyone tell me if I have to remove these resistors?

I think I might try putting a 5V supply on and measuring the potential between gnd and both the SDA and SCL pins and also across SDA and SCL to cover all bases.

Also, mine does not have a DS18B20 temperature sensor but there is a position where it could be soldered in however, I already have two of these sensors (I bought the waterproof version with 1m cable) which is coupled to 5V grd and GPIO4, and these work brilliantly.

Thanks for any suggestions regarding the RTC.

Steve

kghunt
Posts: 383
Joined: Sun Mar 04, 2012 9:28 am

Re: Help with RTC

Tue Mar 12, 2013 7:11 pm

SJF2810 wrote:Hi guys,

I have a waiman TinyRTC v1.1 It doesn't look anything like the one in the adafruit.com link in earlier posts which specifically mentions removing R2 & R3. Mine does have R2 & R3 but they are surface mount resistors. Can anyone tell me if I have to remove these resistors?

I think I might try putting a 5V supply on and measuring the potential between gnd and both the SDA and SCL pins and also across SDA and SCL to cover all bases.

Also, mine does not have a DS18B20 temperature sensor but there is a position where it could be soldered in however, I already have two of these sensors (I bought the waterproof version with 1m cable) which is coupled to 5V grd and GPIO4, and these work brilliantly.

Thanks for any suggestions regarding the RTC.

Steve
I have the same RTC. Removing the surface mount resistors worked a treat on mine.

dhead
Posts: 10
Joined: Fri Apr 06, 2012 4:31 am

Re: Help with RTC

Sat Apr 06, 2013 10:43 am

Has anyone that removed the R2, R3 on the TinyRTC v1.1 made a real test with no network after pulling out the plug.

On the schematic pdf the R2, R3 are indeed pullups but this is for v2.0.
Respectively to the silkscreen on v1.1 the R2, R3 are connected to the battery, removing them means disconnecting the battery, the RA1 array is the pullups for sda, scl and sq.

pgman
Posts: 22
Joined: Sun Jan 06, 2013 8:34 pm

Re: Help with RTC

Sat Apr 06, 2013 1:59 pm

I've got a board connected to the Pi with the resistors R2&R3 removed. It works most of the time, but I've had problems at start-up with it (RTC not ready). I think I may have an issue with the crystal though, as it drifts a lot more than it should. I'm running in another board on an Arduino (to establish exactly what the drift is on it).

Here is a pic showing how I've got it connected.

As you can see the resistors have been removed. I did a trace on the board to make sure what I was removing first though, and one side it at +5v, with the other at the SDA/SCL lines of the chips.
Attachments
RTC Connected.jpg
RTC Connected.jpg (51.54 KiB) Viewed 12737 times

spiro1
Posts: 1
Joined: Sat Apr 06, 2013 2:11 pm

Re: Help with RTC

Sat Apr 06, 2013 2:30 pm

Hi Everyone
Im new to ardiuno And need some help. I also have the tinyrtc v1.0 looks like the one your using. I have it on a mega 2560 grd to grd 5v to vcc sda pin20 scl pin21 , using sample code from ds1307new/ds1307_test ,when i try and set time I get 165 165 85 165 165 2165 now those are not the time and date i expect, do i need to remove the r2 andr3 for the rtc to work, can you help
Thanks Alan

dhead
Posts: 10
Joined: Fri Apr 06, 2012 4:31 am

Re: Help with RTC

Sat Apr 06, 2013 5:13 pm

@pgman, if you read my post you'll notice that I'm refering to v1.1 (white solder-mask) that some users suggested to remove the R2, R3 which is incorrect, your board is v2.0 and the devices naming quite different.

I had issues during startup when trying to register the i2c device too early before the modules were loaded.
On Arch Linux this was fixed with a systemd service that made sure the i2c ds1043 will be register after all the modules are loaded (and of course the i2c_dev and ds1043) and also before the network (so when ntp available the clock will be update).

I'm in the process of writing a thoroughly guide (for Arch Linux) and will post this later.

pgman
Posts: 22
Joined: Sun Jan 06, 2013 8:34 pm

Re: Help with RTC

Sat Apr 06, 2013 7:16 pm

@dhead - Ah, missed that point about the version nos. My problem seems to go well beyond boot up time though (up to 10 mins sometimes). I've disabled the dummy-RTC and the ntp access, so I know I've only got this one running.

@spiro1 - simple question - have you set the clock at all? If the battery goes flat/discharged/disconnected then you get default values. Check also that you can see the 24C32 (run the I2Cscanner example), I think its at address 0x50.

BTW you do realise this is the RasPi forum don't you... ;)

dhead
Posts: 10
Joined: Fri Apr 06, 2012 4:31 am

Re: Help with RTC

Sun Apr 07, 2013 6:46 am

@pgman, that an intersting issue you've got, I've no idea what's the cause.
I would get another rtc (it's cheap) in the hope that the malfunction is with the current rtc and prob both of the rtc's (a scope would be nice), try to fix it and learn something in the process.

Return to “Interfacing (DSI, CSI, I2C, etc.)”