Final Project

Partlist

Parts Amount Price
Atmega 1284p 1 7,56€
16Mhz/18pF Crystal 1 0,20€
10K Resistor 1 0,03€
499 Resistor 2 0,03€
22pF Capacitor 2 0,05€
10uF Capacitor 1 0,15€
1uF Capacitor 1 0,06€
100nF Capacitor 2 0,04€
blue LED 2 0,26€
5V Voltage Regulator 1 0,17€
pin header 2 1,77€
3mm x 1m x 80cm wood 1 6,00€
4 x M5 x 60 screws 1 3,79€
25 white LEDs 2 3,20€
120 Jumper Wires 1 7,00€
Resistor Kit 1 5,20€
9V Snap Connector 1 1,20€
RTC module 1 3,86€
Word-Clock 45,92€

Design

The first step to my clock was the front. After getting some inspiration on the internet I designed a matrix of words. This would be the base for my lasercut.

With many schematics drawn on my block and quite a lot of measuring I came up with this. These are all parts I need to make the case for my clock. It consists of the front with the word-matrix, a middle-part which will contain the led-chambers and a back with a small window for maintenance.

And this is the schematic ready for the lasercutter with the colors for color-mapping and the parts duplicated to the amount I need of them.

For printing I needed a small lock that holds the maintenance plate. I started with two identical cylinders.

In the first one i put a hole and substracted it from the other.

Then I exported both bodies as .stl and imported them into Cura. I needed two of each and just used the recommended settings because the print wasn't very difficult.

Lasercutting

After designing everything in illustrator it was finally time to start laser-cutting.

Everything worked out quite good, except that it was a pain to get every letter out. But after some time I had all my parts cutted.

While sticking everything together all parts had a tight grip and I did not make a logical mistake in my design.

This is my clock-case completely assembled.

3D-Printing

Here you can see both parts plugged into each other on the part of wood which will be the door.

And here it is in action on the back of the clock.

Electronics

For Electronics I used my board from the assignment before. Here you can see how I designed it and here how I produced it.

Soldering

Now I tested one chamber and filled it with two LEDs. First I connected the LEDs in series, but realized that this wouldn't work out. So I switched to parallel. The first attempt looks quite chaotic, but it worked. But the problem was, that the LEDs just were to weak. So I ordered some new ones with 3000mcd.

The new LEDs were a simple white and much brighter. And I figured out a way to solder them together quite good.

I drilled two small holes for VCC and GND in each chamber. And when soldering the LEDs I made sure that the upper hole was always for VCC.

Here you can see the first three chambers I made.

And here are all chambers finished.

The next step was to attach a resistor to every LED, because they could only handle a maximum of 3,5V. In the datasheet of the LEDs I found that one LED uses about 20mA of current. So I inserted this into Ohm's law and x stands for the number of LEDs.

R = V / I

R = 1,6V / x * 0,02A

The results were:

x(LEDs) result resistor used
1 80Ω 100Ω
2 40Ω 47Ω
3 26,7Ω 33Ω
4 20Ω 27Ω

After testing the values on a breadboard I soldered one resistor to every LED with a shrinking tube.

For testing purposes I soldered two cables on one LED, also using shrinking tubes.

Then I was able to test wether everything was working using my board and the blink script. And it did work.

So I soldered the remaining 42 cables and after finishing that I plugged them all into my board. It was a little bit messy but worked out. And even with the Atmega 1248p there are just a few pins free. Also all my ground pins are used too.

Assembly

I cramped everything behind the bottom layer and also attached a holder for a 9V battery.

And for the front I filled everything with hot glue so the light gets blurred better. And even though the leds are very bright it works out quite good.

Coding

Now it was time to finally code the program. First I tested which word corresponded to which pin and wether it works. After putting some logic into it I got an array with pins in the right order.

Then I made a small test and displayed a random time. This was just to check wether the USB provided enough power to light all those leds at the same time.

After that I started with the real program. First I included my input device, the real time clock. For that I used the RTClib library and the Wire library. Also I immediately initialize the DateTime variable.

Then I included the led array and an array of booleans which will be used to display the time.

Before I really got into coding I put some thought into it and found some patterns in the sentences which made the it easier to code the program.

I implemented two longer arrays of booleans. One for minutes and one for hours. These determine which words are corresponding to which time.

In the setup() I started Wire and Serial communication. The commented line is used to sync the RTC-time with that on your computer. I also set the time and determine all leds as output with the for-loop. Then I calculate the matrix and set it.

The loop() is checking wether the minute has changed and if yes it updates the time and after that the matrix.

The setMatrix() function goes through the time matrix and if it reads a true it sets the corresponding led to high.

The getMatrix() function first sets the "it is" led, which is the first one, to true. Also it sets the "o'clock" to false, because otherwise it would always stay on once triggered.

After those values are set it comes to setting the minutes. This just are dumb if statements which check if the minute lies between two values. Then it calls the setMinutes() function with the right array. Also if there is no minute, the "o'clock" gets turned on.

For the hours its the same procedure, the only difference is that the condition is a little more complicated.

The setMinutes() and setHours() functions are just for-loops which insert the given arrays on the right spot in the final matrix.

And sitting next to the clock while writing documentation I also fixed two mistakes I made in my matrices and conditions.

Video