Project showcase

Complete Digital Clock Including Alarm and Motion Sensor © CC BY-NC-ND

Complete Digital Clock including many features: Alarm, Temperature, Humidy, Dew Point, RTC and PIR (Presence Infrared Sensor).

  • 89 respects

Components and supplies

Apps and online services

About this project

Hello everybody,

I have done several designs of digital clocks for Arduino using LEDs and LCD displays, but this one is more special because I added other features like alarm and motion sensor (PIR).

Main features

  • PIR (Presence Infrared Sensor)
  • RTC (real-time clock)
  • Alarm
  • Temperature
  • Humidity
  • Water dew point
  • Encoder to set the time and alarm
  • Permanent memory for time and alarm data even when the power supply is off

Main functions of the PIR

  • Activates the display only when movement is detected around the clock.
  • Turns off the alarm if any movement is detected.

If you or your children have a deep sleep and it is difficult to wake up in the morning, this last function is perfect for you because the alarm remains activated with a noisy buzzing until the sensor detects the movement of your body.

You should definitely get out of bed and keep moving!

Shake your body!


1) Bill of Materials

  • Arduino UNO
  • Arduino NANO (optional)
  • Display CATALEX 4 digits x 7 segments (TM1637)
  • PIR sensor module
  • RTC module (DS1307)
  • Temperature & Humidity sensor module (DHT11)
  • Rotary Encoder Decoder module (KY-040)
  • Buzzer 5V
  • Sensor Shield for Arduino UNO (optional)
  • Sensor Shield for Arduino Nano (optional)
  • Wires
  • Protoboard (optional)

2) Assembly

The assembly of these components is very easy.

Just follow the assembly diagram and pay attention to the connections between the components.

Here is the summary of the main signal pins of the sensors and modules to be connected in the Arduino:

Components X Arduino Pin

  • Display DIO X Digital Pin #2
  • Display CLK X Digital Pin #3
  • Encoder SW X Digital Pin #4
  • Encoder DT X Digital Pin #5
  • Encoder CLK X Digital Pin #6
  • PIR X Digital Pin #7
  • Buzzer X Digital Pin #8
  • DHT11 X Digital Pin #10
  • RTC SDA X Analog Pin #A4
  • RTC SCL X Analog Pin #A5

Note: In the diagram is shown the Arduino Nano for an application in a more compact size, but in the photos you can see my prototype using an Arduino Uno and a Sensor Shield to facilitate the whole assembly, but of course you can use protoboards to connect All Components.

3) Setup

  • LED Display

When the digital clock is run and detect the presence of someone close to it, all features will be displayed on the LED Display for a period of two seconds of visualization for each one and according to the following sequence:

Time >> Temperature >> Humidity >> Dew Point

Symbols of:

  • 1) Time: Hours & Minutes
  • 2) Temperature: in degrees Celsius (ºC)
  • 3) Humidity: in percentage (%)
  • 4) Dew Point: in degrees Celsius, , but seen on the display with a different symbol to avoid confusion with the temperature feature.

Important: The LED display will continue to function only when someone is moving around the clock. If no movement is detected, the display will turn off.

  • Rotary Encoder & Switch

The use of rotary encoders reduces the amount of keys to the settings and also simplifies their functionality for users.

In this project the rotary encoder is used when necessary to set the time and the alarm as follows:

  • Press the encoder key once to initialize the settings.
  • Turn the encoder to set the alarm time
  • Press the encoder key once to go to the next step
  • Turn the encoder to set the alarm minutes
  • Press the encoder key once
  • Turn the encoder to turn the alarm on or off
  • Press the encoder key once to go to the next step
  • Rotate the encoder to set the
  • Press the encoder key once
  • Rotate the encoder to set the minutes of time
  • Press the encoder key once
  • Turn the encoder to turn the time settings on or off
  • Press the key once to complete the settings.

Note: The time and alarm settings are stored in the RTC memory. Even if you turn off the Arduino's power supply, the RTC will keep all data due to its own 3V battery in the module.

  • PIR

The PIR module has two keys for adjustment:

  • Sensitivity to presence (movements) around the sensor.
  • Time to keep the sensor on.

This both settings you can do as you prefer. Personally, I set the sensitivity to almost the maximum and I set the time to show all the features on the LED display only once (approximately 8 to 10 seconds).

  • Dew Point

This is important information that gives you an idea of the level of human comfort due to the temperature and humidity of the ambient air.

Definition (from Wikipedia):

"is the temperature at which airborne water vapor will condense to form liquid dew. A higher dew point means there will be more moisture in the air"

Dew Point greater than 20 °C (68 °F) is considered uncomfortable and greater than 22 °C (72 °F) is considered to be extremely humid."

Calculation (in degrees Celsius):

In this project I applied a simplified formula but with a pretty good approximation for personal uses:

Dew Point = Temperature - (100 - Humidity) / 5

  • Temperature Scale:

The program for this project uses the Celsius scale for temperature and this is the default for the DHT11 sensor.

If you prefer to see temperatures in degrees Fahrenheit, you should convert them as follows:

Fahrenheit = Celsius * 1.8 + 32

Custom parts and enclosures

User Guide for Display TM1637
User guide for display TM1637 (4 Digits X 7 Segments)


Schematic in PDF


Similar projects you might like

Digital Clock with Arduino, RTC and Shift Register 74HC595

Project tutorial by LAGSILVA

  • 75 respects

ThermoClock: An OpenSource Arduino UNO OLED Clock

Project tutorial by Konstantin Dimitrov

  • 46 respects

Weather Clock

Project showcase by Tittiamo

  • 28 respects

4-Stroke Digital Clock With Arduino

Project tutorial by LAGSILVA

  • 45 respects

Digital And Binary Clock With Two LED Matrix And RTC

Project tutorial by LAGSILVA

  • 46 respects

Tiny Calendar and Clock Featuring Moon Phase in a LED Matrix

Project in progress by LAGSILVA

  • 37 respects
Add projectSign up / Login