The modules needed for this setup are the following:
- Arduino UNO (or any Arduino board)
- Real Time Clock (RTC) DS1302 Module
- OLED (I use the 0.96 128×64 i2c module
Let’s take a look at this RTC Module’s pinout:
- VCC – connects to Arduino’s VCC
- GND – connects to Arduino’s GND
- CLK – connects to Arduino’s Digital Pin 6
- DAT – connects to Arduino’s Digital Pin 7
- RST – connects to Arduino’s Digital Pin 8
The OLED’s pinouts are the following. Usually when a module is using i2c, it will have four (4) pins:
- GND – connects to Arduino’s GND
- VCC – connects to Arduino’s VCC
- SCL – connects to Arduino’s A5 pin
- SDA – connects to Arduino’s A4 pin
Now we connect some jumper wires to the modules. I used female to male jumper wires. Though you can use any wire colors, I make it a personal standard to use red for VCC (+5V) and black for ground:
For the OLED module:
- GND – black female to male jumper wire
- VCC – red female to male jumper wire
- SCL – yellow female to male jumper wire
- SDA – blue female to male jumper wire
For the RTC DS1302 module:
- VCC – red female to male jumper wire
- GND – black female to male jumper wire
- CLK – orange female to male jumper wire
- DAT – yellow female to male jumper wire
- RST – blue female to male jumper wire
Connect the OLED module’s jumper wires to the Arduino board. Refer to the pinouts stated above.
Connect the RTC module’s jumper wires to the Arduino board, as mentioned above.
Now, the coding part begins. Before writing any code for our setup, download this library (MyRealTimeClock.zip) and add it to the Arduino IDE.
Compile and upload the following code below:
– Explain code here –
After uploading, the time (and other date-related values will be displayed to the OLED module, as seen below:
This is the complete setup, with my Arduino UNO clone:
This is the complete setup using my DIY Arduino on breadboard:
The RTC Module and the 0.96″ 128×64 i2c OLED module are purchased from ConnectedCities. Orders amounting to P500 above are eligible for FREE delivery!
– Explain code here –
Gee thanks
Where is the code ??????