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, and we gonna interface it with 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 display which is small and classy for little projects.

 

top

           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

        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 don’t forget that it’s very cheap.

     But for the one I’m using today, it’s also a low cost module but it’s claimed to be “extremely accurate i²c module”, and thanks to it’s 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 a nice to use also don’t forget that it has a built in temperature sensor that can inform you of the ambient temperature which can come very handy in projects.

 

 

 

 

 

Wiring:

wiring

       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.

Libraries:

  • DS3231 RTC library: Download from Github, A massive thanks to the creator who made it very simple and easy to use.

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.

Download Adafruit GFX library

Codes:

The codes I’ve used are from the library examples : “Simple”, “Dateformat” and “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).

 

Hope you like it and if you have any problem contact me, and consider a subscribe to the channel 😉

 

 

Yassine View All

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

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: