In this project, I will make Big Digital Clock using Arduino Atmega328p DS1307 DHT22 & 4 Digit 7 segment display made from normal LEDs. This clock is homemade with zero PCB.

Components for Digital Clock using Arduino
- ATmega32p Microcontroller
- DS1307
- Crystal 32.768KHZ & 16 MHz
- 4 Digit 7 segment Display (Ownmade)
- DHT22
- MicroUSB Pinout
- USB TTL
- Female Headers
- BC547 (4pcs)
- 10K Resistor (7 pcs)
- 5.1K
- 100 ohm /1W
- Push Button
- IC Base (8 & 28 pins)
- 0.1uf Ceramic Disk Capacitor
- Cr2032 Battery with holder
- Zero PCB (100 X 150 mm)
- RED Led (114 pcs)
- 2mm PVC Corrugated Sheet

What is Digital Clock?
The digital clock is a clock where time is shown in a digital 4 digit 7 segment display. In this clock time is very accurately calculated because of here Crystal is used.
What is 7 Segment Display?
7 Segment display is a special type of display mainly made of LEDs to show English Digits. Here no LCD or LED pixel-like display is used. We use cheap 5mm LED bulbs to make it. This display is mainly capable of showing English digits. Though many English alphabets it supports. This type of display mainly used in the digital clock for example in Railway station.
7 segment display have 7 segments i.e. A, B, C, D, E, F, G to show a digit.

How does 7 Segment display work?
In the display, we connect LEDs in parallel for a single segment. All the LED’s one leg i.e. Anode or Cathode is commonly connected.
When we send a voltage signal for the particular segment to glow it will light up only that segment.
Types of 7 Segment Display
There are mainly two types of 7 segments display.
Common Cathode 7 Segment Display
In this type of display, all the negative legs of the LEDs of a digit are connected to the Ground or negative point of a battery.

Common Anode 7 Segment Display
In this type of display, all the positive legs of the LEDs of a digit are connected to the Positive VCC or positive point of a battery.

How to make 4 digits 7 Segment Display at Home?
Here I have used 114 Red LEDs in making this display.

Connection of Common Anode 4 Digit Display
I have connected all the positive legs of one digit to all LEDs and took a wire out from it. So a total of 4 wires from 4 digits. I will connect it in Digital pins 1, 2, 3 & 4 of Atmega32p.
I have used 4 LEDs for all the segments. Then I have connected all the same segments of 4 digits with each other. That’s mean all the 4 A segments of 4 digits will be connected internally. In this way, a total of 7 wires will be coming out for segments i.e. A, B, C, D, E, F & G.

These 7 Wires I will connect with Digital pins 5, 6, 7, 8, 9, 10 & 11 of atmega32p Arduino IC.
Next, there are 2 single LEDs for Colon or Decimal points. From there 3 wires will come out i.e. 2 positive legs for 2 LEDs & one common Ground.
These two LED’s positive legs will be connected to Digital Pin 12 & 13 or Arduino atmega32p IC.
Atmega32p with Bootloader
The atmega32p Microcontroller here I am going is already bootloader loaded. So if you have newly purchased atmega32p make sure you have burned the bootloader in atmega32p.
Atmega32P Pinout

Digital Clock using Arduino Atmega328p Circuit Diagram
As discussed earlier in the circuit we have connected 4 digit pins between Digital 1 & 4. Segment pins are connected between digital pin 5 & 11. Colon LEDs are in digital pin 12 & 13. DHT22 Sensor data pin connected at the A1 pin.

