Arduino binary clock
Introduction
This project is an Arduino-based electronic clock that combines real-time timekeeping, environmental sensing, and battery-powered operation.
It uses the DS3231 RTC AT24C32 EEPROM module with a backup CR2032 battery to maintain accurate time even when external power is removed.
Temperature and humidity are measured using the DHT22 sensor (breadboard-friendly version), and all information is displayed on a 0.96" 128×64 I²C OLED screen.
The system is powered by a 4×AA battery pack, supplying approximately 6.7 V. Power is fed into the Arduino VIN pin, where the onboard regulator safely converts it to 5 V for the microcontroller and peripherals.
For displaying the time in binary system I use 11 LEDs (6 for minutes and 5 for hours)
Assembly
The complete wiring scheme is provided in the project files. Below is a summary of the key connections:
LED Array
Each LED represents a binary bit for hours or minutes.
Arduino Digital Pins (D2–D12) → 390 Ω resistor → LED anode (long leg)
LED cathode (short leg) → GND
DHT22 sensor
Breadboard-friendly DHT22 module:
⦁ + → 5 V
⦁ OUT → A0 (digital input pin)
⦁ - → GND
(Pull-up resistor is already integrated on the module.)
If using the bare 4-pin DHT22, add a 10 kΩ pull-up between VCC and DATA.
RTC Module (DS3231 + AT24C32)
Only four pins are required:
⦁ SCL → A5
⦁ SDA → A4
⦁ VCC → 5 V
⦁ GND → GND
OLED Display (0.96" I²C, 128×64)
⦁ SDA → A4
⦁ SCL → A5
⦁ VCC → 5 V
⦁ GND → GND
Shares the I²C bus with the RTC.
Power Supply
Powered by a 4×AA battery holder:
⦁ Red wire (+) → VIN
⦁ Black wire (–) → GND
The Arduino’s onboard regulator converts ~6.7 V from the batteries to a safe 5 V.
Code and Compilation
For the project, I have used these libraries:
Wire.h
Adafruit_GFX.h
Adafruit_SSD1306.h
Adafruit_Sensor.h
DHT.h
RTClib.h
I installed the required Arduino libraries through the terminal using the Arduino CLI.
(You can absolutely use the Arduino IDE instead; I just wanted to practice CLI workflows.)
Install Libraries via Terminal
arduino-cli lib install "Library Name"
Compiling with Arduino CLI
I installed Arduino CLI to compile the project from the terminal
(again — using the IDE is fine too).
Compile:
arduino-cli compile --fqbn arduino:avr:nano:cpu=atmega328old "path/to/your/folder"
Upload:
arduino-cli upload -p COM5 --fqbn arduino:avr:nano:cpu=atmega328old "path/to/your/folder"

