RTC-module met DS3231-chip voor Arduino, met I2C en back-upbatterij.
SKU: OT2118-A47 Número do artigo: NA509 EAN: 8324968584702 Localização: AD04.09
Alternativa
Módulo Relógio em Tempo Real DS1307 I2C (RTC de alta precisão)
€ 1,80
Ver esta alternativa
Como ligar o Módulo de relógio em tempo real DS3231 I2C (RTC de alta precisão) a um Arduino UNO ou ESP32, com um sketch de exemplo que podes carregar já.
This project connects a high-precision DS3231 RTC module to an Arduino Uno over I2C. The sketch sets the RTC to the compile time if power was lost, then reads and prints the formatted date, time, and onboard temperature sensor readings to the Serial Monitor every second.
/*
* ==================================================================
* Generated by Codey.online — https://www.codey.online
* ==================================================================
* Project : DS3231 Real-Time Clock with Arduino Uno
* Board : Arduino UNO (arduino:avr:uno)
* Parts : DS3231 Real Time Clock Module I2C
* Libraries : RTClib 2.1.4
*
* Codey Online is an AI-powered browser IDE for Arduino and ESP32.
* Describe your project and Codey writes the code, draws the wiring
* diagram and uploads it to your board, straight from the browser.
* This code is free to use, modify and share, without warranty.
* ==================================================================
*/
#include <Wire.h>
#include <RTClib.h>
RTC_DS3231 rtc;
void setup() {
Serial.begin(115200);
while (!Serial);
if (!rtc.begin()) {
Serial.println(F("Couldn't find DS3231 RTC"));
while (1) delay(10);
}
if (rtc.lostPower()) {
Serial.println(F("RTC lost power, setting time to compile time..."));
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
Serial.println(F("DS3231 RTC initialized."));
}
void loop() {
DateTime now = rtc.now();
char dateBuffer[11];
char timeBuffer[9];
snprintf(dateBuffer, sizeof(dateBuffer), "%04d-%02d-%02d", now.year(), now.month(), now.day());
snprintf(timeBuffer, sizeof(timeBuffer), "%02d:%02d:%02d", now.hour(), now.minute(), now.second());
Serial.print(F("Date: "));
Serial.print(dateBuffer);
Serial.print(F(" | Time: "));
Serial.print(timeBuffer);
Serial.print(F(" | Temp: "));
Serial.print(rtc.getTemperature());
Serial.println(F(" C"));
delay(1000);
}
Bibliotecas necessárias: RTClib 2.1.4
Wiring diagram and example code generated by Codey.online — https://www.codey.online
This project reads the current date, time, and internal temperature from the DS3231 Real Time Clock module over I2C. Connect the module to the ESP32's 3.3V rail and default I2C pins, then open the Serial Monitor at 115200 baud to view the live timestamp.
/*
* ==================================================================
* Generated by Codey.online — https://www.codey.online
* ==================================================================
* Project : ESP32 Real-Time Clock with DS3231
* Board : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
* Parts : DS3231 Real Time Clock Module I2C
* Libraries : RTClib 2.1.4
*
* Codey Online is an AI-powered browser IDE for Arduino and ESP32.
* Describe your project and Codey writes the code, draws the wiring
* diagram and uploads it to your board, straight from the browser.
* This code is free to use, modify and share, without warranty.
* ==================================================================
*/
#include <Wire.h>
#include "RTClib.h"
RTC_DS3231 rtc;
void setup() {
Serial.begin(115200);
while (!Serial) { delay(10); }
Wire.begin(21, 22); // SDA = GPIO 21, SCL = GPIO 22
if (!rtc.begin()) {
Serial.println("Couldn't find DS3231 RTC module!");
while (1) delay(10);
}
if (rtc.lostPower()) {
Serial.println("RTC lost power, setting time to compilation time!");
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
}
void loop() {
DateTime now = rtc.now();
char buffer[30];
snprintf(buffer, sizeof(buffer), "%04d-%02d-%02d %02d:%02d:%02d",
now.year(), now.month(), now.day(),
now.hour(), now.minute(), now.second());
Serial.print("Current Time: ");
Serial.print(buffer);
Serial.print(" | Temp: ");
Serial.print(rtc.getTemperature());
Serial.println(" °C");
delay(1000);
}
Bibliotecas necessárias: RTClib 2.1.4
Wiring diagram and example code generated by Codey.online — https://www.codey.online
Módulo de relógio em tempo real com o chip DS3231 (. Este módulo garante que o Arduino saiba a hora exata em qualquer momento. Ao ligar o Arduino ao pino ´sqw´, é possível gerar uma interrupção a cada segundo com a qual valores de sensores ou um display podem ser acionados.
Comunicação: interface I2C.
Mantém a hora com precisão, mesmo quando o módulo não está ligado (bateria de backup)
Ano - mês - dia hora : minuto : segundo
Ligação para trigger externo com intervalo (1Hz, 4kHz, 8kHz, 32kHz)
56 Bytes de memória não volátil
Maior precisão do que o DS1307
Chip de memória extra: AT24C32 (32K bytes)
Sensor de temperatura integrado (desvio de ±3 °C)
É fornecido sem bateria
Nota: use bateria recarregável LIR2032
Dimensões
Comprimento: 3,9cm
Largura: 2,2cm
Altura: 1,2cm

| Dimensões | 3,9 x 2,2 x 1,2 cm |
|---|---|
| Interface | I2C |
| Memória | 56 bytes |
| Chip de memória extra | AT24C32 |
| Desvio de temperatura | ±3 °C |
Bom produto
Não ficas satisfeito? Tens 30 dias após a receção para devolver o produto.
Tudo sobre devoluções
Módulo de relógio em tempo real DS3231 I2C (RTC de alta precisão)