Arduino Binary Clock

I've finally made it, the binary clock the people around me heard me talked about for so long. I was trying to make this during the last christmas break, but time was lacking, I changed jobs 2 times in the last 6 months... so things were a bit hectic, but now everything is fine and I did it :)

I used a real time clock to keep exact time, I used just the Atmega328 instead of a full Arduino and made some small changes here and there, but the clock's design is all Cello62's.

Step 1: The Arduino Prototype

First I made the prototype with the Arduino, then I prototyped the circuit I would have in the final product, using the Atmega328 chip instead of the full Arduino to be sure that everything was working correctly.

Step 2: The Schematics

Here you can see how the push buttons, the leds and the real time clock are connected with the Arduino.

N.B. the resistance values are not correct.

Step 3: The Code

First let's setup the beginning to communicate with the real time clock and keep the time

And we will have a simple loop function calling different functions to do the work it needs to do. We will sleep for 500 ms because we don't need to loop as fast as we can, this also helps with setting the time when we press the push buttons so it doesn't change too fast.

You probably noticed some strange function calls in the code above... let's create those utility functions. They are useful to convert decimal numbers to a byte readable by the real time clock protocol and vice versa

//----- Utility functions ----

byte decToBcd(byte val) {
return ( (val/10*16) + (val%10) );
}

byte bcdToDec(byte val) {
return ( (val/16*10) + (val%16) );
}

Now let's turn on and turn off the appropriate leds depending on what time it is

Attachments

Step 5: Installing the LEDs

And I connected them all together and to one of the wire of a flat ribbon wire.

Then I connected all the cathodes(+) to a wire part of a flat ribbon wire.

Step 6: Making the Box

I then took a box big enough to house the circuit board, the buttons and the 5V D/C input.

I drilled holes for the buttons and got the size right after with a file.

I installed the buttons and fixed them with hot glue and identified the buttons to set the time. The red one is just to cut the flow of the ground for all the LEDs to turn off the lights without stopping the clock.

Step 7: Making the Board

I then cut a board to the right size to install the circuit with the Atmega328 and all the wiring.

Step 8: Putting It Together - Part Un

Let's hook up everything together in the box and test it.

Step 9: Putting It Together - Part Deux

Then it's time to put everything in the frame, I reused a RIBBA frame that I had lying around (13cm x 18cm) (6" x 8") from IKEA... http://www.ikea.com/ca/en/catalog/products/00132524/

I decided to fix the boards with screws in the frame and to hold the box to the back of the frame with hot glue.

Step 10: The Finished Product

Now it's time to see the final product, it's a nice piece of decoration.

To read the time you just need to add the values of each lights... for the tens and units of hours and the tens and units of minutes.

The first image would read (1, 2+4, 2, 1+2+4)... so 16h27

The last image would read (1, 1+2+4, 1+2, 1+2) so 17h33

The only thing I regret is not having more lights behind the Hours and Minutes at the top, because it doesn't light up properly... maybe one day I'll open it and make the modification.

Thank you, I did some projects already, but definitely not as many as I wished... but I have some things in the works, I just need more hours in a day... or to win the lottery so I can quit my day time job ;)