LEVEL 2 REPORT
17 / 8 / 2024
Task 3 : Interfacing RTC time module with ESP32
The task integrates an Adafruit SSD1306 OLED display and an RTC DS3231 module to create a digital clock. The clock displays the current time and date on the OLED screen.
Components Used
1.ESP32 2.Adafruit SSD1306 OLED Display Screen Size: 128x64 pixels Interface: I2C
3.RTC DS3231 Module Function: Keeps track of the current time and date.
Libraries Included
1.SPI.h: Required for communication with the OLED display via SPI (though the code primarily uses I2C). 2.Wire.h: Used for I2C communication with the OLED display. 3.Adafruit_GFX.h: Provides graphics functions for the OLED display. 4.Adafruit_SSD1306.h: Specific functions for controlling the SSD1306 OLED display. 5.RTClib.h: Provides functions to interface with the DS3231 RTC module.
Process
1.Initialization: * The code starts by setting up communication with the computer and the devices. * It checks if the RTC (which keeps track of time) is connected properly. If it isn't, it prints an error message and stops. * It also initializes the OLED display. If the display setup fails, it prints an error message and stops.
2.Setting the Time: The RTC is set to the time when the code was compiled. This helps ensure the clock starts with the correct time.
3.Display Setup: The display is updated to show a welcome message ("Clock") for a few seconds, then clears the screen to prepare for showing the time.
Main loop
- Get Current Time: The code continuously retrieves the current time and date from the RTC module.
- Update the Display:
- The screen is cleared to prepare for the new time display.
- It shows the current seconds, minutes, and hours in a readable format.
- It also displays the current day, month, and year.
- Finally, it shows the day of the week (like Monday or Tuesday).
The code is designed to set up a clock on an OLED display using a real-time clock module, showing up-to-date time and date information.