

This instructable illustrates a few things:



Step 1: Parts

For this Instructable, you will need:

1 Arduino (I used an Arduino-nano)
many jumper wires
1 button




Step 2: About the LTC-617 Clock Display




Here is a good link explaining how the decoder chip works: http://www.doctronics.co.uk/4511.htm


Step 3: Make the connections





LTC - Arduino
1 - nc
2 - nc
3 - nc
4 - d7
5 - d3
6 - d2
7 - d11
8 - d10
9 - d4
10 - gnd
22 - d9
23 - d5
24 - d6
26 - d8
27 - d12
28 - A1
29 - gnd

5v - button - A4 - 10k resistor - gnd



Step 4: Install (upload) the software


Viola - we have a clock!


The centre hour:minute colon blinks for the seconds.







here are the wiring instructions if some one (like me) does not have the ltc-617. <br>A d7 <br>B d8 <br>C d9 <br>D d10 <br>E d11 <br>F d12 <br>G A0 <br>Colon d4 <br>digit1 d2 <br>digit2 d3 <br>digit3 d5 <br>digit4 d6
<p>i have a bunch of autonomous clock displays (they work stand alone as a clock). model LTC 6305PDA2 and my question is why to use an arduino ? what offers?</p><p>thanks</p>
The Arduino allows a lot of smart features to be added.<br><br>As a clock, this Arduino version is probably not as good as even an inexpensive store bought clock.<br><br>It's like using an Arduino to light an LED - lots of cheap flashlights give much better lighting!<br><br>Adding the Arduino, or any other micro-controller, allows you to add more capabilities For example, you could add different sounds for hourly chimes or web-enabled alarms. Maybe add a wake-up light.<br><br>Or the clock could be just a small part of a bigger project, like a sprinkler controller.<br><br>I've used it as the basis for my &quot;crazy countdown timer&quot;. http://www.instructables.com/id/Crazy-Countdown-Timer/<br><br>Cheers,<br>-Nico<br>
i have completed this instructable using 4 7 segment screens, <br>i have also modified the code, so it's 24 hour clock. <br>if anyone wants the new code, let me know. <br>Great instructable BTW.
Hi Jukees, <br>sure, can you send me your code for the 24H, do you have a schematics as well? <br>have you implemented RTC? <br>tnx so much <br>Amos
<p>if you wan't implement RTC check this : http://www.instructables.com/id/Arduino-based-clock/</p>
Great job, Jukees!! <br>Thanks for sharing the picture :)
Hi <br>I did some tests, with <br> lastTime += 998;, <br>there is no further delay, I can make the circuit. <br> <br>I changed the polarity of the display by changing <br> <br>#define ON HIGH <br>#define OFF LOW <br> <br>by <br> <br>#define ON LOW <br>#define OFF HIGH <br> <br>it's easier than taking all lines &quot;digitalWrite&quot; <br> <br>Thank you again for this great subject. <br> <br>Jo&euml;l
Excellent, that's good to know. <br> <br>ps, the millis() call resets back to 0 after about 50 days, which I think will cause this clock to just stop at that point.
Hi Nico <br>Thank you for your answer, I think has a RTC but I wanted to test this clock because I could make a miniature circuit. Essary your suggestion I'll thank you again. <br> <br>Good lock <br>Jo&euml;l
Hello, <br> <br>Super thank you project! <br> <br>I had already changed the code to pass a 24h everything is ok apart my clock takes about 2 minutes late around 7am. I'm searching I can not find the solution, someone else will this problem? <br> <br>Thank you in advance
Hi Jojox,<br><br>The basic timing on the Arduino isn't designed to keep time accurately, unfortunately.<br><br>You can keep accurate time by using a Real Time Clock (RTC) unit and the Arduino Time library, but this project isn't set up to use that.<br><br>You could make the clock run faster by changing the &quot;1000&quot; to a lower value for this line:<br><br> lastTime += 1000;<br><br>So you might try using 998 or 999.<br>Or every minute include an adjustment to add or subtract from lastTime.<br><br>Good luck, and enjoy :)<br>Cheers,<br>-Nico
Nice Thanks Jukees
Will you post the code for 24 hours clock, please ?? <br>And if you have the diagram on how you connect the 7 seg display ?? <br>Thanks
/* <br> Arduino clock on a standard 4-digit clock display <br> Uses a Liteon LTC-617D1G clock display <br> <br> Connections: <br> LTC - Arduino <br> 1 - nc <br> 2 - nc <br> 3 - nc <br> 4 - d7 <br> 5 - d3 <br> 6 - d2 <br> 7 - d11 <br> 8 - d10 <br> 9 - d4 <br> 10 - gnd <br> 22 - d9 <br> 23 - d5 <br> 24 - d6 <br> 25 - A0 // because d13 already has a built-in LED getting in the way <br> 26 - d8 <br> 27 - d12 <br> 28 - A1 <br> 29 - gnd <br> <br> button: <br> 5v - button - A4 - 10k resistor - gnd <br> <br>*/ <br> <br>#define DIGIT1 2 <br>#define DIGIT2 3 <br>#define DIGIT3 5 <br>#define DIGIT4 6 <br> <br>#define SEGMENTA 7 <br>#define SEGMENTB 8 <br>#define SEGMENTC 9 <br>#define SEGMENTD 10 <br>#define SEGMENTE 11 <br>#define SEGMENTF 12 <br>#define SEGMENTG A0 <br> <br>#define COLON 4 <br>#define AMPM A1 <br> <br>#define BUTTON A4 <br> <br>#define ON HIGH <br>#define OFF LOW <br> <br>#define DELAYTIME 50 <br> <br>unsigned short hours, minutes, seconds; <br>boolean pm; <br>unsigned long lastTime; // keeps track of when the previous second happened <br> <br>int buttonState; // the current reading from the button pin <br>int lastButtonState = LOW; // the previous reading from the button pin <br>unsigned long button_down_start = 0; // how long the button was held down <br>unsigned long lastDebounceTime = 0; // the last time the output pin was toggled <br>unsigned long debounceDelay = 50; // the debounce time <br> <br>void setup() { <br> // initialize all the required pins as output. <br> pinMode(DIGIT1, OUTPUT); <br> pinMode(DIGIT2, OUTPUT); <br> pinMode(DIGIT3, OUTPUT); <br> pinMode(DIGIT4, OUTPUT); <br> <br> pinMode(SEGMENTA, OUTPUT); <br> pinMode(SEGMENTB, OUTPUT); <br> pinMode(SEGMENTC, OUTPUT); <br> pinMode(SEGMENTD, OUTPUT); <br> pinMode(SEGMENTE, OUTPUT); <br> pinMode(SEGMENTF, OUTPUT); <br> pinMode(SEGMENTG, OUTPUT); <br> <br> pinMode(COLON, OUTPUT); <br> pinMode(AMPM, OUTPUT); <br> <br> // button is input <br> pinMode(BUTTON, INPUT); <br> <br> // set the initial time <br> hours = 9; <br> minutes = 7; <br> seconds = 0; <br> pm = true; <br> <br> lastTime = millis(); <br>} <br> <br>void loop() { <br> <br> // Keep showing the display while waiting for timer to expire <br> while (millis() - lastTime &lt; 1000) { <br> clock_show_time(hours, minutes); <br> <br> // blink the colon, every even second <br> if (seconds % 2 == 0) { <br> clock_show_colon(); <br> } <br> <br> // button presses increase minutes <br> int reading = digitalRead(BUTTON); <br> <br> // If the switch changed, due to noise or pressing: <br> if (reading != lastButtonState) { <br> // reset the debouncing timer <br> lastDebounceTime = millis(); <br> } <br> <br> if ((millis() - lastDebounceTime) &gt; debounceDelay) { <br> // whatever the reading is at, it's been there for longer <br> // than the debounce delay, so take it as the actual current state: <br> <br> if (buttonState != reading) { <br> button_down_start = millis(); // record the start of the current button state <br> } <br> <br> buttonState = reading; <br> <br> // buttonState is now either on or off <br> if (buttonState == HIGH) { <br> // if the button was held down more than 5 seconds, make it go faster <br> if ((millis() - button_down_start) &gt; 5000) { <br> seconds += 10; <br> if (seconds &gt; 59) seconds = 59; <br> } <br> <br> // button has been pressed <br> incrementTime(); <br> } <br> } <br> <br> lastButtonState = reading; <br> } <br> <br> lastTime += 1000; <br> <br> incrementTime(); <br>} <br> <br>// <br>// a call to incrementTime increases time by one second. <br>// <br>void incrementTime() { <br> <br> if (seconds == 59) { <br> seconds = 0; <br> <br> if (minutes == 59) { <br> minutes = 0; <br> <br> if (hours == 23) { <br> hours = 0; <br> } <br> else { <br> hours++; <br> <br> if (hours == 12) { <br> pm = !pm; <br> } <br> } <br> } <br> else { <br> minutes++; <br> } <br> } <br> else { <br> seconds++; <br> } <br>} <br> <br>// <br>// clock_show_time - displays the given time on the clock display <br>// Note that instead of hr/min the user can also send min/sec <br>// Maximum hr is 99, Maximum min is 59, and minimum is 0 for both (it's unsigned, heh). <br>// <br>void clock_show_time(unsigned short hours, unsigned short minutes) { <br> unsigned short i; <br> unsigned short delaytime; <br> unsigned short num_leds[10] = { 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 }; <br> unsigned short digit[4]; <br> unsigned short hide_leading_hours_digit; <br> <br> // convert minutes and seconds into the individual digits <br> // check the boundaries <br> if (hours &gt; 99) hours = 99; <br> if (minutes &gt; 59) minutes = 59; <br> <br> // convert hr <br> if (hours &lt; 10 &amp;&amp; hours &gt; 0) { <br> hide_leading_hours_digit = 1; <br> } <br> else { <br> hide_leading_hours_digit = 0; <br> } <br> <br> digit[0] = hours / 10; <br> digit[1] = hours % 10; // remainder <br> digit[2] = minutes / 10; <br> digit[3] = minutes % 10; // remainder <br> <br> for (i = hide_leading_hours_digit; i &lt; 4; i++) { <br> clock_all_off(); <br> clock_show_digit(i, digit[i]); <br> <br> // fewer leds = brighter display, so delay depends on number of leds lit. <br> delaytime = num_leds[digit[i]] * DELAYTIME; <br> delayMicroseconds(delaytime); <br> } <br> <br> clock_all_off(); <br> <br> if (pm) { <br> clock_show_ampm(); <br> } <br> <br> clock_all_off(); <br>} <br> <br>// <br>// clock_all_off - turns off all the LEDs on the clock to give a blank display <br>// <br>void clock_all_off(void) { <br> <br> // digits must be ON for any LEDs to be on <br> digitalWrite(DIGIT1, OFF); <br> digitalWrite(DIGIT2, OFF); <br> digitalWrite(DIGIT3, OFF); <br> digitalWrite(DIGIT4, OFF); <br> <br> // segments must be OFF for any LEDs to be on <br> digitalWrite(SEGMENTA, ON); <br> digitalWrite(SEGMENTB, ON); <br> digitalWrite(SEGMENTC, ON); <br> digitalWrite(SEGMENTD, ON); <br> digitalWrite(SEGMENTE, ON); <br> digitalWrite(SEGMENTF, ON); <br> digitalWrite(SEGMENTG, ON); <br> <br> // turn off colon and alarm too <br> digitalWrite(COLON, OFF); <br> digitalWrite(AMPM, OFF); <br>} <br> <br>// <br>// clock_show_digit - turns on the LEDs for the digit in the given position <br>// position can be from 0 through 3: 0 and 1 being the hour, 2 and 3 being the seconds <br>// value can be from 0 through 9, ie, a valid single digit. <br>// <br>// (if value is out of range, it displays a 9. if digit is out of range display remains blank) <br>// <br>void clock_show_digit(unsigned short position, unsigned short value) { <br> byte a; <br> byte b; <br> byte c; <br> byte d; <br> byte e; <br> byte f; <br> byte g; <br> <br> switch (position) { <br> case 0: <br> digitalWrite(DIGIT1, ON); <br> break; <br> case 1: <br> digitalWrite(DIGIT2, ON); <br> break; <br> case 2: <br> digitalWrite(DIGIT3, ON); <br> break; <br> case 3: <br> digitalWrite(DIGIT4, ON); <br> break; <br> } <br> <br> a = !(value == 1 || value == 4); <br> b = !(value == 5 || value == 6); <br> c = !(value == 2); <br> d = !(value == 1 || value == 4 || value == 7); <br> e = (value == 0 || value == 2 || value == 6 || value == 8); <br> f = !(value == 1 || value == 2 || value == 3 || value == 7); <br> g = !(value == 0 || value == 1 || value == 7); <br> <br> if (a) digitalWrite(SEGMENTA, OFF); <br> if (b) digitalWrite(SEGMENTB, OFF); <br> if (c) digitalWrite(SEGMENTC, OFF); <br> if (d) digitalWrite(SEGMENTD, OFF); <br> if (e) digitalWrite(SEGMENTE, OFF); <br> if (f) digitalWrite(SEGMENTF, OFF); <br> if (g) digitalWrite(SEGMENTG, OFF); <br>} <br> <br>// <br>// clock_show_colon - shows the colon that separates minutes from seconds <br>// <br>void clock_show_colon(void) { <br> unsigned short delaytime; <br> <br> digitalWrite(COLON, ON); <br> // 2 leds = 2 delays needed <br> delaytime = DELAYTIME * 2; // must use variable to have similar delay to rest of clock <br> delayMicroseconds(delaytime); // because use of variable slows it down slightly. <br> digitalWrite(COLON, OFF); <br>} <br> <br>// <br>// clock_show_alarm - shows the ampm dot (bottom right of clock display) <br>// <br>void clock_show_ampm(void) { <br> unsigned short delaytime; <br> <br> digitalWrite(AMPM, ON); <br> <br> delaytime = DELAYTIME; // must use variable to have similar delay to rest of clock <br> delayMicroseconds(delaytime); // because use of variable slows it down slightly. <br> digitalWrite(AMPM, OFF); <br>} <br> <br> <br>The led wiring instructions are the ones written in my comment which you replied, Segments in the led are A B C D E F G, and in the led datasheet you can see what pin is what segment.
Hey, <br> <br>I want to create your clock and your delightful countdown timer, but I can't seem to find the display you specify anywhere. Any tips on where I might get one or an equivalent replacement?
Hi RebelWithoutASauce (great name btw!), <br> <br>I got mine from Jameco.com as part of a &quot;grab bag&quot; of displays: http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_18201_-1 <br> <br>I don't see the ltc617 clock display listed anywhere though, which means its likely outdated and probably why they stuffed it in a grab bag. <br>It's a common anode display, so another common anode clock display would work (although I can't find too many of those either). Here is one at Jameco that would do the trick, but you'd have to move a few wires: http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_1956549_-1 <br>I saw some on eBay too, but they didn't have pins to light the dots for the clock. <br> <br>I'm sure other clock displays would work just as well, but may require the wires to be hooked up differently. My first thought was that taking apart an old clock radio would likely work. <br> <br>The display is pretty basic though - no special ICs in it, just direct connections to each individual LED. In a pinch you could even line up a bunch of individual digits up and connect up the anodes to make them &quot;common&quot; to match the ltc617 spec sheet. <br> <br>Cheers, <br>-Nico <br>

About This Instructable




Bio: Hi There! I'm a mobile app developer (iPhone and Android) in British Columbia, Canada. I also write firmware, and enjoy dabbling with electronic circuits ... More »
More by ntewinkel:Arduino Nano with WIZ550io = Easy Internet Arduino Echo Locator Crazy Countdown Timer 
Add instructable to: