Built to order

Arduino Digital Clock with Temperature and Humidity Display using DS3231 and DHT22

This project builds an Arduino digital clock that shows accurate time from a DS3231 real-time clock, with temperature and humidity from a DHT22 sensor on the same 7-segment display. The clock keeps time through power cuts on a CR2032 backup cell, sounds an alarm with a snooze button, and dims its display automatically through an LDR in dark rooms. It demonstrates I2C communication, sensor interfacing, and display multiplexing in one compact build. Suitable for B.E./B.Tech final-year projects in Electronics, E&TC and Electrical.

Electronics / E&TC Arduino UnoDHT22 temperature · humidity sensorArduino IDE · C++ firmwareBreadboard · jumper wiringDS3231 RTC module I2CLDR light sensor buzzerCR2032 backup cellHardware
Arduino Digital Clock with Temperature and Humidity Display using DS3231 and DHT22 — project thumbnail preview
More project photos (2)

The problem

The Arduino Digital Clock with Temperature and Humidity Display using DS3231 and DHT22 is a bench-top clock that shows the time of day with the temperature and humidity of its room. A DS3231 real-time clock chip keeps the time, a DHT22 sensor measures the surrounding air, and a four-digit seven-segment display cycles between the clock reading and the environment readings. Ordinary wall clocks show only time, and ordinary room thermometers show only temperature, so checking both means consulting two separate devices. Many hobby clocks also lose their time at the first power cut, because they count time in the microcontroller itself and have no independent timekeeper. This build removes both gaps: the dedicated clock chip holds the time on a small backup cell even when the main supply is off, and the single display carries time, temperature, and humidity in rotation. The result is a practical daily-use device that also teaches three distinct embedded skills in one build.

How it works

The clock works as a loop in which the DS3231 always knows the time and the DHT22 periodically reports the room air, while the Arduino decides what the display shows and when the alarm should sound. At power-up the Arduino reads the current time and date from the DS3231 over I2C and starts the display cycle, showing the time first and then switching to temperature and humidity. Meanwhile the LDR reading is converted into a brightness level for the display, and the alarm time stored in firmware is compared with the clock reading once per second. When the alarm time matches, the buzzer sounds until it is acknowledged or snoozed, and the time-setting buttons let the user correct the clock or change the alarm without a computer. Because the DS3231 keeps counting on its backup cell during a power cut, the loop simply resumes with the correct time when power returns.

  1. The DS3231 counts time continuously on its temperature-compensated crystal oscillator, switching automatically to the CR2032 backup cell when the main supply drops.
  2. At power-up the Arduino reads hours, minutes, seconds, day, date, month, and year from the DS3231 over the I2C bus and initializes the display.
  3. The DHT22 is read at most once every 2 seconds, as its datasheet requires, and returns temperature in degrees Celsius and relative humidity in percent over a single data wire.
  4. The Arduino alternates the four-digit display between the time reading and the temperature and humidity readings, holding each view for a few seconds.
  5. The LDR voltage is sampled and mapped to a display brightness level, so the seven-segment display dims in a dark room and brightens in a lit room.
  6. Once per second the firmware compares the current time with the stored alarm time; on a match it drives the buzzer until the alarm is acknowledged.
  7. A snooze press silences the buzzer and re-arms it after the snooze interval, while a longer press cancels the alarm for the day.
  8. The three push buttons step through time-setting and alarm-setting modes, with the edited digit blinking until the setting is confirmed.

Tech stack:

  • Arduino Uno
  • DS3231 RTC module · I2C
  • DHT22 temperature · humidity sensor
  • 4-digit 7-segment LED display
  • LDR light sensor · buzzer
  • Arduino IDE · C++ firmware
  • Breadboard · jumper wiring
  • CR2032 backup cell
Parameter Value
Controller Arduino Uno (ATmega328P board)
Real-time clock DS3231 module · I2C address 0x68 (datasheet)
RTC accuracy ±2 ppm from 0 °C to +40 °C (datasheet)
RTC accuracy, extended range ±3.5 ppm from −40 °C to +85 °C (datasheet)
Calendar Leap-year compensation valid to year 2100 (datasheet)
Backup cell CR2032 cell · 3 V (design)
Temperature sensor DHT22 · −40 °C to +80 °C range (datasheet)
Temperature accuracy ±0.5 °C (datasheet)
Humidity range 0% to 100% RH (datasheet)
Humidity accuracy ±2% RH typical at 25 °C (datasheet)
Sensor sampling At most 1 reading per 2 seconds (datasheet)
Display 4-digit 7-segment LED display
Display views Time · temperature in °C · humidity in % RH (cycling)
Brightness control LDR-based · 4 brightness levels (design setting)
Alarm 1 alarm time · buzzer output
Snooze interval 5 minutes (design setting · adjustable in firmware)
User input 3 push buttons
Main supply 5 V DC via USB adapter (design)
Builder note On power loss the DS3231 keeps counting on its CR2032 cell, so the clock needs no re-setting when power returns; keep the I2C SDA and SCL wires short and do not share the DS3231 address 0x68 with another I2C device on the same bus

Project features

The Arduino digital clock combines four capabilities that make it more than a simple time display: battery-backed timekeeping that survives power cuts, live temperature and humidity sensing, a usable alarm with snooze, and a display that adjusts its own brightness to the room. The DS3231 real-time clock gives the project its accuracy, because a temperature-compensated crystal inside the chip measures its own temperature and trims the oscillator so the frequency stays stable as the room warms or cools. The DHT22 adds a second, independent measurement job, turning the clock into a small room monitor. The alarm and the LDR dimming then turn the display into something a person can actually live with: it wakes the user and stays readable at night without glaring. Together these four capabilities cover clock, sensor, output, and user-interface work in a single prototype that can be demonstrated on a table in any review room.

  • [Battery-backed DS3231 timekeeping] The DS3231 keeps seconds, minutes, hours, day, date, month, and year on its own chip, and a CR2032 cell keeps it counting while the main supply is off, so the clock shows the correct time again as soon as power returns.
  • [Temperature and humidity display] The DHT22 measures the surrounding air and the display alternates between the clock reading and the temperature in degrees Celsius with relative humidity in percent, giving a quick picture of room conditions.
  • [Alarm with snooze] One alarm time can be set from the push buttons, the buzzer sounds at the set time, and a snooze press silences the buzzer for a short interval before it sounds again.
  • [LDR auto-dimming display] An LDR senses room brightness and the firmware steps the seven-segment display brightness down in dark rooms and back up in bright rooms, so the display stays readable without glaring at night.
  • [Push-button time and alarm setting] Three push buttons set the hours and minutes and step through time-setting and alarm-setting modes, with the digit being edited blinking so the setting state is always visible.
  • [12/24-hour and date display modes] The clock can show time in 24-hour format and step through to a date display, so the calendar kept by the DS3231 is visible rather than hidden inside the chip.
  • [Simple, robust wiring] The DS3231 connects over two I2C wires and the DHT22 over a single data wire, keeping the wiring short, readable, and easy to explain during a demonstration.

What is included

  • Working Arduino digital clock prototype on a base board
  • Complete firmware source code with comments (Arduino IDE)
  • Circuit and wiring documentation (DS3231 I2C wiring, DHT22 single-wire wiring, display and LDR connections)
  • Component list with module names
  • Setup and demonstration instructions, including time-setting and alarm-setting steps
  • Project report PDF (background, working, specifications, limitations)
  • PPT presentation for final review
  • Viva Q&A preparation document (RTC, I2C, DHT22 sensing, display multiplexing, alarm logic)

Limitations & prerequisites

  • The DHT22 updates at most once every 2 seconds by its datasheet limit, so temperature and humidity readings lag sudden room changes by up to 2 seconds.
  • DHT22 readings carry datasheet tolerances of ±0.5 °C and ±2% RH typical at 25 °C, so the display is a room monitor, not a calibrated laboratory instrument.
  • The clock is mains/USB powered with only the RTC backed up: during a power cut the display and buzzer stop, and only timekeeping continues on the CR2032 cell.
  • The alarm is a buzzer on the prototype itself, with no phone notification, no network alert, and no remote control in the base build.
  • The four-digit display shows one view at a time, so time, temperature, and humidity are never all visible simultaneously.
  • The DS3231 backup cell eventually discharges and must be replaced; a dead cell means the time is lost at the next power cut.
  • This is an academic prototype, not a certified timekeeping or environmental monitoring instrument.

Frequently Asked Questions

Is this project suitable for a final-year project?

Yes, this project suits B.E. and B.Tech programs in Electronics, E&TC, and Electrical, because it combines a real-time clock, a digital sensor, a multiplexed display, and alarm logic in one demonstrable prototype. It gives the student genuine embedded topics to explain in a review, including I2C communication, sensor timing limits, display driving, and power-backup behaviour. The build is compact enough to carry into a demonstration room and complete enough to support a full report.

How does the clock keep time during a power cut?

The DS3231 chip keeps counting on its CR2032 backup cell whenever the main 5 V supply is absent, and it resumes normal operation from the correct time as soon as power returns. The display and buzzer stop during the outage, because only the clock chip is battery backed, but no re-setting is needed afterwards. That behaviour is the main practical advantage of a dedicated RTC over counting time inside the microcontroller.

What does the display show, and when?

The display cycles between the time reading and the environment readings, showing hours and minutes first and then temperature in degrees Celsius with humidity in percent. Each view is held for a few seconds before the display steps to the next one, so all three readings are visible in rotation. The LDR adjusts brightness throughout, dimming the display in dark rooms and brightening it again in lit rooms.

Can the alarm, display, or sensors be customized?

Yes, the alarm time, the snooze interval, and the display brightness levels are all firmware settings that can be changed for a specific requirement. A second alarm, a larger display, a different temperature sensor, or a date-first display order can also be added as customizations. Network features such as Wi-Fi time sync or phone alerts are not in the base build and would be separate additions.

What power supply does the clock need?

The prototype runs from a 5 V DC USB adapter, which powers the Arduino, the display, the DHT22, and the buzzer during normal use. A CR2032 coin cell backs up only the DS3231 clock chip, keeping time during outages without powering the display. The cell is a standard coin cell and can be replaced when it eventually discharges.

Components & software requirements
  • Arduino Uno
  • DS3231 RTC module · I2C
  • DHT22 temperature · humidity sensor
  • 4-digit 7-segment LED display
  • LDR light sensor · buzzer
  • Arduino IDE · C++ firmware
  • Breadboard · jumper wiring
  • CR2032 backup cell
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download free synopsis (PDF)

Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.

Get a quotation