• Skip to main content
  • Skip to primary sidebar

Homemade Circuit Projects

Get free circuit help 24/7

New Projects | Privacy Policy | About us | Contact | Disclaimer | Copyright | Videos | Circuits for Beginners | Basic Circuits | Hobby Projects | Transistor Circuits | LED Drivers 

You are here: Home / Arduino Engineering Projects / Digital Clock Circuit Using 16×2 LCD Display

Digital Clock Circuit Using 16×2 LCD Display

Last Updated on August 9, 2019 by Swagatam

caution electricity can be dangerous

The post explains how to make a simple digital clock using Arduino and a 16 x 2 LCD display.

Introduction

As an electronics enthusiast at a stage we would have thought, how to make a digital clock, especially who are interested in the field of digital electronics. In this article we are going to see how to make a digital clock and the design is so simple that a noob in Arduino can accomplish the project without any head ache.

This digital clock has just two main components, the Arduino and LCD display. The Arduino is the brain of the clock, which does mathematical and logical functions to updates the clock every second.

Prototype Image:

wire connection between the LCD and Arduino

The LCD screen is a standard 16 pin interfaced display. It has 16 rows and 2 columns, this means it can display 16 ASCII character in a row and it has two columns and that’s why it is called 16x2 display.

The wire connection between the LCD and Arduino is standard and we can find the similar kind of connections in most of the other Arduino-LCD based projects.

The potentiometer is used to adjust the contrast of the display.

The user must set this optimally so that the user can see the displayed digits/characters properly under all light situations.

There is backlight which enables the user to see the display during dark situation. The arduino can be powered externally from DC jack from 7 volt to 12 volt.

Circuit diagram:

potentiometer is used to adjust the contrast of the display.

ARDUINO PROGRAM CODE:

//-------- Program developed by R.GIRISH-------//
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
int h=12;
int m;
int s;
int flag;
int TIME;
const int hs=8;
const int ms=9;
int state1;
int state2;
void setup()
{
lcd.begin(16,2);
}
void loop()
{
lcd.setCursor(0,0);
s=s+1;
lcd.print("TIME:" );
lcd.print(h);
lcd.print(":");
lcd.print(m);
lcd.print(":");
lcd.print(s);
if(flag<12) lcd.print(" AM");
if(flag==12) lcd.print(" PM");
if(flag>12) lcd.print(" PM");
if(flag==24) flag=0;
delay(1000);
lcd.clear();
if(s==60) {
s=0;
m=m+1;
}
if(m==60)
{
m=0;
h=h+1;
flag=flag+1;
}
if(h==13)
{
h=1;
}
lcd.setCursor(0,1);
lcd.print("HAVE A NICE DAY");
//-----------Time setting----------//
state1=digitalRead(hs);
if(state1==1)
{
h=h+1;
flag=flag+1;
if(flag<12) lcd.print(" AM");
if(flag==12) lcd.print(" PM");
if(flag>12) lcd.print(" PM");
if(flag==24) flag=0;
if(h==13) h=1;
}
state2=digitalRead(ms);
if(state2==1) {
s=0;
m=m+1;
}
}
//-------- Program developed by R.GIRISH-------//

NOTE: The above program is verified and error free. In case you got any warning or error, please add the LiquidCrystal library manually.

Time setting:

There are two push button one for setting hours and another for setting for minutes. Pressing either one will increment the corresponding digits. For setting hours press hrs the button till the correct time displays, similarly for minutes.

NOTE:

· While setting time the keep the button depressed till the desired time reaches. Pressing the button momentarily may not change the time.

· Each digit gets incremented only second after second, this is because the whole loop of the program delayed for 1 second.

· The seconds’ digit goes from 01 to 60 and loops again and won’t display “00” as traditional digital clock does.

You'll also like:

  • 1.  Arduino LCD KeyPad Shield (SKU: DFR0009) Datasheet
  • 2.  Blinking an LED with Delay – Arduino Basics
  • 3.  SMS Based Pump Controller with Automatic Dry Run Shut Off
  • 4.  Joystick Controlled 2.4 GHz RC Car Using Arduino
  • 5.  Using Digital Potentiometer MCP41xx With Arduino
  • 6.  How to Send and Receive SMS Using GSM Modem

About Swagatam

I am an electronic engineer (dipIETE ), hobbyist, inventor, schematic/PCB designer, manufacturer. I am also the founder of the website: https://www.homemade-circuits.com/, where I love sharing my innovative circuit ideas and tutorials.
If you have any circuit related query, you may interact through comments, I'll be most happy to help!

Have Questions? Please Comment below to Solve your Queries! Comments must be Related to the above Topic!!

6 Comments
Newest
Oldest
Inline Feedbacks
View all comments

Primary Sidebar

Calculators

  • 3-Phase Power (15)
  • 324 IC Circuits (19)
  • 4017 IC Circuits (52)
  • 4060 IC Circuits (25)
  • 555 IC Circuits (98)
  • 741 IC Circuits (19)
  • Arduino Engineering Projects (83)
  • Audio and Amplifier Projects (114)
  • Battery Chargers (82)
  • Car and Motorcycle (94)
  • Datasheets (46)
  • Decorative Lighting (Diwali, Christmas) (33)
  • Electronic Components (100)
  • Electronic Devices and Circuit Theory (36)
  • Electronics Tutorial (116)
  • Fish Aquarium (5)
  • Free Energy (34)
  • Fun Projects (13)
  • GSM Projects (9)
  • Health Related (20)
  • Heater Controllers (29)
  • Home Electrical Circuits (102)
  • How to Articles (20)
  • Incubator Related (6)
  • Industrial Electronics (28)
  • Infrared (IR) (40)
  • Inverter Circuits (98)
  • Laser Projects (12)
  • LED and Light Effect (93)
  • LM317/LM338 (21)
  • LM3915 IC (25)
  • Meters and Testers (65)
  • Mini Projects (148)
  • Motor Controller (67)
  • MPPT (7)
  • Oscillator Circuits (26)
  • PIR (Passive Infrared) (8)
  • Power Electronics (34)
  • Power Supply Circuits (77)
  • Radio Circuits (10)
  • Remote Control (48)
  • Security and Alarm (61)
  • Sensors and Detectors (120)
  • SG3525 IC (5)
  • Simple Circuits (75)
  • SMPS (29)
  • Solar Controllers (60)
  • Timer and Delay Relay (53)
  • TL494 IC (5)
  • Transformerless Power Supply (8)
  • Transmitter Circuits (40)
  • Ultrasonic Projects (16)
  • Water Level Controller (45)

Calculators

  • AWG to Millimeter Converter
  • Battery Back up Time Calculator
  • Capacitance Reactance Calculator
  • IC 555 Astable Calculator
  • IC 555 Monostable Calculator
  • Inductance Calculator
  • LC Resonance Calculator
  • LM317, LM338, LM396 Calculator
  • Ohm’s Law Calculator
  • Phase Angle Phase Shift Calculator
  • Power Factor (PF) Calculator
  • Reactance Calculator
  • Small Signal Transistor(BJT) and Diode Quick Datasheet
  • Transistor Astable Calculator
  • Transistor base Resistor Calculator
  • Voltage Divider Calculator
  • Wire Current Calculator
  • Zener Diode Calculator

© 2023 · Swagatam Innovations

wpDiscuz