How Does Work RTC(Real Time Clock) Module With Arduino
by STEAM-DIY in Circuits > Arduino
48 Views, 0 Favorites, 0 Comments
How Does Work RTC(Real Time Clock) Module With Arduino
Today we will learn about the RTC module. First, let’s see what the RTC module is.RTC is a real-time clock. It is also a time-consuming electronic device. The battery in this RTC module keeps the date and time updated even when there is no external power. So we can get the exact date and time when we need it.
Let’s see what are the applications that use this RTC technology.
- For Server Computers.
- For gaming.
- For robotics.
- For GPS.
Today we are going to talk about the RTC module called DS3231. This module is designed to include the DS3231 chip. Also through this module, we can get the temperature in addition to the date and time. Here we can see six main pins. We need four of these pins. Below is what happens with these pins.
- VCC —> Connected to the positive.
- GND —> Connected to the ground.
- SDA —> Serial data pin
- SCL —> Serial clock pin.
- SQW —> Square wave output pin.
- 32K —> 32K oscillator output.
Now let us see what are the features of this RTC module.
- We can get the Time, Date, and Temperature.
- Energy consumption is low.
- Easy to carry.
- Two Time-of-day alarms.
- Programmable square-wave output.
- 400Khz I2C interface.
Well, now we will see how to use the RTC
Supplies
Well, now we will see how to use the RTC module with Arduino. The accessories required for this are given below.
- Arduino Nano board x 1 —
- RTC module x 1 —
- Jumper wires —
- Breadboard x 1 —
Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.
Ok, let’s do this project step by step.
First, let’s identify these components.
Then connect these components. For that use the circuit diagram below. The I2C commutation method is used to connect this RTC module to the Arduino board. If you don’t know what I2C is, read this article.
Now we have to make the necessary program for this. To do this, download the RTC Library and install it on your Arduino IDE.
- DS3231 library —
- The complete program of this project –
First, we will add the date and time to the RTC module. For that, we can use the following program.
Code
Code Explanation
First, include the library and the created object. It was named “rtc”.
Next, the RTC module is started in the Void setup. Then enter the time and date as follows.
Well, we have entered the date and time in the RTC module. Now let us see the date and time of the entry in the Serial monitor. For that, use the following program.
Code explanation
First, include the library and the created object. It was named “rtc”.
Next, the RTC module and the serial monitor are enabled in the Void setup.
Finally, the time and date are displayed on the serial monitor.
OK, then select the correct board and port. After, Upload this code and open the serial monitor. Now you can watch the real date and time.
OK, enjoy this tutorial. The full video guide is below. So, we hope to see you in the next project or tutorial. Have a good day.