Skip to content

How to simply use DS3231 RTC module with Arduino + OLED display



Hello and welcome to this tutorial about DS3231 Real time clock module, we gonna interface it with an Arduino board, I’m using Arduino UNO as usual but today instead of the over-used (in this website/channel) LCD screen, I’m using 128*32 OLED i2c display which is small and classy for little projects.

 

top
DS3231 RTC module wired with an Arduino UNO board and an OLED screen

Before continuing, you can check my previous tutorials and projects about another RTC module which is the DS1302 :

Or if you’re not familiar with the OLED display: Use OLED display + Arduino with examples

oled
DS3231 RTC displayed on an i2c OLED screen

If you checked my previous DS1302 tutorials or tested it, you gonna notice that it isn’t very reliable as a module and has few problems, like if you’re using it for a long time you will notice that the time is late by few minutes which is a big problem if you need precision in your projects.

But for the one I’m using today, it is also a low cost module but it’s claimed to be “extremely accurate i²c module”, and thanks to its oscillator which is “Temperature compensated crystal oscillator (TCXO) and crystal”, also a good monitoring of the main power, when it goes off the battery automatically start to keep the time, and by my little experience with this module it’s very accurate and easy to use also, don’t forget that it has a “bonus” built in temperature sensor that can inform you of the ambient temperature which can come very handy in projects.

 

DS3231 Module pinout with Arduino UNO board

 

Wiring:

wiring
Wiring of DS3231 and OLED i2c screen with Arduino UNO board

Both modules use i²c bus so the SDA and SCL for both are on A4 and A5 pins on the Arduino Uno board, those pins have double terminals as you can see, then for power the RTC uses the 5V while the OLED uses the 3.3V, and yeah I might think that using a 5V to 3.3V converter for SDA/SCL is better for the OLED.



Libraries:

If you have a later version of Arduino IDE than 1.8.5 you may need to check this library
Download here, thanks to Russell Gililland for mentionning the issue.

OLED libraries:

Codes:

Code 1: Library example – Simple

 

Code 2: Library example – Dateformat

 

 



Code 3: Library example – Temperature

 

The other ones that I’ve used for the OLED display: Download here (Don’t forget these codes don’t setup the date and time, so it’s better to run the “Simple” example first).

Codes 4: This is a set of 8 different codes that I used in the video

Type 1

Type 2

Type 3

Type 4

Type 4_1

Type 5



Type 6

Type 7

 

Yassine View All

Automation and Electrical Engineer, Electronics amateur trying to share my little projects.

4 thoughts on “How to simply use DS3231 RTC module with Arduino + OLED display Leave a comment

    • You need a lot of modifications, better learn how to use an RTC first then use the 2 keys you want until you get that then merge it with this project.

Leave a Reply

Discover more from SURTR TECHNOLOGY

Subscribe now to keep reading and get access to the full archive.

Continue reading