Product Overview:
The DS3231 RTC Module is an ultra-precise, temperature-compensated real-time clock designed for time-sensitive applications. Equipped with a built-in battery backup, the DS3231 ensures reliable timekeeping even when power is interrupted. This module is perfect for Arduino projects, Raspberry Pi applications, and any microcontroller project where precise time management is essential, such as IoT devices, data loggers, and industrial automation systems.
Key Features:
- High-precision TCXO (Temperature Compensated Crystal Oscillator) with accuracy of ±2ppm from 0°C to +40°C.
- Built-in battery backup for continuous timekeeping, ensuring the clock runs even during power failures.
- 32.768kHz output for microcontroller synchronization.
- Integrated temperature sensor with ±3°C accuracy for enhanced performance.
- Two programmable alarms for time-based event triggering.
Technical Specifications:
- Operating Voltage: 2.3V to 5.5V
- Battery Backup: 3V CR2032 coin cell
- Interface: I2C (400kHz Fast Mode)
- Timekeeping Accuracy: ±2ppm (0°C to +40°C)
- Temperature Sensor Range: -40°C to +85°C
- Calendar: Seconds, minutes, hours, day, date, month, year
- Dimensions: 38mm x 22mm x 14mm (varies by manufacturer)
Applications:
- IoT devices requiring real-time data collection and timestamping
- Data logging systems with precise time synchronization
- Smart home automation systems for scheduled tasks
- Battery-powered devices that need long-term timekeeping without resetting
- Environmental monitoring systems that track data over time
Pinout Diagram:
- VCC: Connect to a 3.3V or 5V power supply.
- GND: Connect to ground.
- SDA: Connect to the I2C SDA pin on your microcontroller.
- SCL: Connect to the I2C SCL pin on your microcontroller.
Sample Arduino Code:
#include <Wire.h>
#include "RTClib.h"
RTC_DS3231 rtc;
void setup() {
Serial.begin(9600);
if (!rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
if (rtc.lostPower()) {
Serial.println("RTC lost power, let's set the time!");
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
}
void loop() {
DateTime now = rtc.now();
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(" ");
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
delay(1000);
}
Operation:
- Install the DS3231 library in your Arduino IDE.
- Connect the module to your microcontroller.
- Upload the provided code.
- Open the Serial Monitor to view the current date and time.
Caution:
- Do not exceed the maximum operating voltage of 5.5V.
- Handle the module carefully to avoid damaging the crystal.
- Ensure correct polarity when connecting power and I2C lines.
- Replace the backup battery when the voltage drops below 2.5V.
Troubleshooting Tips:
- Incorrect time?
- Verify the backup battery is installed and functioning.
- Communication issues?
- Check your I2C connections and addresses.
- Time drift?
- Ensure the module is in an environment within its rated temperature range.
- Initialization failure?
- Check power supply voltage and ensure proper connections.
FAQs:
- How long does the backup battery last?
- The CR2032 battery can last between 3-5 years, depending on usage and environmental factors.
- Is it compatible with Raspberry Pi?
- Yes, the DS3231 can be used with a Raspberry Pi via its I2C interface.
- How do I set the time initially?
- You can use the
rtc.adjust()
function in your code, as shown in the sample above.
- You can use the
- What’s the difference between the DS3231 and DS1307?
- The DS3231 is more accurate, with built-in temperature compensation, while the DS1307 is more cost-effective but lacks such precision.
- Can I disable the square wave output?
- Yes, the SQW output can be disabled via the module’s configuration in your code.
Resources:
- DS3231 Datasheet
- Adafruit DS3231 Library: https://github.com/adafruit/RTClib
Reviews
There are no reviews yet.