SKU: OT2118-A47 Αριθμός είδους: NA509 EAN: 8324968584702
Μονάδα ρολογιού πραγματικού χρόνου με το chip DS3231 (. Αυτή η μονάδα εξασφαλίζει ότι το Arduino γνωρίζει την ακριβή ώρα ανά πάσα στιγμή. Συνδέοντας το Arduino στην ακίδα ´sqw´, είναι δυνατό να δημιουργείται μία διακοπή κάθε δευτερόλεπτο, με την οποία μπορούν να ενεργοποιηθούν τιμές αισθητήρων ή μια οθόνη.
Επικοινωνία: διεπαφή I2C.
Διατηρεί την ώρα με ακρίβεια, ακόμη και όταν η μονάδα δεν είναι συνδεδεμένη (εφεδρική μπαταρία)
Έτος - μήνας - ημέρα ώρα : λεπτό : δευτερόλεπτο
Σύνδεση για εξωτερική ενεργοποίηση με διάστημα (1Hz, 4kHz, 8kHz, 32kHz)
56 Bytes μη πτητικής μνήμης
Μεγαλύτερη ακρίβεια από το DS1307
Επιπλέον chip μνήμης: AT24C32 (32K bytes)
Ενσωματωμένος αισθητήρας θερμοκρασίας (απόκλιση ±3 °C)
Παραδίδεται χωρίς μπαταρία
Προσοχή, χρησιμοποιήστε επαναφορτιζόμενη μπαταρία LIR2032
Διαστάσεις
Μήκος: 3,9cm
Πλάτος: 2,2cm
Ύψος: 1,2cm
Έτσι συνδέεις το DS3231 Μονάδα Ρολογιού Πραγματικού Χρόνου I2C (RTC υψηλής ακρίβειας) σε ένα Arduino UNO ή ESP32, με ένα παράδειγμα sketch που μπορείς να ανεβάσεις αμέσως.
Αυτό το έργο συνδέει μια μονάδα RTC DS3231 υψηλής ακρίβειας με ένα Arduino Uno μέσω I2C. Το sketch ρυθμίζει το RTC στον χρόνο μεταγλώττισης αν έχει χαθεί η τροφοδοσία, και στη συνέχεια διαβάζει και εμφανίζει στο Serial Monitor κάθε δευτερόλεπτο τη μορφοποιημένη ημερομηνία, την ώρα και τις μετρήσεις του ενσωματωμένου αισθητήρα θερμοκρασίας.
/*
* ==================================================================
* 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);
}
Απαραίτητες βιβλιοθήκες: RTClib 2.1.4
Wiring diagram and example code generated by Codey.online — https://www.codey.online
Αυτό το project διαβάζει την τρέχουσα ημερομηνία, ώρα και εσωτερική θερμοκρασία από το module Real Time Clock DS3231 μέσω I2C. Συνδέστε το module στη γραμμή 3.3V του ESP32 και στα προεπιλεγμένα I2C pins, έπειτα ανοίξτε το Serial Monitor στα 115200 baud για να δείτε το 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);
}
Απαραίτητες βιβλιοθήκες: RTClib 2.1.4
Wiring diagram and example code generated by Codey.online — https://www.codey.online