0% found this document useful (0 votes)
45 views5 pages

EXPERIMENT8

Uploaded by

om raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views5 pages

EXPERIMENT8

Uploaded by

om raj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

To interface DS3231 with ESP8266

SOFTWARES USED 2210040117


OM RAJ
ESP8266 BOARD (Arduino IDE)
APPARATUS/ COMPONENTS REQUIRED

1. ESP8266
2. DS3231 RTC Module
3. Connecting Cables
4. DC 5V, 1A Power Adaptor

THEORY:
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 I²C 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.
Features:
1. Two Time-of-Day Alarms.
2. Digital Temp Sensor Output.
3. Register for Aging Trim.
4. DS 3231 RTC with 2032 Battery Holder.
5. Highly Accurate RTC Completely Manages All Timekeeping Functions.
6. 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.
7. Configurable I2C device Address for AT24C32 using SMD jumpers on PCB (A0, A1,
A2).
8. Programmable Square-Wave Output Signal.
9. Battery-Backup Input for Continuous Timekeeping.
10. Low Power Operation Extends Battery-Backup Run Time.

HARDWARE CONNECTION:
CODE/PROGRAM:-

#include "Arduino.h"
#include "uRTCLib.h"
// uRTCLib rtc;
uRTCLib rtc(0x68);
void setup() {
Serial.begin(9600);
Serial.println("Serial OK");
#ifdef ARDUINO_ARCH_ESP8266
URTCLIB_WIRE.begin(4, 5);
URTCLIB_WIRE.begin();
#endif
rtc.set(0, 50, 13, 6, 21, 1, 22);
//RTCLib::set(byte second, byte minute, byte hour, byte dayOfWeek, byte dayOfMonth, byte
month, byte year)
}

void loop() {
rtc.refresh();
Serial.print("RTC DateTime: ");
Serial.print(rtc.year());
Serial.print('/');
Serial.print(rtc.month());
Serial.print('/');
Serial.print(rtc.day());
Serial.print(' ');
Serial.print(rtc.hour());
Serial.print(':');
Serial.print(rtc.minute());
Serial.print(':');
Serial.print(rtc.second());
Serial.print(" DOW: ");
Serial.print(rtc.dayOfWeek());
Serial.print(" - Temp: ");
Serial.print(rtc.temp()/100);
Serial.println();
delay(1000);
}
PRECAUTIONS
1. Use insulation tools while you connect the Circuit.
2. Wear Good Insulating Shoes.
3. Avoid contacting circuits with wet hands or wet materials.
4. Maintain a work space clear of extraneous material such as books, papers, and clothes.
5. Be careful while connecting any actuators in 230V AC Mains.

Results
CHECK THE RESULT IN SERIAL MONITOR WITH 115200 BAUDRATE. The ESP8266
was programmed using the Arduino IDE to communicate with the DS3231 module over the I2C
protocol. The DS3231 provided accurate and reliable timekeeping, allowing the ESP8266 to
access real-time clock information.
OUTPUT :
HARDWARE :

You might also like