Here we also made 5 pins opened via female headers for the code uploading. You may discard that if you upload the working code given below. I made this for experimenting with codes.
Required Libray for Digital Clock using Arduino
DHT22 Temperature & Humidity
I have used the DHT22 sensor to get the present temperature & humidity reading. This sensor gives very accurate data.
DS1307 RTC Module
To keep the real-time clock data when there is no external 5V DC power source, we used the DS1307 RTC module. In fact, I made my own module using DS1307 IC. There is also one crystal of 32.768 kHz & CR2032 battery needed to keep the clock up to date.
Code for Digital Clock using Arduino Atmega328p DS1307 DHT22
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | /*Digital Clock With Weather by somtips.com*/ #include "SevSeg.h" #include "RTClib.h" #include "DHT.h" DHT dht(A1, DHT22); RTC_DS1307 rtc; SevSeg sevseg; char daysOfTheWeek[7][12] = {"SUN", "NON", "TUE", "UED", "THU", "FRI", "SAT"}; char text[11][6] = {"TINE", "", "DATE", "", "", "YEAR", "", "TENP", "","HUND", ""}; int i = 0; unsigned long timer; DateTime now; void setup() { byte numDigits = 4; byte digitPins[] = {1, 2, 3, 4}; byte segmentPins[] = {5, 6, 7, 8, 9, 10, 11}; bool resistorsOnSegments = false; // 'false' means resistors are on digit pins byte hardwareConfig = COMMON_ANODE; // See README.md for options bool updateWithDelays = true; // Default 'false' is Recommended bool leadingZeros = true; // Use 'true' if you'd like to keep the leading zeros bool disableDecPoint = true; // Use 'true' if your decimal point doesn't exist or isn't connected sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments, updateWithDelays, leadingZeros, disableDecPoint); sevseg.setBrightness(90); dht.begin(); rtc.begin(); pinMode(12, OUTPUT); pinMode(13, OUTPUT); timer = millis() - 4000; } void loop() { now = rtc.now(); snprintf(text[1], 5, "%02d%02d", now.hour(),now.minute()); snprintf(text[3], 5, "%02d%02d", now.day(),now.month()); snprintf(text[4], 5, "%s", daysOfTheWeek[now.dayOfTheWeek()]); snprintf(text[6], 5, "%d", now.year()); float h = dht.readHumidity(); float t = dht.readTemperature(); String hu = String(h); hu.toCharArray(text[10], 5); t=t*10; String k = String(t); String r = k.substring(0,3)+"c"; r.toCharArray(text[8], 5); switch (i) { case 0: digitalWrite(12, HIGH); digitalWrite(13, LOW); break; case 1: digitalWrite(12, LOW); digitalWrite(13, LOW); break; case 2: digitalWrite(12, HIGH); digitalWrite(13, HIGH); break; case 3: digitalWrite(12, LOW); digitalWrite(13, LOW); break; case 4: break; case 5: break; case 6: break; case 7: break; case 8: break; case 9: digitalWrite(12, HIGH); digitalWrite(13, LOW); break; case 10: digitalWrite(12, LOW); digitalWrite(13, LOW); break; default: break; } if (millis() > (timer + 4000)) { switch(i); sevseg.setChars(text[i]); i++; if (i >= 11) i = 0; timer = millis(); } sevseg.refreshDisplay(); } |
Hex Code of Big Digital Clock using Atmega3282P
Code explains of Big Digital Clock using Arduino
Basically in the code, after every 4 seconds display changes its values from date, time, year, temperature & humidity.
Caution
Do not use the delay function with this 7 segment display. To use delays we used millis() function smartly in the main function inside for loop.
1 | if (millis() > (timer + 4000)) |
We have done all the required calculations and setting output in switch cases & all the output values kept in character array.
In the code, you may see I have written “N” in the place of “M”. This is not by mistake. Because 7 segment displays can not show alphabets like M, W, etc. as N nearly looks the almost same as M, I did it so. If you do not like it, you can skip it.
Project Outcome of Digital Clock using Arduino Atmega328p DS1307 DHT22

Here you can see in the image the time is showing in 24-hour format.
Video Tutorial for Digital Clock using Arduino
Conclusion
This may be a very cool project for college. You can make it very easily at home at very low cost.
You can add a 5V step-up circuit with lithium ion battery & TP4016 circuit to make it a rechargeable clock. Alternatively, you can attach a power bank to power up it. I use an old mobile charger to power it up.