element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
element14 presents
  • Challenges & Projects
  • More
element14 presents
e14 presents blogs How To Build An Arduino Clock
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join element14 presents to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: airbornesurfer
  • Date Created: 15 Sep 2020 11:57 PM Date Created
  • Views 2627 views
  • Likes 5 likes
  • Comments 3 comments
  • clock
  • arduino uno
  • project colortyme
  • diy clock
  • arduino
Related
Recommended

How To Build An Arduino Clock

airbornesurfer
airbornesurfer
15 Sep 2020
image
*****TITLE HERE*****

element14 presents  |  Matt Eargle's VCP Profile |  Project Videos

 

Clocks are a rite of passage for hardware hackers, and with this video you can start working on your DIY Clock merit badge using the Arduino platform to build a basic Arduino clock. This project builds on the Arduino Fortune Teller project and teaches programming concepts like timing and actively updating a display, so you can use it as a springboard for many more complicated projects!

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

PARTS/TOOLS:

https://www.newark.com/arduino/a000066/dev-board-atmega328-arduino-uno/dp/78T1601

https://www.newark.com/mikroelektronika/mikroe-55/display-board-lcd-2x16/dp/61W9875

https://www.newark.com/mcm/21-18938/breadboard-with-binding-posts630/dp/79X3923

https://www.newark.com/multicomp-pro/mccfr0w4j0221a50/carbon-film-resistor-220-ohm-250mw/dp/58K5029

https://www.newark.com/multicomp-pro/mccfr0w4j0103a50/carbon-film-resistor-10kohm-250mw/dp/58K5002

https://www.newark.com/adafruit/759/wire-gauge-28awg/dp/88W2571

https://www.newark.com/bourns/pdb181-k420k-103b/rotary-potentiometer-10kohm-17mm/dp/04B9684

https://www.newark.com/omron-electronic-components/b3f-4055-by-omz/switch-tactile-spst-no-50ma-though/dp/36K1872

 

THE CIRCUIT:

 

image

image

THE SKETCH:

//Projet ColorTyme
 //Phase 1: Simple LCD Clock
 //CC-BY-SA Matthew Eargle
 //AirborneSurfer.com
 //element14 Presents
#include "LiquidCrystal.h"
// Define LCD pins
 LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// initial Time display is 00:00:00 (24hr clock)
 int h=00;
 int m=00;
 int s=00;
// Time Set Buttons
 int button1;
 int button2;
 int hs=8;// pin 8 for Hours Setting
 int ms=9;// pin 9 for Minutes Setting
// Digital LCD Constrast setting
 int cs=6;// pin 5 for contrast PWM
 static int contrast=100;// default contrast
//Define current time as zero
 static uint32_t last_time, now = 0;
void setup()
 {
 lcd.begin(16,2);
 pinMode(hs,INPUT_PULLUP);
 pinMode(ms,INPUT_PULLUP);
now=millis(); // read RTC initial value
 analogWrite(cs,contrast);
 }
void loop()
 {
 // Update LCD Display
 // Print TIME in Hour, Min, Sec
 lcd.setCursor(0,0);
 lcd.print("Time ");
 if(h<10)lcd.print("0");// always 2 digits
 lcd.print(h);
 lcd.print(":");
 if(m<10)lcd.print("0");
 lcd.print(m);
 lcd.print(":");
 if(s<10)lcd.print("0");
 lcd.print(s);

 lcd.setCursor(0,1);// for Line 2
 lcd.print("SURF STD TIME");
while ((now-last_time) < 1000 ) // wait1000ms
 {
 now=millis();
 }
last_time=now; // prepare for next loop
 s=s+1; //increment sec. counting

 /*-------Time setting-------*/
 button1=digitalRead(hs);
 if(button1==0)
 {
 s=0;
 h=h+1;
 }
button2=digitalRead(ms);
 if(button2==0){
 s=0;
 m=m+1;
 }
analogWrite(cs,contrast); // update contrast
/* ---- manage seconds, minutes, hours am/pm overflow ----*/
 if(s==60){
 s=0;
 m=m+1;
 }
 if(m==60)
 {
 m=0;
 h=h+1;
 }
 if (h==25)
 {
 h=0;
 }
}

  • Sign in to reply

Top Comments

  • beacon_dave
    beacon_dave over 4 years ago +2
    airbornesurfer looks like you have a short circuit in the power rail in your schematic across pins 1 and 2 of the LCD display. Also pin 5 of the LCD display is floating in the schematic but wired to ground…
  • airbornesurfer
    airbornesurfer over 4 years ago in reply to beacon_dave +2
    Ah, good catch! Sometimes Fritzing makes/breaks connections like this behind my back Thanks for the heads-up; I'll have to go back and fix them when I get a minute!
Parents
  • beacon_dave
    beacon_dave over 3 years ago

    For those wanting a slightly larger Arduino time-keeping device, then perhaps take a look at the Carnegie Science Center's 'flip clock'.

     

    Interesting video by Doug DeHaven on its design and construction available here:

    https://vimeo.com/416043844/612a681800

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • beacon_dave
    beacon_dave over 3 years ago

    For those wanting a slightly larger Arduino time-keeping device, then perhaps take a look at the Carnegie Science Center's 'flip clock'.

     

    Interesting video by Doug DeHaven on its design and construction available here:

    https://vimeo.com/416043844/612a681800

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube