You are on page 1of 9

Home Sign Up!

Browse Community Submit


All Art Craft Food Games Green Home Kids Life Music Offbeat Outdoors Pets Photo Ride Science Tech

LED Binary Clock


by ElevenOf9 on September 23, 2009 Table of Contents LED Binary Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Intro: LED Binary Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 1: Parts / Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 2: Make PCBs & Program PIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 3: Solder bottom components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 4: Solder top components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 5: Solder display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Step 6: Finish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 2 2 4 4 5 5 6 6 6

http://www.instructables.com/id/LED-Binary-Clock/

Intro: LED Binary Clock


This is the second revision of my PIC based LED binary clock. The original version was the first PIC project I attempted, it used a PIC16F84A to do both the timekeeping and control the display matrix, unfortunately it didn't keep good enough time and gained about a minute every week. This second version is based around a PIC16F628A running at 4MHz to control the display, it also uses a DS1307 realtime clock chip to do the timekeeping. Every second the DS1307 sends a pulse to the PIC chip, the PIC then reads the internal time from the DS1307 over the I2C bus and then displays the time in binary on the LED display. The bottom row of LEDs display the seconds, the middle rows shows the minutes and the top row is for hours. The time displayed in the picture is 01100:010011:011011 or in decimal 12:19:27. The time is in 24 hour format so goes up to 10111:111011:111011 or 23:59:59 The PCB could be made double sided, or as I have done here single sided with 7 wire links soldered in place instead of the top copper layer. It has a 5 volt regulator so could be powered from any 9 - 15 volt DC power supply.

Step 1: Parts / Tools


As well as basic PCB making and soldering equipment you will need the following components: 1x PIC16F628A & programmer 1x DS1307 realtime clock chip 1x 32.768kHz watch crystal 3x BC548 (or similar) transistor 2x PTM pushbuttons 1x 78L05 regulator 2x 220uF electrolytic capacitors 17x Surface mount LEDs 1x DC power jack socket 5x 4.7K surface mount resistors 8x 100 ohm surface mount resistors 1x 2k surface mount resistor 12x zero ohm links (Or 11 zero ohm links and CR2016 backup battery) 1x 100nF surface mount capacitor 50cm single stranded bell wire 1x 9v - 15v DC power supply with DC jack

Step 2: Make PCBs & Program PIC


The first step is to make the PCBs, the PCB layout and schematics for the main clock and the display board are provided in Eagle format. The clock PCB is double sided, but the top layer consists simply of 7 links, this means that the PCB could also be made as a single layer with 7 wire links instead, this is the way I chose to make it as I cannot make double sided boards. The display PCB uses exclusively surface mount devices while the main clock PCB uses a mixture of surface mount and through-hole components. It is important to program the PIC chip with the hex file prior to soldering into the circuit as there are no ICSP connections on the board.

Image Notes

http://www.instructables.com/id/LED-Binary-Clock/

1. Surface Mount LEDs representing hours. Anode is on the left, cathode is on the right. 2. Surface Mount LEDs representing minutes. Anode is on the left, cathode is on the right. 3. Surface Mount LEDs representing seconds. Anode is on the left, cathode is on the right. 4. Zero ohm links 5. Zero ohm links 6. 100 ohm resistor 7. 100 ohm resistor 8. 100 ohm resistor 9. 100 ohm resistor 10. 100 ohm resistor 11. 100 ohm resistor 12. Solder a 2cm length of single core "bell wire" to each of these connectors, then solder these wires to the main clock PCB.

http://www.instructables.com/id/LED-Binary-Clock/

File Downloads

binclk3b.HEX (2 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'binclk3b.HEX']

