|
MAX7219 8x8 RED LED Dot Matrix Module |
x 3 | |
|
Arduino Nano V3 |
x 1 | |
|
Push Switch Tactile Momentary 12mm |
x 2 | |
|
40 Pin Jumper Wires Female to Female 20cm |
x 1 | |
|
DS3231S#Analog Devices Inc./Maxim Integrated
|
x 1 |
|
arduino IDEArduino
|
Led Matrix Clock
DS3231 RTC is a Precise Real-Time Clock Module with 32Kbit EEPROM and a built-in 10-bit temperature sensor having a resolution of 0.25C.
The DS3231 RTC module Precise Real-Time Clock Module 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 and maintains accurate timekeeping when the main power to the device is interrupted.
The integration of the crystal resonator enhances the long-term accuracy of the device as well as reduces the piece-part count in a manufacturing line. The ds3231 Arduino is available in commercial and industrial temperature ranges and is offered in a 16-pin, 300-mil SO package.
For more details about the IC, the DS 3231 datasheet is attached.
Features:
Two Time-of-Day Alarms.
Digital Temp Sensor Output.
Register for Aging Trim.
DS 3231 RTC with 2032 Battery Holder.
Highly Accurate RTC Completely Manages All Timekeeping Functions.
Real-Time Clock Counts Seconds, Minutes, Hours, Date of the Month, Month, Day of the Week, and Year, with Leap-Year Compensation Valid Up to 2100.
Configurable I2C device Address for AT24C32 using SMD jumpers on PCB (A0, A1, A2).
Programmable Square-Wave Output Signal.
Battery-Backup Input for Continuous Timekeeping.
Low Power Operation Extends Battery-Backup Run Time.
Programming
Once we connect the module we need to program the Arduino Board to work with the Real Time Clock. However, when it comes to programing a communication between Arduino and an I2C module the code isn’t that small and easy. Luckily, there are already several libraries for the DS3231 RTC which can be found on the internet.
For this tutorial I chose to use the Library made by Henning Karlsen which can be found and downloaded from his website, www.rinkydinkelectronics.com.
So once we download and install the library we can use its first demo example to initially activate the clock of the RTC module. In the setup section of the demo example code we can notice that there are three line that we need to uncomment in order to initially set the day of the week, the time and the data.
// Code from the Demo Example of the DS3231 Library
void setup()
{
// Setup Serial connection
Serial.begin(115200);
// Uncomment the next line if you are using an Arduino Leonardo
//while (!Serial) {}
// Initialize the rtc object
rtc.begin();
// The following lines can be uncommented to set the date and time
//rtc.setDOW(WEDNESDAY); // Set Day-of-Week to SUNDAY
//rtc.setTime(12, 0, 0); // Set the time to 12:00:00 (24hr format)
//rtc.setDate(1, 1, 2014); // Set the date to January 1st, 2014
}
Code language: Arduino (arduino)
The first line is for setting the day of the week, the second line is for setting the time in hours, minutes and seconds, and the third line is for setting the date in days, months and years.
Once we upload this code we need to comment back the three lines and re-upload the code again.
// Code from the Demo Example of the DS3231 Library
void loop()
{
// Send Day-of-Week
Serial.print(rtc.getDOWStr());
Serial.print(" ");
// Send date
Serial.print(rtc.getDateStr());
Serial.print(" -- ");
// Send time
Serial.println(rtc.getTimeStr());
// Wait one second before repeating
delay (1000);
}
Code language: Arduino (arduino)
If we take a look at the loop section of the code we can see that now using the three custom functions we get the information from the RTC and print them in the Serial Monitor. Here’s how they appear in the Serial Monitor.
Now even if we disconnect the Arduino power and then reconnect it and run the Serial Monitor again we can notice that the time keeps going without being reset.
A Brief Note on DS3231 RTC IC
The DS3231 is an RTC IC developed by Maxim Integrated. It is a low cost, extremely accurate RTC IC with communication over I2C Interface. An interesting feature of DS3231 RTC IC is that it has integrated crystal oscillator and temperature sensor and hence you don’t have to connect an external crystal.
It is available in SO-16 Package. Although it needs only 8 pins in the available 16 pins to function, the integration of crystal makes the IC bulkier and hence it is packed as a 16-pin IC instead of 8-pin IC.
The following image shows the Pin diagram of the DS3231 RTC IC.
Set the current time in the Real Time Clock
For setting the current time you need to change the code provided.
set your current time int the function setDS3231time()
The parameters for the function are highlighted in red: seconds, minutes, hours, day of the week, date, month and year (in this order). Sunday is the day 1 of the week and Saturday is 7. Don’t forget to uncomment that line of code.
After setting the current time, you can upload the provided code with the required modifications.
Retain the time in the Real Time Clock
If you don’t want to reset the time everytime the RTC is turned off, you should do the following:
after setting up the time, you should comment the function that sets the time and upload the code again.
This is a very important step to set up the time in your RTC. If you don’t do this, everytime your RTC resets, it will display the time that you’ve set up previously and not the current time.
Demonstration
Open the serial monitor at a baud rate of 9600 and you’ll see the results.
Here’s the Serial Monitor displaying the current date and time.
Wrapping up
I hope you’ve found this guide useful.
The RTC module is really useful and you can use it as a clock, timer, etc..
Led Matrix Clock
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Sreeram.zeno
- Esp12-F Cluster V1.0 The ESP8266 is a low-cost Wi-Fi microchip, with built-in TCP/IP networking software, and microcontro...
- TB6612FNG Motor Driver The TB6612FNG Motor Driver can control up to two DC motors at a constant current of 1.2A (3.2A peak)...
- Sunny Buddy Solar Charger v1.0 This is the Sunny Buddy, a maximum power point tracking (MPPT) solar charger for single-cell LiPo ba...
- Diy 74HC4051 8 Channel Mux Breakout Pcb The 74HC4051; 74HCT4051 is a single-pole octal-throw analog switch (SP8T) suitable for use in analog...
- Diy RFM97CW Breakout Pcb IntroductionLoRa? (standing for Long Range) is a LPWAN technology, characterized by a long range ass...
- ProMicro-RP2040 Pcb The RP2040 is a 32-bit dual ARM Cortex-M0+ microcontroller integrated circuit by Raspberry Pi Founda...
- Serial Basic CH340G Pcb A USB adapter is a type of protocol converter that is used for converting USB data signals to and fr...
- Mp3 Shield For Arduino Hardware OverviewThe centerpiece of the MP3 Player Shield is a VS1053B Audio Codec IC. The VS1053B i...
- MRK CAN Shield Arduino The CAN-BUS Shield provides your Arduino or Redboard with CAN-BUS capabilities and allows you to hac...
- AVR ISP Programmer AVR is a family of microcontrollers developed since 1996 by Atmel, acquired by Microchip Technology ...
- Diy Arduino mega Pcb The Arduino Mega 2560 is a microcontroller board based on the ATmega2560. It has 54 digital input/ou...
- Max3232 Breakout Board MAX3232 IC is extensively used for serial communication in between Microcontroller and a computer fo...
- Line Follower Pcb The Line Follower Array is a long board consisting of eight IR sensors that have been configured to ...
- HMC6343 Accelerometer Module The HMC6343 is a solid-state compass module with tilt compensation from Honeywell. The HMC6343 has t...
- RTK2 GPS Module For Arduino USBThe USB C connector makes it easy to connect the ZED-F9P to u-center for configuration and quick ...
- Arduino Explora Pcb The Arduino Esplora is a microcontroller board derived from the Arduino Leonardo. The Esplora differ...
- Diy Stepper Motor Easy Driver A motor controller is a device or group of devices that can coordinate in a predetermined manner the...
- Diy Arduino Pro Mini The Arduino Pro Mini is a microcontroller board based on the ATmega168 . It has 14 digital input/out...
-
-
-
-
-
-
3D printed Enclosure Backplate for Riden RD60xx power supplies
159 1 1 -
-