-
Notifications
You must be signed in to change notification settings - Fork 0
Home
ANANDHAKRISHNAN AJITH edited this page Jun 26, 2024
·
3 revisions
Welcome to the RTC-CLOCK- wiki!
This project uses an SSD1306 OLED display and a DS1307 Real-Time Clock (RTC) module to display the current date and time. The date and time can be updated via serial input.
- MICROCONTROLLER board (e.g., Arduino Uno , Esp8266, esp32)
- DS1307 RTC module
- SSD1306 OLED display
- Breadboard and connecting wires
Wire.h
RTClib.h
Adafruit_GFX.h
Adafruit_SSD1306.h
Refer to the Connection Guide below for detailed connections.
-
Install Libraries:
- Open the Arduino IDE.
- Go to
Sketch
->Include Library
->Manage Libraries
. - Search for and install the following libraries:
RTClib
Adafruit GFX Library
Adafruit SSD1306
-
Upload Code:
- Connect your Arduino board to your computer.
- Open the provided Arduino sketch.
- Select the appropriate board and port from the
Tools
menu. - Click on the upload button.
-
Setting the Time:
- Open the Serial Monitor (set baud rate to 115200).
- Enter the time in the format
YYYY MM DD HH MM SS
to set the RTC.
- The RTC module keeps track of the current date and time.
- The OLED display shows the current day, date, month, year, and time.
- The time is displayed in 12-hour format with AM/PM indication.
-
setup()
: Initializes the display and RTC module. -
loop()
: Continuously updates the display with the current date and time. -
displayTimeDate()
: Calculates and displays the current date and time on the OLED. -
setTimeFromSerial()
: Reads and sets the time from the serial input.
makefileCopy codeMON 28 Jun 2023 11:59:59 AM
- If the display doesn't turn on, check the connections and the I2C address.
- Ensure the RTC module is properly connected and the battery is installed.
OLED Pin AND RTC Pin -- | -- VCC | 5V GND | GND SCL | A5 [arduino] gpio105[esp8277] gpio22[esp32] SDA | A4 [arduino] gpio104[esp8277] gpio21[esp32] Connect the components as shown below: After connecting all components, upload the provided code to the Arduino. Open the Serial Monitor to set the initial time, and the current time and date should display on the OLED screen.