I was wandering the internet looking for a good arduino tutorial on how to build a binary clock with seconds, but I could not find one. So now I am  writing this for you to have a binary clock with seconds, minutes, and hours.

What I did:
-Because controlling 20 LEDs individually for this cube would be messy, I multiplexed.
-I used an ATtiny84 and a SN74HC164N to control the clock. This makes the clock cheaper and smaller.
-I built it all on two PCB boards and affixed a stand, power plug, and buttons.

Step 1: Parts List

Somethings you have to have to make a binary clock, others are optional and I will try to give you ideas to use what you have.

Required Parts:
-20 LEDs, any color I used 5mm I wouldn't recommend 10 unless you have the space
-6  PN2222 transistor, or any that you have that are simmilar
-2  push buttons, any flavor of interface you want to try would work buttons are easy
-2  1K resistors, for the buttons
-10 resistors for LEDs, i used 470ohm you could use as low 100ohm but they would be very bright at night
-various wire for connections

  -I used ATtiny84 and SN74HC164, I choose it because it was small, cheep, and easy to use with this option you will use the shift register to control one side of the LED matrix 
  -ATmega, any of this series would work as long as you have a programmer and the space
  -Arduino Board, I don't recommend spending the money on this option and it also takes up a lot of space
  -ATtiny with only 6 I/O if you use two shift registers
  -The library is written for arduino and feels free to use anything else that you would re-code
 *Use a DIP socket for whichever controller you choose to use.
  -I used USB charger and cable to power it
  -any 5V power supply would work, just make sure it works with your controller
  -Some type of board is needed. I used two small boards, 4cm x 6cm and 3cm x 7cm. I have seen cardboard used for the LEDs but i do not recommend cardboard for the controller.
  -I used polymorph, it's cool stuff to have around
  -origami would work


<p>so i got the programming to take i want to make sure that the pin 13 from the Atiny84 connects to pin 1 &amp; 2 on the second chip and does TL and BL of each button connect together</p>
<p>so i got the programming to take i want to make sure that the pin 13 from the Atiny84 connects to pin 1 &amp; 2 on the second chip and does TL and BL of each button connect together</p>
<p>how do you know if the programming took on the Atiny84 chip</p>
The first thing I always do with a new chip is run a blink program to test the programmer and microcontroller. Than if you see a blinking light it works. <br>One problem I had with the attiny a lot was the arduino being programmed and not the attiny. Sometimes the code would be on the arduino and I'd have to reinstall the isp file. <br>Hope that helps, if not I'd need more details on your situation.
<p>But that's not binary, it's BCD (Binary Coded Decimal)! Anyways, cool project!</p>
Looking at your schematic I don't see how you could turn on LED4 and LED8 without LED7 inadvertently powering on as well. It shares the power of LED4 and the ground of LED8 and will turn on too. What am I missing? That's just one example. Thanks.
I have built a few clocks. First time with Arduino. I used the 5v off the board to power clock and the Arduino board shuts off. Must be a short in the clock PCB? Any Ideas? <br>Thanks <br>Frank
Does the power light slowly turn off? Could be bad resistor, transistor, or LED. So test each of them individuality. <br>If plugged into the computer does it tell you the arduino is unplugged as soon as it is plugged in? Probably a short. Check with Ohm meter.
Hi sbbrain <br>I tested all the resistors and found R1 and R2 bad. I replaced them and now the Arduino does not shut down when I plug in the clock board. I tested all the LEDs and found them all ok. I have 5v at all the switch pins. No voltage at the LEDs or transistors. on the ATtiny I have 5v on pins 1,4,10,11 on the 74HC I have 5v on pin 9, 4v on pin 14 and 2.2v on pin 8 <br>I used ExpressPCB to make the PCB. From your schmatic i connected all GNDs to chassis ground and all the Vcc to 5v power from the Arduino board. On your schematic at pin 9 Vcc on 74HC there is a circle. Not sure what that means. I have 5v on all the switch pins <br> <br>Thanks for the help <br>Frank
Hi sbbrain <br>Hey thanks for the reply. The 'L' and 'ON' LEDs are on but when I plug the clock circuit in they waver and turn off and remain off until I disconnect the clock. I will check each resistor. I will check the clock circuit with an Ohm meter. <br>I downloaded your code to the ATtiny with no problems. I will let you know the outcome. <br>Frank
Multiplexing. The idea is to only allow one column to be grounded at a time. <br>So there are 6 columns and only one of them turns on at a time while the 4 anodes layers are turned on or off. Make Sense?
So the LEDs are actually turning on and off at a high refresh rate that the eye cannot see? So anode row 2 turns on and the corresponding grounding transistor turns on, then anode row 3 turns on and the corresponding transistor and this goes back and forth many times a second creating the illusion that the corresponding lights are on? Interesting. When I've seen multiplexing in the past it was more simplistic was using shift registers to light LEDs but each output went high and turned on a specific led without a refresh rate. So what is the recommended refresh rate for multiplexing?
Not quite every LED at separate times, say column two is grounded and it is 17 hours LED 4, 5, and 6 should be turned on in order to read 7 in binary. So very fast, at 17:26:30, the LEDs will be turned on in the first column and a 1 will be displayed. It will be left on for short enough time to not see flickering while long enough for it to be bright enough. Then column two, three, four and so on each displaying their number.
Got it. Thanks. Looking at the supplied Arduino code with this Binary clock it would appear to cycle through the rows and columns at the speed of the Arduino's clock. I'm not seeing any delays in the code except for when a user presses the buttons and of course the increment of the seconds every 1000 milli seconds. The activate() function is called to refresh the display on every irritation of the man loop.
The Full Binary Clock is so cool. I can't wait to have it up and running. <br>Frank
hi there, i wanted to make this clock and i wonder if you could provide a Fritzing breadboard schematic for this. i'm new to these kind of stuff and i'm still learning using my first arduino kit, which consist of the arduino uno. i read in the comments that someone has already asked for an improved schematic, but, considering i'm new to this, i'm finding it difficult to understand it. i would gratefully appreciate it. thank you.
Would it be possible to get a schematic for the circuit? I would really like to make one of these.
Check out the new and improved Step 3. <br>Hope that gives you all you need.
Thank you very much for the schematic, I will be starting on this today. One quick question, is the button you're using a dpst switching between normally power and ground through a resistor one one side? <br>Thanks again
Opps I forgot to label the resistors on the buttons, they should be 10k ohm. <br>But this is how a button looks in the real world. <br>http://www.arduino.cc/en/Tutorial/button <br>It's wired just like mine.
excelent! oh for a schematoc!
You say &quot;<em>10 resistors for LEDs, i used 470ohm you could use as low 100ohm but they would be very bright at night</em>&quot;. But I understand that actually only 4 of them are in series with the LEDs and influence their brightness and should be chosen according to the desired brightness. The other 6 resitors are connected to transistor base and should ensure that the transistors go to saturation mode. I don't know how this is calculated or if the resistor value is important at all. So 470R worked fine there? And am I correct at all or not?
I used all the same resistors and it worked fine for me. As I unsderstsnd it if you are using the same value resistors it will work. I have also see common emitter configurations that use 1k resistors between data and the base pin. So I don't believe the resistor used for the transistor is inport ant with this number of LEDs.<br>That said, I also used transistors on a 4x4x4 LED cube and didnt feel like using resistors between the data and the base and it works fine.<br>Hope that helps.
great use of ATtiny!

About This Instructable


76 favorites


More by sbbrain: Printrbot Upgrades 25x8 LED Hat, for parties and other useful things Full Binary Clock
Add instructable to: