Saturday 22 January 2022

Programming DS 3231 RTC module with Arduino

DS3231 is a low-cost, extremely accurate I2C
real-time clock (RTC), with an integrated temperature-compensated crystal
oscillator (TCXO) and crystal. The device incorporates a battery input,
disconnect the main power supply and maintains accurate timekeeping. Integrated
oscillator improve long-term accuracy of the device and reduces the number of
components of the production line. The DS3231 is available in commercial and
industrial temperature ranges, using a 16-pin 300mil SO package.

Buy now the module with a discount DS3231 Module

RTC maintains seconds, minutes, hours, day, date,
month, and year information. Less than 31 days of the month, the end date will
be automatically adjusted, including corrections for leap year. The clock
operates in either the 24 hours or band / AM / PM indication of the 12-hour
format. Provides two configurable alarm clock and a calendar can be set to a
square wave output. Address and data are transferred serially through an I2C
bidirectional bus.



1. Size:
38mm (length) * 22mm (W) * 14mm (height)

Weight: 8g

Operating voltage :3.3 - 5 .5 V

4. Clock
chip: high-precision clock chip DS3231

5. Clock
Accuracy :0-40 range, the accuracy 2ppm, the error was about 1 minute

Calendar alarm clock with two

Programmable square-wave output

8. Real
time clock generator seconds, minutes, hours, day, date, month and year timing
and provide valid until the year 2100 leap year compensation

9. Chip
temperature sensor comes with an accuracy of ± 3

Memory chips: AT24C32 (storage capacity 32K)

11. IIC
bus interface, the maximum transmission speed of 400KHz (working voltage of 5V)

12. Can
be cascaded with other IIC device, 24C32 addresses can be shorted A0/A1/A2
modify default address is 0x57

13. With
rechargeable battery LIR2032, to ensure the system after power failure, the
clock move any natural normal

Packing: single anti-static packaging


instructions ( for Arduino uno r3 for example):

SCL → A5

SDA → A4

VCC → 5V


 This is an introduction video about DS 3231 RTC module which
I am going to use in LED clock building. There are 6 pins, but I am using only
4 pins for this purpose.

Connect ground pin of the module to the ground of Arduino,
and connect VCC pin of the module to the arduino 5 volt pin. Then connect SDA
pin of the module to the arduino analog pin number 4 and the SCL pin of the
module to the arduino analog pin number 5.

Now the wiring part is over. You can test the module with
serial monitor. Before that, you have to download the DS 3231 library. The link
to download is given below.

Once the zip file is downloaded, open the arduino software
and go to 

Sketch > include Library > add Zip library.

From the opened window, navigate the location of the library
zip file is downloaded and select the file then ADD.

Library is now added.

Download the code from the link given below and upload to
the arduino.

After the code is uploaded, you can open the serial monitor
to check the time.

Study the programme as you need to work with this in future
as well.

I hope you understand the basics about the DS 3231 RTC

Stay with setnfix. 

Previous Post
Next Post

post written by: