# Simple Binary Clock Using Attiny85

1,482

11

2

## Introduction: Simple Binary Clock Using Attiny85

Greetings!

In this instructables I show how to make a minimalist and simple binary clock using an arduino uno and a attiny85.

If you never used your arduino to program other microchips, you'll see it's very easy to do (I tried it for the first time for this project and it was quite simple) and pretty handy as you can shrink the size of your projects!

## Step 1: Gathering the Material

For this project I used basic and easy to find materials. There are two categories of materials, one for the clock's case and one for the circuitry.

Wood Case:

All of these items were found in a crafting shop

- Wood panels

- Wood Glue

- Black and Red spray paint

- Press drill

- Jig Saw

Circuitry:

- 13 red 5v Leds

- wires

- 4 x 220 Ohms resistors

- 2 x 10k Ohms resistors

- Pin holders

- 1 x 74hc595 (shift register)

- 2 push buttons

- Circuit board

- 3.3v coin cell

- Attiny85

- Arduino uno

- Soldering tools

## Step 2: Building the Wood Case

In the next steps, I show how I built the case for the clock. I used wood panels and wood glue and it worked well. The panels had a height and width to my liking, so there wasn't much cutting to do.

Also, At first I wanted to display the seconds, but later on, when I built the circuit I found the led switch at each second to be actually distracting, so I cut those Leds out and rearranged my code and case accordingly later on.

## Step 3: Wood Case: Cutting the Case Pieces

First off, I measured and cut all the pieces i would need to build my case.

I decided to make it as a box with no bottom. I sanded the edges if needed.

Measurements:

Sides: 2 x ( 7.4cm x 3.8cm)

Front & Back: 7.4cm x 9.5cm

Top: 8.8cm x 3.8cm

## Step 4: Wood Case: Drilling the Led Holes

I drilled the holes on the face panel of my case using a press drill. I indicated on the panel where to drill the holes and, since I used cheap crafting wood, I had to drill slowly so the wood wouldn't chip off. Now when I realized I want to take out the Leds for the seconds I had to cut this panel to remove the unnecessary holes. I realized this after painting my case, so the that's why the in last picture is my panel painted

## Step 5: Wood Case: Painting

Once I had every piece of my clock case, I proceeded to paint them. I chose red and black paint, as my Leds were already red. I used shiny spray paint, to give it a finished look after two layers of paint. I waited till everything dried.

## Step 6: Wood Case: Assembling

After the paint dried, I glued everything together using fast drying wood glue, making sure everything was straight every time I glued two pieces together. I waited till it dried, before gluing the next pieces together.

## Step 7: Circuit

The next part of this project is for the circuit. For this part, you will need your Arduino or any microchip programmer and the Attiny85. As I previously stated, I cut out the Leds for the seconds as I found the seconds too distracting. So in the beginning, the pictures show all the leds, and later on, the seconds are absent.

To program the Attiny with the Arduino as ISP I followed this nice tutorial from instructables by randofo:

https://www.instructables.com/id/Program-an-ATtiny...

The code I uploaded in the Attiny:

*The code is based on an internal clock of 16Mhz but it can be changed

*I used Timers and Interrupts of the chip to make the clock.

## Step 8: Circuit: Soldering the Leds

I proceeded to soldering the Leds together using my soldering iron and the already drilled case to position the leds properly while soldering.

Each Led of a column are soldered together by their cathode

Each Led of a row are soldered together by their anode

## Step 9: Circuit: Building the Circuit

With the Attiny programmed with the code, all there is to do is to build the circuit first using a breadboard to test out my program and make sure everything worked before soldering the full circuit.

The use of the shift register is necessary as the Attiny does not provide enough output pins for the 8 endpoints (4 rows, 4 columns) and the two push buttons.

The plan and the circuit I made are in the pictures.

I tested my circuit on the breadboard and when it was good to go, I soldered it on the circuit board.

I did not have a battery holder for a cell so I used my imagination to build a temporary one (very sketchy..). I recommend using an actual battery holder.

## Step 10: Assembling

The final step was to assemble everything, which is to simply fix the circuit in the case and the Leds in the corresponding holes. Then you can set the time using the push buttons and let the Attiny track time.

For example, in the second picture:

Hours2 = 2 and Hours1 = 1

Mins2 = 1 and Mins1 = 6

so the time is 21:16

And that's it!

Feel free to leave comments and suggestions!

Participated in the
Clocks Contest

83 9.7K
106 5.4K
287 20K
90 9.5K

## 2 Discussions

Hi!

I am not sure, but I think you configured timer wrongly - it does not work in CTC (as you written in comments) mode but normal mode.

TCCR0B |= (1 << WGM02) // Does nothing - according to documentation its the reserved configuration(See attachment)

TCCR0A |= (1 << WGM01); // Does configure CTC mode

Why did your code worked correctly? Because you wanted to clear register each time it reach 256. Well that is when 8-bit timer clears is register because of overflow, not because CTC.

Actually you set your compare match register to value 0b00000000, it fired interrupt, but it was working in Normal mode.

OCR0A = 256; // It is a 8-bit register(2nd attachment) so value 256 == 0b1 0000 0000 will never get inside it. Actual value is probably 0.

However I want to use parts of you code in my private project, timing is just a part of it, not main purpose, may I do it?

Best regards
Wojtek

I'm interested in building this clock, though I plan to down-size and compress it to the size of a watch. This is one of the more simple clocks I have seen, though I do have some questions regarding the plans and specs.
With the resistors between the LEDs and the microcontroller, if I were to use a stronger resistor, would that reduce power consumption of the system?
I noticed that the battery is similar to that of a watch battery, though I would like to know if you know what the power consumption of the system is, or how long that battery will last. I am aiming to have mine run for at least a year on a single battery.
With the system running on the internal system clock, how accurate is the clock in the long run? Does it stray a few minutes a month, year, or not at all? And I know adding a 16 Mhz crystal oscillator will synchronize the system to become more accurate, though where could one be added to this wiring diagram?
Finally, with the code given, would I have to use an Arduino and certain software to program the ATtiny85? I have a Raspberry pi 3B+, Spyder IDE, Anaconda, and Jupyter.