In this illustration we will going to wire the MAXIM DS3231 Real Time IC Clock. This module can be used in almost any project that requires a real time clock and date. The pins are already installed so that you can just easily connect the jumper wires or solder your own connection onto the board itself. It very easy to use and with the help of MCU.
This DS3231 Module has the CR2032 battery to power the module as standalone even if there is now MCU still running at real time. The board has also small ATMEL AT24C32 32K EEPROM which is handy for storing date, settings and other configuration.
This module work both 3.3v and 5v tolerant so you can use it with almost any other development platform board that uses I2C BUS. It uses the same command as the DS1307. The benefits over the DS1307 is the increased of accuracy, down to +/- 3.5 ppm whereas the DS1307 can vary wildly depending on the temperature, accuracy and the quality of external crystal and capacitors.
Required Components
- Arduino UNO/MEGA/MINI/PRO
- DS323 Real Time Clock Module
- Solder Less Bread Board
- Jumper Wires / DuPont Wires
Wiring Diagram
As you can see the illustration above you need to ignore the 32K and SQW pins, you will not going to used them. Place the jumper wire to SCL into your board A5 port, and the SDA pin goes to pin A4 port, if you’re using other version of Arduino that has SCL and SDA ports and AREF if the board has this port you can also use them. The power VCC pin you going to plug into the 5V pin and the ground GND place it into the Ground pin.
You need to double check the connections before plugging your board into your computer improper wiring can damage your modules and sensors.
If done everything correctly, when you going to plug the Arduino to the computer there will be a RED LED light on the clock module board showing that the board is ready to drive. If you don’t get any light from the board you need to double check the wiring connections.
Once you’re done, you need to import the DS3231 code library which can be downloaded here. This code library contains the code as well as the libraries required for this illustration, copy the file DS3231.cpp, DS3231.h, keyword.txt and readme.txt to your Arduino Libraries, folder name DS3231.
As you can see the sketch below this code is already on the library except that there will be a comments.
Arduino Sketch Code
[crayon-674327909fe2f209078109/]
Datasheets & Code Libraries
Download the code DS3231.h library here | Rar
Download 24C32 Serial EEPROM Datasheet here | Pdf
Download DS3231 I2C Integrated RTC/TCX0/CRYSTAL Datasheet here | Pdf
Download Schematics Diagram here | Pdf