RTC-moduuli DS3231-sirulla Arduinoon, I2C:llä ja varaparistolla.
SKU: OT2118-A47 Tuotenumero: NA509 EAN: 8324968584702 Sijainti: AD04.09
Vaihtoehto
DS1307 Reaaliaikakello-moduuli I2C (RTC hoge precisie)
€ 1,80
Katso tämä vaihtoehto
Näin kytket DS3231 reaaliaikakello-moduuli I2C (RTC korkea tarkkuus):n Arduino UNOon tai ESP32:een, mukana esimerkkisketsi, jonka voit ladata heti.
Tämä projekti yhdistää erittäin tarkan DS3231 RTC -moduulin Arduino Unoon I2C-väylän kautta. Sketch asettaa RTC:n käännösaikaan, jos virta on katkennut, ja lukee sekä tulostaa Serial Monitoriin joka sekunti muotoillun päivämäärän, kellonajan ja sisäänrakennetun lämpötila-anturin lukemat.
/*
* ==================================================================
* 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);
}
Tarvittavat kirjastot: RTClib 2.1.4
Wiring diagram and example code generated by Codey.online — https://www.codey.online
Tämä projekti lukee nykyisen päivämäärän, ajan ja sisäisen lämpötilan DS3231 Real Time Clock -moduulista I2C-väylän kautta. Kytke moduuli ESP32:n 3.3V-virtakiskoon ja oletusarvoisiin I2C-nastoihin, ja avaa sitten Serial Monitor 115200 baudilla nähdäksesi reaaliaikaisen aikaleiman.
/*
* ==================================================================
* 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);
}
Tarvittavat kirjastot: RTClib 2.1.4
Wiring diagram and example code generated by Codey.online — https://www.codey.online
Reaaliaikakello-moduuli DS3231-sirulla (. Tämä moduuli varmistaa, että Arduino tietää tarkan ajan milloin tahansa. Kytkemällä Arduino ´sqw´-nastaan, on mahdollista generoida joka sekunti keskeytys, jolla anturiarvoja tai näyttöä voidaan kutsua.
Kommunikointi: I2C-liitäntä.
Pitää ajan tarkasti, vaikka moduuli ei olisi kytkettynä (varaparisto)
Vuosi - kuukausi - päivä tunti : minuutti : sekunti
Liitäntä ulkoista triggeriä varten intervallilla (1Hz, 4kHz, 8kHz, 32kHz)
56 Bytes haihtumatonta muistia
Suurempi tarkkuus kuin DS1307
Lisämuistisiru: AT24C32 (32K bytes)
Sisäänrakennettu lämpötila-anturi (poikkeama ±3 °C)
Toimitetaan ilman paristoa
Huomaa käytä ladattavaa LIR2032-paristoa
Mitat
Pituus: 3,9cm
Leveys: 2,2cm
Korkeus: 1,2cm

| Mitat | 3,9 x 2,2 x 1,2 cm |
|---|---|
| Liitäntä | I2C |
| Muisti | 56 bytes |
| Lisämuistipiiri | AT24C32 |
| Lämpötilapoikkeama | ±3 °C |
Hyvä tuote
Etkö ole tyytyväinen? Sinulla on 30 päivää aikaa vastaanotosta palauttaa tuote.
Kaikki palautuksista
DS3231 reaaliaikakello-moduuli I2C (RTC korkea tarkkuus)