Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

DS3231 (Real time clock) datasheets

Les Jones

Well-Known Member
Most Helpful Member
Background. About 6 years ago I bought a DS3231 RTC module and wrote some code to read and write the registers. This worked. A few days ago I got the module out again as I am planning to us it in an event monitor. I looked at the code I had written to see how it worked. I ran the program an was quite surprised that the time it displyed was only about 12 seconds out. The program originaly set the time and date in december 2017. The program now jumped past the code to set the time and date so the DS3231 had kept time very well for over 6 years. As I plan to use the the 1 hz square wave output to interupt the event monitoring code every second to keep the microcontroller updated with the time and date I looked at the datasheet to see how to enable this output. It looked like all I needed to do was to change bit 2 of the control register (0x0E) from 1 to 0. The default value was shown eith just bits 2,3,4 set to 1. (0x1C). The datasheet said that bits 3 &4 had no function so I wrote 0x18 to the control register.
This gave a square wave output but it was 8.192 Khz. I read though the data sheet again to see how to change this with no success. While trying to solve the problem online I was looking at a datasheet online and did a search for 8.192. This resulted in finding that THIS datasheet said that bits 3 & 4 of the control register controlled the square wave output frequency. The needed to be set to zero for 1 hz. I changed the code to set them to zero and now have the 1 hz output. The original datasheet was from Maxim. The one I looked at online was marked Dallas Maxim.
I hope this will help others.

Les.
 
I use DS3231s in several digital clocks. It's nice to have a digital clock that's right after a power failure or when it's been unplugged.

The accuracy is fantastic. Except for changing for daylight time, they seldom need touching.
 
I set one going a long time ago, I can't even remember when - and last time I checked it, the time was still fairly accurate - I'm not even sure where it is now?.

I also used the 1Hz square wave output, as an interrupt signal, I don't recall any issues doing so.
 

Latest threads

New Articles From Microcontroller Tips

Back
Top