$1.65 rtc i2c

tony_g

Senior Member
I bought one of these a few weeks ago so hopefully it will arrive soon, only $1.83 CAD so a bargain even if it doesn't work properly.

I have occasionally heard people have issues with the accuracy of these cheap modules but we shall see lol
 

westaust55

Moderator
I have occasionally heard people have issues with the accuracy of these cheap modules but we shall see lol
The DS1307 (and DS1338) are by default/design less accurate on average than other RTC chips such as the DS323x range.
Check the datasheets on accuracy.
 

geoff07

Senior Member
Still, they aren't bad and the price (with free shipping!) is about the cost of a non-rechargeable CR2032 battery alone!
 

westaust55

Moderator
Furthermore, as per some past posts here, once you work out what the error/drift is you can make adjustments in the PICAXE program to accommodate the error. More complex if the PICAXE is shut down and misses an adjustment time but still do-able.
 

Technical

Technical Support
Staff member
Most of the inaccuracy with these cheap modules is the manufacturer just using any old watch crystal, rather that the one with the correct characteristics (load capacitance etc.) for the chip.
 

lbenson

Senior Member
I had gotten several of these modules some time back. I wondered what the 3 pins inside a to-92 outline might be for. Hmmm, Vcc and 0V and middle connected to the "DS" pin with a 4K7 pullup. I soldered in a DS18B20, did readtemp on the DS pin, voila, a time and temperature module.
 

Hemi345

Senior Member
Yes, but edit the code the wizard creates so you don't send the control byte. Part of the alarm 1 is at register 07h on the DS3231. If you want to configure the control byte, do it in another hi2cout command starting at register 0Eh.
 

tony_g

Senior Member
well mine arrived in the post today and after sifting around on the numerous threads in the forum and scraping together some code i have got it working ok and displaying time via my 14m2 and terminal.

i think i will change the crystal on it though for one that meets the specs as per the datasheet to try and keep time as accurate as possible as i had let it run for about 4 hours and it had already lost about 4 seconds compared to when i first programmed it and had it set and synced with the time i was getting on the pc.

overall a nice budget buy for about the same cost as a cheeseburger though this will give me more enjoyment lol.

now all thats left is to have a go at changing the code on the 14m2 that gets the time to displaying the day/month as a word format instead, some more learning to do i think (groan)
 

jims

Senior Member
Probably be good to document this in the upcoming PE update. Jims
Yes, but edit the code the wizard creates so you don't send the control byte. Part of the alarm 1 is at register 07h on the DS3231. If you want to configure the control byte, do it in another hi2cout command starting at register 0Eh.
 

lbenson

Senior Member
Hadn't realized that this module also includes a 4K-byte eeprom, the AT24C32. Just tested it, and that also works, so RTC, 4K eeprom, and, if you add it, DS18B20 on one module for ~$1.67US.
 

the old fart

Senior Member
i think i will change the crystal on it though for one that meets the specs as per the datasheet to try and keep time as accurate as possible as i had let it run for about 4 hours and it had already lost about 4 seconds compared to when i first programmed it and had it set and synced with the time i was getting on the pc.
I have a number of these units, not one of them keeps good time. I've fitted crystals, RES038 and a £4 watch one, but neither keeps accurate time. I did have limited success by ensuring that the can of the crystal is tied to the gnd pad.

I have to add this routine to each program to correct the drift.
Code:
	i2cslave %11010000, i2cslow, i2cbyte   	' set DS1307 slave address
	hi2cin 0,(sec,dsmin,dshr,day)  	'Read date and Time
	
	if correct=0 and sec>$30 and dsmin=5 and dshr=7 then let correct=1 ; adjust sec to suit
		
		hi2cout 0,(0) ; sets sec to 0 and stores in rtc
	 
		  endif
		  
		if dsmin=6 then let correct=0:endif
Dave
 

MartinM57

Moderator
There seems to be an assumption/hope that the RTC chip itself is a genuine/up-to-spec Maxim device. IMHO, and experience, that assumption/hope might not be correct....
 

beb101

Senior Member
I have a 20X2 powered by 2 AA cells breadboarded with a DS3232M and a 24LC256 running in the following endless loop:
Code:
main:
	hi2csetup i2cmaster, DS3232, i2cfast, i2cbyte 'DS3232 Clock
	hi2cin $0,(sec,mins,hour,day,day_mo,month,year) 
	
	gosub Time
	gosub Date
	
	pause 2000 'to see time
	
	hi2csetup i2cmaster, _24LC256, i2cfast, i2cword '24lc256
	gosub read_24lc256
	
	doze 5
goto main
The time was set by the AXE110 Data logger --> Set DS1307 Time/Date. It has been running for about 2+ months. I just looked at the time relative to my PC clock and the clock error is of the order of 1/2 sec.

PC = 12:16:07 PM -- 12/18/13

DS3232M = 12:15:26 PM -- 12/18/13

A small initial error was probably introduced by the setting Wizard. In any case, this clock seems to be very stable relative to the venerable DS1307.
 

premelec

Senior Member
A technique I have used to test drift and proximity effects etc is to tune a radio receiver to a signal with ticks each second [e.g WWV] and put that into the vertical oscilloscope signal input and then trigger the sweep with the oscillator under test. It becomes pretty clear by the time 'ticks' drifting on scope screen when you are right on or drifting - and if you put in a trimmer capacitor you can zero it in... or find you are just too far off to correct...
 

MartinM57

Moderator
Enable 1Hz output of the DSxxxx
Feed into Salea logic analyser
Feed 1 pulse per second signal from a GPS unit into Saleae logic analyser
Take a capture
Measure delta time between 1PPS and 1Hz outputs
Wait 10 mins or so
Take another capture
Measure delta time between 1PPS and 1Hz outputs
...compare with previous reading
...tweak DS1307 crystal, capacitors or layout/tweak DS3232 aging register

Rinse and repeat

As an academic exercise I got a DS3232 down to 0.1s accuracy when measured against GPS time over a period of 6-8 weeks IIRC - indoors, no extreme temperature variations though

EDIT:but I like premelec's idea of a "drifting" realtime oscilloscope trace, rather than the static captures of the Saleae :)
 
Last edited:

1968neil

Senior Member
Most of the inaccuracy with these cheap modules is the manufacturer just using any old watch crystal, rather that the one with the correct characteristics (load capacitance etc.) for the chip.
I'll 2nd that statement, i use the correct xtal and have no issues in any design using the DS1307 the internal capacitance needs to be 12pf - Rev-Ed sell the correct part http://www.techsupplies.co.uk/epages/Store.sf/en_GB/?ObjectPath=/Shops/Store.TechSupplies/Products/RES038

No excuses now :)

1968 Neil
 
Last edited:
Top