Arduino clock

Title: Arduino Clock Many of us uses watch in our hand and a wall clock in our homes. But we never have thought of making it by ourselves. In this blog we will learn to make a digital clock using Arduino and LCD display. We will talk about circuit and code algorithm. Firstly we should keep in mind that time cycle counts max at 60. So we have to code that way it goes zero after 60 for minute and second and for hour it should be 12 max as there are 12 hours in a clock cycle.

Arduino clock

Adruino based clock is one of the simple and easy practice project. In this projects we just have to interface LCD with arduino and make some basic algorith for seconds, minutes and hour timings. Here the counting becomes zero at 60 for seconds and minutes and for hour this limit is 12. we have to code accordingly so that the time can be displayed properly. 

Components Required:

  1. Arduino Nano
  2. 16X 2 LCD display
  3. 10K Resistor
  4. 10K variable resistor
  5. 5V DC power supply

Circuir diagram:

.

Code:

The circuit above is clear that we have 6 digital pins connected with LCD.  Now we can see that we are using 4 data pins for 4 bit data. Now we will go through codes and explanation. In codes we will first add the Liquid crystal library.

#include 
LiquidCrystal lcd( 13,11,6,5,4,3,);
Then we will take integer variable for second, minute and hour.
	int S =0;
int M =0;
int H =0;
 Then under “void setup()” we will add code for starting serial and LCD  function.
	void setup() 
               {
 	  lcd.begin(16, 2);
    	Serial.begin(9600)
               }
Now we will add loop functions under “void loop()”.
	void loop() {
  Serial.print(H);
  Serial.print(":");
  Serial.print(M);
  Serial.print(":");
  Serial.println(S);
  lcd.setCursor(0,0);
  lcd.print("TIME:");
  lcd.setCursor(0,1);
  lcd.print(H);
  lcd.print(":");
  lcd.print(M);
  lcd.print(":");
  lcd.print(S);
 S =S+1;
 M=M;
 H=H;
delay(1000);
lcd.clear(); 
if (S==60)
{
  S=0;
  M=M+1;
}
if (M==60)
{
  M=0;
  H =H+1;
}
if (H==12)
{
  H=0;
} 
}

In codes above we can see the counting” S “starts and limit is set 60 by code for it. Same is for “M” which is taken for minute and similarly for hour it is 12. When circuit is powered by cable the display starts from 0:0:0. After 60 seconds the second bar becomes zero and minute place increases by 1. Same is for the minute and hour. For hour it goes 12 max.

Applications:

  1. Time Management: Watch is important for planning daily tasks, meetings and events to keep good time.
  2. Synchronization: Clocks synchronize processes and products in industries such as manufacturing to ensure accuracy and efficiency.
  3. Navigation: The Global Positioning System (GPS) relies on the precise timing of the atomic clock to provide accurate location information for navigation.
  4. Communication: Telephone communication relies on synchronized clocks for data transmission and asynchronous communication.
  5. Financial Market: The right time is important in the financial market to ensure that business and the economy are fair.
  6. Transportation: On-time delivery and coordination of trains, flights and buses is time-dependent to ensure punctuality and safety.
  7. Health: Medical procedures, drug administration and patient care must be done in a timely and synchronous manner.
  8. Space Exploration: Clocks are essential for operating in space, guiding spacecraft and synchronizing studies on distant planets.
  9. Scientific research: High-performance clocks have been used in many experiments, including measuring the time dilation effect.
  10. Security Systems: Surveillance and security systems use clocks to timestamp events and assist in investigations.

Best projects in Bhilai, Chhattisgarh, India. Contact: 7067150002