how to add a clock and use the time

andyshrimpton

New Member
Hello All

I have read many posts about time stamping but do not understand what i need to do. I assume that you need to add some form of timer chip.

What i would like some guidance on is.

1. How to add a real time clock in some picaxe code.
2. What extra chips are required, and how are they connected
3. Once the clock is running how to interface with it, for example, if the real time is between 8am to 7pm then allow a routine to happen.

I am finding picaxe great fun, but very frustrating not being able to get on quick enough, this site is full of great information and member with some great skill and advice on coding.

Other than the manuals on this site are there any good books around that i could purchase.

Or are there any other known web sites with working code examples that can be used to learn from.
 

Minifig666

Senior Member
http://www.rev-ed.co.uk/docs/axe110_i2c.pdf should help. You are maily looking at the DS1307, it is pretty easy to use. For allowing certain things to happen at a set time you would just have to use an IF statment to check the hour. I can't help you with the books but if you are feeling brave you could have a look at the binary clock code. The BCD to binary section makes the numbers easyier to work with.
 

Minifig666

Senior Member
Just a quick sidenote. Be carefull with the crystal. If you drop it, even just from a short distance it can, occasonaly, throw them way off. Also the tiny leads are realy fragile.
 

craigcurtin

Senior Member
Wulfden Board is easy to get started with

Hey,

I found recently that Wulfden have an I2c board for cheap that has a DS1307 and space for a LCxxx memory chip - do a search online for them - all made up and ready to connect to a project through i2c

regards

Craig
 

TAMeyer

Member
Dropping Crystals?

@Minifig666:

I was planning on doing extensive testing and research before opening a thread with schematics etc. Your comment in Post#5 above prompts me to now, please ask for more information on this.

I have four RTC modules. A BOB-00099 from Sparkfun, a homemade PCB with a DS1307 and two homemade PCBs populated with DS3231S’. The 3231 has an integrated crystal.

They all lose time. The Sparkfun is the most stable losing a few minutes a day. The 1307 loses several hours each day. The two 3231s lose about an hour daily although different amounts between the two.

The intent of the project is to create Christmas gifts that “perform” on the hour during the holidays. But if the crystals are that fragile, shipping the gifts would “kill” them. If this is true perhaps the crystals arrived damaged.

***More testing is needed as the same code/circuit/breadboard/USB/LCD, etc….are used with all four. It was your comment that prompts this entry.

Can you please expand?

Thanks

Terry
 

John West

Senior Member
My bad experiences with RTC clock crystals have led me to always keep the leads shorted together with a piece of fine wire until I've completed soldering them in the circuit.

I also use a 10 to 30 pF trimmer cap on one leg of the xtal instead of a fixed value cap. Then I can tweak the clock for a precise time interval. I've had very good results this way.
 

Andrew Cowan

Senior Member
I usually stick with the DS1338C - although SMD only, it has an internal crystal, and seems to be very very accurate.

A
 

KTarke

Senior Member
John West, can You bring more light, why short-circuiting the crystal helps?

In my short time with Picaxe's I have already experimented with 1307 chip, the crystal soldered strigth to the chip holder -does not keep time.
And several AXE033's with rtc and battery, they do not keep time ,either...

Andrew Cowan, thanks for the tip about the Maxim -chip. I do also believe ,that internal resonator might be better, have to try one.
 

MPep

Senior Member
If you can afford it, or already have one, then use a GPS. All time keeping problems solved. :D
 

MPep

Senior Member
Andy,

Suggest you look on Maxim website for info on DS1338C chip, and many others too. Maxim took over Dallas Semiconductor many years ago.

SMD = Surface Mount Device (aka SMT = Surface Mount Technology).

MPep.
 

BCJKiwi

Senior Member
Check the DS 1337C while you are there.
No NV RAM but does have battery backup as well as the internal crystal.

These can be soldered (with care and a bit of a fiddle) directly onto a DIP 8 socket.
 
Last edited:

axeman22

Member
Check the DS 1337C while you are there.
No NV RAM but does have battery backup ans well as the internal crystal.

These can be soldered (with care and a bit of a fiddle) directly onto a DIP 8 socket.
just noticed that the DS1337C is still 10ppm - the DS323x RTC's are 2ppm for the same temp range.
 

BCJKiwi

Senior Member
As the DS3231 is in a 300mil SO 16 pin package the same as the DS1337C, it should also be able to be soldered directly to an 8pin DIP socket with care.
 
Top