Binary Clock Display - IH45a2.zip (22 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Binary Clock Display - IH45a2.zip']

Binary Clock 2.zip (63 KB) [NOTE: When saving, if you see .tmp as the file ext, rename it to 'Binary Clock 2.zip']

Step 3: Solder bottom components


Solder the 8 resistors, 1 capacitor and the zero ohm link / backup battery as shown to the bottom side of the main clock PCB.

Image Notes 1. 4.7K Resistor 2. 4.7K Resistor 3. 4.7K Resistor 4. 4.7K Resistor 5. 4.7K Resistor 6. 100nF Capacitor 7. Zero Ohm Link. This could be replaced by a 3v Battery like a CR2016 or CR2032 or similar to keep the internal clock running in the event of power being removed from the circuit so you wouldn't need to set the time again when power was reconnected.

http://www.instructables.com/id/LED-Binary-Clock/

8. 100 Ohm Resistor. 9. 100 Ohm Resistor. 10. Mistake on original PCB layout, 5v & 0V were reversed, this has been corrected on latest PCB layout revision. 11. 2K Resistor.

Step 4: Solder top components


Next solder the through hole components ensuring to orientate the 2 chips, the 2 capacitors and the regulator correctly.

Image Notes 1. PIC16F628A. Note orientation with notch facing the front of the board. 2. 2x PTM pushbuttons 3. DS1307 Realtime clock. Note orientation with notch facing the back of the board. 4. 32.768kHz watch crystal with metal can soldered to grounding point underneath the board. 5. BC548 Driver transistors for common anode rows 6. 78L05 5 volt regulator. Note orientation with flat side facing the right of the board. 7. 220uF 25 volt electrolytic capacitor. Note orientation with cathode facing front of board. 8. 220uF 25 volt electrolytic capacitor. Note orientation with cathode facing back of board. 9. DC jack socket. 10. Wire links, only used if making a single sided board. 11. Wire link, only used if making a single sided board.

Step 5: Solder display


For the display you need 17 surface mount LEDs, 6 100 ohm surface mount resistors, 11 zero ohm links and 9 2cm lengths of bell wire. Solder them to the PCB as per the diagram below, ensureing you solder the LEDs in the correct orientation. The display board shown here is a newer version than is used in the rest of the photos in this instructable, it has fewer resistors so is easier and cheaper to make. Care must be taken when mounting the zero ohm links (resistors with zero resistance) as there are tracks on the PCB running between the 2 solder pads, the links must be positioned so that neither of the metal terminals touch the PCB track between the pads.

Image Notes 1. Surface Mount LEDs representing hours. Anode is on the left, cathode is on the right. 2. Surface Mount LEDs representing minutes. Anode is on the left, cathode is on the right. 3. Surface Mount LEDs representing seconds. Anode is on the left, cathode is on the right. 4. Zero ohm links 5. Zero ohm links 6. 100 ohm resistor 7. 100 ohm resistor 8. 100 ohm resistor 9. 100 ohm resistor 10. 100 ohm resistor 11. 100 ohm resistor 12. Solder a 2cm length of single core "bell wire" to each of these connectors, then solder these wires to the main clock PCB.

http://www.instructables.com/id/LED-Binary-Clock/

Step 6: Finish
Solder the display PCB to the main clock PCB then all that is left is to connect the power. The PSU needs to be at least 9v DC and need only be rated at about 200mA or so, the centre connector of the DC jack needs to be positive and the outer should be 0v. Once the power is connected the clock should display 22:03:00 and immediately start counting the seconds. Then all that is left is to set the time, one of the buttons is used to set the minutes and the other sets the hours, as soon as either button is pressed it sets the seconds to 0 and increments the corresponding display by 1.

Related Instructables

Gear Clock by abbtech

3x3x3 LED Cube with optional pc-control (Photos) by martijn222

Christmas Led Tree(hapy new year 2011) (video) by macobt

led matrix project using shift register and pic16f628a micro by mansman

Digital Voltmeter by frank26080115

Simple JDM PIC Programmer by hosam_eldin

Comments
34 comments Add Comment

botronics says:

May 18, 2011. 11:40 PM REPLY I would like to make this small enough to make a pocket watch out of it. To save power, is there a way to have the leds come on only when needed? Maybe this would work: If power to the pic only is left off, will the correct time show when the pic is turned on for a moment? While all the time the DS1703 is always running in the background to keep the time base.

shuttleu93 says:
could you please draw up the schematic so it is easier to read please?

Nov 3, 2009. 3:23 PM REPLY

ElevenOf9 says:
Hi,

Nov 3, 2009. 3:46 PM REPLY

The schematic files were available in the zip files, but I have also uploaded them now as images to the instuctable for easier viewing.

dava_2 says:
.sch file isn't working with my software: ExpressSCH . I what soft was made this .sch?

Mar 17, 2011. 6:47 AM REPLY

http://www.instructables.com/id/LED-Binary-Clock/

ElevenOf9 says:
Hi, it was made in Eagle

Mar 17, 2011. 3:11 PM REPLY

dava_2 says:
Thank you, works now!

Apr 8, 2011. 12:47 AM REPLY

dava_2 says:
Anyone made PCB without those SMD components? If you are interested, I can make it..

Apr 8, 2011. 12:47 AM REPLY

pravardhan says:
Nice Idea. But, why are you using PIC16F628A instead of PIC16F84a?

Nov 5, 2009. 7:06 AM REPLY

There is no schematic in jpeg format in the ZIP files and the one given in the site does not have the values of the components....! And, is there any converter that can convert from Binary to Decimal? May be something like ADC (Analog to Digital Converter)???

merseyless says:

Nov 9, 2009. 2:27 AM REPLY the fact that the time reads out in binary is the desired affect, if this is not to your tast then you could easily reprogram the chip to output the time to the serial port of a LCD display. but if you where capable of doing this then you would probably be content with learning how to read the time in binary form to confuse your friends. 2 + 2 = 10 in base four, I'm fine!

sebborn says:
hi how long did it take to build it

Mar 21, 2011. 9:02 AM REPLY

ElevenOf9 says:
Hi, to actually assemble it only took a few hours.

Mar 24, 2011. 3:04 PM REPLY

merseyless says:
also, this project is pure genius!

Nov 9, 2009. 2:28 AM REPLY

ElevenOf9 says:
Hi,

Nov 5, 2009. 8:19 AM REPLY

The PIC16F84A does not have an internal oscillator so would need extra components compared to the PIC16F628A to get it to work, the 16F628A is also cheaper than the 16F84A. The compnents are listed in step 1 and steps 3, 4 & 5 show where they all go, but I'll try to get an updated schematic up in the next few days, I've only recently started using Eagle so I'm still finding my way around it. You could impliment circuitry so convert the output from binary to decimal, but that kind of defeats the object I had in mind. An ADC would not help in this respect, you would need a binary to decimal decoder. It would be much easier to write an alternate program for the PIC to get it to output the time in the format you want instead though.

sebborn says:
hi

Mar 21, 2011. 9:03 AM REPLY

moapz says:
thanks eleven. i create it again, with new parts. the new one,work well. thank you

May 7, 2010. 12:52 AM REPLY

Muzamil Ali says:


CAN YOU PLEASE SEND ME THE DETAILED NOTES OR CIRCUIT DIAGRAM OF THIS PROJECT...

Dec 28, 2010. 11:37 AM REPLY

moapz says:
hey. thank you for this. it's finished, and work well :) but after 2day , it's off :( and i don't know why it is not work ! all LEDz is off! i check voltages and it's good but i don't know why not work ! i changed all parts and create it again but not work !

Apr 19, 2010. 3:04 AM REPLY

http://www.instructables.com/id/LED-Binary-Clock/

ElevenOf9 says:

May 2, 2010. 2:09 PM REPLY Hmm, that's a tricky one, if it worked for 2 days then I don't see why it would suddenly stop then. The first one I made I put the voltage regularor in backwards but that only worked for a few seconds before it burnt out. If you measure the voltage accross pins 5 & 14 on the PIC chip you should have 5 volts. You asked in one of your other questions if you could use bell wire instead of the zero ohm links on the display PCB, if you did thta are you sure the wire isn't shorting out on the other tracks on the PCB? Try replacing the "1 second" LED (bottom right) to see if that makes any difference. Try replacing the 3 transistors. Th eone I made has been happily running for over a year now so I'm not sure what has gone wrong with yours, the only other thing I can think of is that there is a break in one of the tracks on the PCB, or a blob of solder is shorting something out.

dimjan says:
nice job good !!!!!!

Feb 26, 2010. 8:19 AM REPLY

moapz says:
can I use bell wire instead of zero ohm ? why zero ohm ?

Feb 1, 2010. 1:55 PM REPLY

ElevenOf9 says:

Feb 1, 2010. 2:10 PM REPLY Hi, yes you can use bell wire instead if you want, just make sure you don't short out the track that runs between the 2 contacts for each link. I used zero ohm links for 2 reasons, I think in this application they look neater than wire links and more importantly I have about 200 of them that I need to use up on something.

lachlanmiller says:

Jan 16, 2010. 5:06 PM REPLY Could you clarify the concept of operation, i don't understand, how you are able to individually address each led from the pic, im assuming that you dont need to, and with this combination at any given time, you can turn on the required combination of led's to display the time. could you explain this a little ?

ElevenOf9 says:
Hi,

Jan 19, 2010. 12:14 PM REPLY

The LEDs are multiplexed, so at any given time only 1 row is illumiated, the PIC is constantly turning each row on and off so fast that it looks as though all 3 rows are illuminated at the same time. All 17 LEDs are controlled by 6 data lines and 3 address lines. First of all the PIC loads the data for the seconds into PORTB, it then sets the address line for the seconds row high (turning on the LEDs) after a very brief pause it sets the address line for the seconds row low (turning off the LEDs). Then it loads the data for the minutes row into PORTB, turns on the minutes address line, paues, then turns it off again. The hours are displayed in the same way, then the whole process starts again. A good visual example of how to multiplex LEDs can be found here: http://www.franksworkshop.com.au/Electronics/RGB/RGB.htm I hope this helps.

frank the destroyer says:


hey use the atmega128 you can make it do some pretty nifty tricks when tied to the rs232r serial converter chip !

Nov 19, 2009. 2:07 PM REPLY

mr monoply33 says:
& bookmarked.

Nov 5, 2009. 12:22 PM REPLY

Rob K says:
Interesting.

Oct 28, 2009. 11:58 PM REPLY

You are setting the time to the clock chip with buttons instead of already already having the time set with the pic to the chip through a ICSP. Good for resetting time when the clock is too fast or too slow, or changing time zones. As for the time being to fast that might be a watch crystal tolerances error.

raykholo says:

Nov 5, 2009. 11:03 AM REPLY This gives me an interesting idea: if one were to mass produce these it might be better to add support for setting the time through another device and then connect it to this through a header/socket or maybe a set of pogo stick connectors so that the time can be set by touching a bundle of four, for example, onto printed contacts on the pcb itself. Bottom line: make an easily settable time-keeping circuit, and then just touch it onto the corner of a remade pcb for this project to set it should a lot be made...

http://www.instructables.com/id/LED-Binary-Clock/

ElevenOf9 says:

Oct 29, 2009. 12:50 PM REPLY When you press either of the buttons it causes the time to change in the PIC's memory, and if you hold the button down the PIC will continue to change the time, as soon as you let go of the button the PIC writes this new time value back to the realtime clock chip and then continues on as normal. The dafault time value of 22:03:00 which is automatically set when the clock if first powered on is just an arbitry value I chose and can easily be changed with the buttons. Oct 29, 2009. 1:24 AM REPLY

drj113 says:
Excellent work. I love the simple single sided look, as well as the extra display PCB.

I have had a PIC binary clock illuminating my room for a year or so now. It doesn't have a case either - There is something cool about the 'look inside' kind of project. Regarding the inaccuracy of your previous version, I have spent lots of time mucking around with clocks, and the technique I use to deal with crystal tolerances, is to add or subtract a 0.1 second every 10 minutes, or hour, or whatever time is needed to improve the accuracy. It takes a little while, and you need to keep accurate records, but in my case, the PIC 16F877 based Binary clock beside the bedside looses about a second every 2 months.

ElevenOf9 says:

Oct 29, 2009. 12:45 PM REPLY Thanks, I did try to do an automatic correction on it, but for some reason the rate at which it gained time was irregular so no matter what I tried I couldn't get it to keep good time. I seem to remember reading on one of the datasheets that running the 16F84A at 32kHz could cause the internal timer to behave unpredictably under certain circumstances but I have not been able to find that information again to confirm it. By the way, I really like your word clock, I'm tempted to make one myself but I don't have room in my house for yet another home made clock.

macobt says:
Good binary clcok,here is mine with PIC16F84 my blog with few binary clocks http://macoprojects.blogspot.com/

Oct 29, 2009. 9:17 AM REPLY

drj113 says:

Oct 29, 2009. 1:27 AM REPLY A technique I have used when there are no ICSP connections, is to use a short ICSP header cable, directly soldered onto the appropriate pins. That has saved me *many* times :-) Oct 28, 2009. 2:52 PM REPLY

Kiteman says:
Now you need some sort of case.

Actually (and this is a minor point, not meant to detract from a great project), if the LEDs faced "outwards" (away from the lower PCB), you could put it all in an opaque case, with holes drilled for the LEDs to shine through (although that's really just my personal aesthetic speaking there).

ElevenOf9 says:

Oct 28, 2009. 3:44 PM REPLY I did think about putting it in some sort of case, but I quite like the "bare bones" look it has, it makes it look a bit more geeky, but I suppose a binary clock is already quite geeky on it's own.

http://www.instructables.com/id/LED-Binary-Clock/