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.
Before continuing, you can check my previous tutorials and projects about another RTC module which is the DS1302 :
- How to simply use DS1302 RTC module with Arduino board and LCD screen
- How to setup DS1302 RTC module with Keypad + Arduino + LCD
- Simple Arduino based Alarm Clock with DS1302 RTC
Or if you’re not familiar with the OLED display: Use OLED display + Arduino with examples
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.
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.
- DS3231 RTC library: Download from Github, A massive thanks to the creator who made it very simple and easy to use.
- OLED libraries: –Donwload Adafruit SSD1306 library
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 😉
Electronics, Automation engineering student... I try to share my little experience with other electronics amateur.