Introduction: Digital Clock Using Arduino
This is an arduino based 24 hour digital clock. It is externally powered by battery. There are three buttons (from left to right) for setting hours, minutes and start after time has been set.
Step 1: Material
You are going to need following material:
- 4 digit 7 segment display (Common Anode)
- 220 ohm resistors x10
- Male-Female and Male-Male connecting wires
- Soldering gun and soldering wire
- Push buttons x3
- 1k resistors x3
- Slide switch
- 9V DC battery
- LED(for seconds)
- Hardboard and some tools
Step 2: Designing,Cutting and Assembling.
The dimensions of all side are 4" x 3".
Top : 3" x 3".
Use a saw to cut the sides. use drill t drill holes for buttons and led. I used a flat head screwdriver and hammer to make hole for led display.
Once the holes are made and pieces are cut, glue the pieces together. Also make a hole at back for ON/OFF slider switch.
Now comes the soldering part. one side of each push button is connected to a single wire which is then connected to +5v. A 1k resistor is then attached with other leg. Other three terminals of resistors are then connected together and grounded.
Now connect the 4 digit 7 segment display to arduino using following scheme :
On arduino from 0 throught 7 connect A throught DP to 4 digit display i.e. 0 for A, 1 for B and so on. Use A1,A2,A3,A4 pins of arduino for D1(hh1),D2(hh2),D3(mm1),D4(mm2).
Connect pin 13 of ardunio to led.
Once everything has been done place the arduino with care inside the box. The bottom of the box has to made such that it can be easily opened and close for inside access.
Step 3: Coding
Use the arduino IDE to write the code. The code I am uploading is for 24 hours clock. The code uploaded i think need not to be explained cause i had coded it to be easily understandable. You can see that code is very simple and easy to understand.
The following variable scheme is used :
hh1 = D1 (Digit one of hour)
hh2 = D2 (Digit two of hour)
mm1 = D3 (Digit one of minute)
mm2 = D4 (Digit two of minute)
new_hh1 for hh1, new_hh2 for hh2, new_mm1 for mm1, new_mm2 for mm2 are made to for storing new values from time adjustment.
Once the time had been adjusted press the start button and clock will be started. I have tested the clock for 24 hours. It was working nice.
If you need any help of any kind please feel free to contact me. Any kind of suggestion will be appreciated.
Step 4: Comment and Follow
What I can ask you in return is please comment and follow....... :)
We have a be nice policy.
Please be positive and constructive.