A clock integrated into my desk
Background
One day I was cleaning my room when I found two old projects which I had completely forgotten.
One of the old projects was a clock combined together with a burglar alarm. In fact, these RGB LED lights was a part of the project. I barely remembered how it was supposed to even work. I had moved away from the apartment I designed the clock/burglar alarm for. Therefore, I never finished the project.
Other old unfinished project was a simple motor speed controller. It was technically finished but it was done purely for testing purposes only. And now, all the tests were done. Therefore, the controller was useless.
So, I started to think what I could do with the unfinished projects. First idea was some kind of a game. But I rejected the idea relatively quickly since such project felt a waste of time. Nobody would ever play the game after a few first tries. And after that the game would be useless.
Next idea was a simple clock. First, the idea felt unnecessary since I already have a clock on my desk. But the more I though about it the more I started to like the idea. And after a few days thinking I decided to finally start the project since I had no any better ideas what to do with the parts I had in my hands.
First, I took the old clock apart. Next, I checked if all the 7-segment displays were ok. Luckily, they were ok. Of course, they were ok. They were stored in a dry room temperature closet.
Next, I took a microcontroller and wrote some code for it to control all the four 7-segment displays and a colon made out of a couple of LEDs. The code was a very simple clock at this point counting seconds and showing hours and minutes on the 7-segment displays.
I needed something to adjust the time on the display. I picked a rotary encoder from the old test project. With that and some changes to the code I was able to adjust the time of the clock easily.
At this point I thought the project was done. And I started to plan integrating it into my desk. But I didn't do it rightaway.
A few days went by. And I was doing something totally different thing in my workshop when I saw yet another old project which I never finished. It contained four buttons used to be connected to a microcontroller. The microcontroller was taken and reused somewhere else a while ago. But with the buttons I could change a mode of the clock. So, I took those buttons and attached them to the clock project.
So, the clock got a date feature in addition to the normal clock functionality. It could now show also a day, a month and a year. In addition, it could also show seconds as well. After these additions there was still one unused button. At first, I didn't know what to use that for. So, I came up with a random animation I wrote just for fun for the clock.
The design
During the project it was clear from the very beginning that the clock should look like it was clearly a DIY project. Also, I didn't want to use any money nor too much time to the project. So, I used parts only from old projects and some leftovers.
Usage
The clock has four modes listed below.
- A normal mode (Figure 1). The clock shows hours and minutes. A colon is flashing. Hours are shown in 24-hour format.
- A second mode. The clock shows minutes and seconds.
- A date mode (Figure 2). The clock shows a day and a month.
- A year mode (Figure 3). The clock shows a year.
First three buttons changes the clock into different modes except in the normal mode. After about 10 seconds it returns back to the normal mode.
The fourth button shows a short animation. The animation takes about 4 seconds. During the animation the colon is flashing. After the animation is over the clock returns to the mode it was when the animation button was pressed.
The time can be adjusted with a rotary encoder. In the normal mode and the second mode it adjusts minutes and sets seconds to zero. In date mode it adjusts days. And in the year mode it adjusts years. Years can not be set less than 2024. Everytime anything is adjusted it gives 10 seconds to stay in the mode before it goes back to normal mode.
The clock is integrated into my desk above my laptop's screen.
Technical details
The clock consists of five units listed below.
- A 7-segment display with a colon
- A microcontroller board
- A four button bar
- A rotary encoder
- An old Nokia phone charger
All the buttons, a rotary encode and all the LEDs in the display are connected directly to the microcontroller's I/O pins. With all the LEDs there's a resistor for each LED.
End result
So far, I'm really happy with the end result. After a few days usage I really check the time from it. This is the main purpose of every project I've ever done. The clock looks definitely like it was a DIY project. You can't mistake of that. In that sense, the project was very successful.
Ps. The animation is something that I might get rid of some day. But only if I come up with a better idea for the fourth button.