Work Home lab & side projects

An Arduino clock with automatic daylight-saving adjustment

I built a clock that shows big digits, the temperature and the humidity, and moves itself forward and back for daylight saving time. A DS3231 keeps the time, and the Arduino applies the US rules.

Arduino daylight-saving clock A DS3231 real-time clock and a DHT22 temperature and humidity sensor feed an Arduino. The Arduino checks the US daylight-saving rules, converts to a 12-hour time without a leading zero, and draws the time, temperature and humidity on a 128 by 64 SSD1309 OLED over SPI. Standard time in, local time out DS3231 clock time, date, leap years DHT22 sensor °F and humidity Arduino US DST rule, +1 hour 12-hour, no leading zero SSD1309 OLED 128×64, over SPI big digits + readings
The clock chip keeps standard time. The Arduino adds the daylight-saving hour before drawing.

Results

128×64OLED pixels driving the big digits
2099year the DS3231 calendar runs through
2builds: 2023 original, 2025 SPI rebuild

The problem

Real-time clock modules keep time but do not apply daylight-saving rules, so the displayed time can be an hour off during daylight saving. My first adjustment also displayed 0:40 instead of 12:40.

What I did

  • A 128×64 SSD1309 OLED showing large 12-hour digits with no AM/PM, the leading zero blanked without shifting the other digits.
  • A DS3231 real-time clock for the time and date, which also handles leap years through 2099.
  • A DHT22 sensor reading temperature in °F and humidity, shown centered under the time.
  • Daylight-saving logic for the US rules, second Sunday in March to first Sunday in November, applied after reading the clock.
  • A 2025 rebuild over SPI, after an I2C scan found nothing at 0x3C or 0x3D and the seller's I2C jumper instructions didn't match the printed board.

What I took from it

My first time adjustment displayed 0:40 instead of 12:40, so I checked the hour boundaries. During the later SPI rebuild, I checked the board markings when they disagreed with the seller's instructions.

Privacy