This page describes my Bob-clock, including how I got the idea, how the the hardware and firmware works etc. I will start by describing the history of how I got the idea and how I finally managed to make this clock. Then I will explain what made me make an entirely new version, and I will then describe the hardware of this new version, and how I constructed it.
The Bob-clock is a wall-clock I have built, which uses 60 multi-color LEDs arranged in a circle to represent the small and big arm of an analog clock. If desired, it can also display the seconds with a third color. The image above shows the Bob-clock as it currently looks.
On this version, the blue light signifies the hour-hand, while the red one is the minutes, so in this image the time is about 10 minutes to 4. When both the minute and hour arms are in the same position, the colors will be mixed. On this version it turns out as a purple color.
So, how did I get the idea for the Bob-clock?
Actually the inspiration came to me in a dream sometime (I think it was arround 1997). This is the only time ever that I have really gotten an idea from a dream, and actually carried it out in such a physical way.
Actually the clock in my dream was not exactly like this one. As I remember it, it was a lot bigger (like 2-3 feet on each side). It was made from a brushed metal or aluminium plate, and had the 12 numbers carved out (like cut with a router) and lights behind the numbers. I don't remember if the lights behind the letters had anything to do with the displaying of the time (and if so, how the minutes were displayed), or if it had any arms. The metal plate was fixed a certain distance from the wall, without any sides, so it looked like it was hovering. I woke up shortly after dreaming about the clock, and I guess that was when I thought that there were some great design ideas I could use. Although I am normally reluctant to copy ideas, I don't think "copying" from a dream will get me in any trouble copyright-wise etc. Actually I don't remember any other parts of the dream, like what it was about, or why there was this nice clock (c'm on, its nearly 10 years ago), but the fact is that the minute I woke up, I started considering what parts of this design I could actually implement.
Some time later my uncle Bob visited us (my aunt and uncle live in USA and come to visit this side of the family in Denmark once or twice every year). Since I have always had great conversations with my uncle concerning technical stuff, I decided to show him the plans I had made for the clock. At this time I was still struggeling with the issues of using multi-colored LEDs, since these were still quite expensive. I tried thinking of a way to only use 12 multi-colored LEDS, and the rest in a single color, but this would not work, since it would be very difficult to see whether the minute arm was at 59 or 0. So I could not think of a way to make this without using 60 multi-colored LEDs.
As time passed by, I was involved in an electronics project where we needed a lot of multi-colored LEDs. I therefore spent some time finding a place where they were somewhat cheaper (especially in larger quantities), and finally ordered 200 pcs for myself. This would be enough for 3 clocks, so I started working out the other parts of the hardware. I initially considered adding a date display (perhaps something like a 2x16 char HD44780 LCD in the middle of the circle), but then decided that the design and clean look of the single circle of LEDs would be "ruined" by anything extra. Even the buttons for setting the clock were placed behind the front plate, out of sight.
This first version used an SGS Thomson ST6 microcontroller. I developed the code and got a demo-version running in the summer of 1998. I then took some pictures of it and decided to give these to my uncle for his birthday. I would then finish the coding and he could have the clock and bring it home with him the next time he came to Denmark. He got the clock, and has been very fond of it. I like the fact that he was the only person I discussed the design with in the beginning, and that he got the first working version of it.
For several years I had this project of making a second one for myself. I even had all the components etc., but did not get anything done.
In 2003 I was visiting my aunt and uncle in the US. On their wall was the clock I made. My sister and her boyfriend were there as well (not on the wall, visiting, goofball).
Then some time during 2004 my sister and her boyfriend announced that he had proposed, and that they were going to get married in april 2005. When their wish list for the wedding came out, they had put an "order" for a clock like the one I had made for my uncle on there. I decided that this would be a very good wedding present, and I was confident that no-one else would get one of these, since the only one in existence was the one hanging in my uncles living room (and he would not part with it).
So I started thinking about how to change the design (to avoid some of the problems I had had when designing the original version, and get a more up-to-date hardware and easier firmware development). I quickly decided to use an Atmel AVR microcontroller, which I had used for several other projects since I developed the first version with the ST6.
I decided that I would build two. One for my sister and would-be husband, and one for myself. I also decided to put the LEDs on a circuit-board, as opposed to the original version where the LEDs were mounted in the aluminium plate and connected with a wiring harness on the back, and the microcontroller and driving circuits was made on a prototyping board.
I used Eagle for the PCB work. Of course you need the professional version to make boards this large, but luckily I had persuaded some people at the university that we needed this in the lab.
I started out doing the schematics. After that I was ready to place the footprints. I ended up with a design consisting of a PCB of 22x22 cm, with the LEDs in the circular pattern (20 cm in diameter), and the controller and driving logic in the middle. In order to get the diodes aligned properly, and get them rotated correctly (for easier routing), I made a perl-script which would calculate the commands needed and output them to a file. This file was then executed as an Eagle-script, and rotated and moved the LEDs to the desired positions. You can take a look at the script, although it is fairly specific for this task. In order for it to work (when executing the output in Eagle), the grid should be set to mm, and with the finest resolution. Of course the commands for this could equally well have been output in the beginning of the script, but since I only needed the script this once, I guess it was just as easy to type the commands in Eagle, instead of in a perl print statement.
This was when I came up with the name Bob-clock (named after my uncle who had the first version). The new circuit design would be Bob-clock v2.0, and was very different from the first version, but the appearance on the front would be similar.
When I showed this circuit layout to a couple of students (Asbjørn and Anders) at the University, they became very interested in the idea, and wanted to have one (each) as well. So we agreed that they would get a hold of the quite large amount of PCB needed for this project. We also ordered some more multi-colored LEDs (off eBay). These were red/blue, as opposed to the red/green ones I had used in the original version. My sister and her husband would get one with the old LEDs I had left over from the first version, and the red/blue ones would be used for my own clock, as well as the two students'.
Then began the race against time to manufacture the clocks, including finishing the programming of the firmware. I actually finished the programming the day before their wedding (actually I have added more features later, but they got this version that worked for their wedding).
If you take a look at the schematics for the LEDs, you can see that they are arranged into an 8 by 8 matrix, giving 8 x 16 connections (since each LED has one cathode and two anodes). The 8 cathode connections (rows) are connected to N-channel FET drivers (through a current limiting resistor), which are controlled directly from PORT C of the microcontroller.
To drive the anodes (columns), there are 16 P-channel FET drivers. Looking at the schematics for the main controller you will notice that these FETs use the unregulated power supply (to avoid driving the LEDs off of a regulated supply). This also means that the gate-voltage must be at this level (about 7V) for the FETs to be off. In order to achieve this, a 4515 is used as a multiplexer for selecting the appropriate column in the LED matrix. The 4515 has inverted outputs, which is ideal for driving the FET gates, and since the 4515 is also supplied from the unregulated power supply (Most 40-series CMOS logic will work with supply voltages in the range 3V-15V), the levels are fine for this. In order to interface to the microcontroller, some inverters are made with another group of N-channel FETs (and pull-ups). This gives the needed level-shift. Notice how the numbers on the row-drivers are opposite to the outputs of the 4515. With this configuration, the outputs from the microcontroller (PB0-PB3) that are inverted by the level-shifters will give the correct output (as if they had not been inverted).
The configuration means that the 4515 should first be used to select a group of 8 diodes and a color (e.g. one of the columns), by means of the 4 data-bits and the strobe signal. Then these 8 LEDs can be controlled by the 8 row-drivers on PORT C. Of course the LED matrix is not physically positioned in a matrix formation, but rather in a circle (with the last four LEDs being left out). Check out the PCB artwork to see how this was accomplished. The top layer is pcb-top.pdf (195kB PDF) and the bottom layer is in pcb-bot.pdf (250kB PDF). The entire PCB design was routed manually, mainly to have complete control over the placement of the tracks (especially the LED matrix). Another reason was that I was going to be making the PCBs with the normal photo-process, and so I would not be able to get it plated through.
Creating the PCBs was a somewhat daunting task, since the PCB is wider than an A4 size paper (I don't know if it will fit on a letter-sized paper, which is slightly wider, but the film was not available to me in other sizes). I had to print each side in two halves and get these overlayed in the UV exposure box. It wasn't perfect, but since the traces are fairly wide, this did not pose too many problems.
When making such a big PCB (well, actually four of them), you become very aware of the hefty cost for photo PCB. The price from the supplier we used makes me wonder if we could have gotten the PCBs manufactured profesionally without paying extra (especially when you count in the work we put into manufacturing them). This would have given us the option of plated-through holes, solder-stop mask and silkscreen. But at the time we made the PCBs, this option was not considered seriously.
The two overlayed films in the exposure also created a funny little "easter-egg": I had put the print date and time on the PCB layout, and printing the two halves of the films meant that the seconds in the timestamps were different. Since they were overlayed in the exposure box, you can see two numbers on top of each other.
The image shows the finished PCB (well, the DCF-decoder was added later). The four white things in the corners are the adhesive posts that I have stuck to the back of the front-plate. Underneath them, you can see the screws that hold the PCB to the aluminium back plate (which is 22x22cm like the PCB). The thickness of the unit is about 2cm. With the front plate being larger (25cm square) than the rest of the unit, it looks like the clock is hovering out from the wall.
Since the Bob-clock uses a normal clock-crystal for the real-time clock, it is not really as accurate as one would want from a clock. I first tried adding a 32kHz watch crystal, but this turned out to be just as bad. I then tried a fix in the firmware, where the clock would be calibrated. This would work by counting the number of ticks from the internal timer, and then when a fixed amount of these had occured, one extra cycle would be added or subtracted. This actuall made the clock pretty accurate, since the temperature is fairly stable.
I then got the idea that the clock could be synchronized in some other way. I ordered a couple of DCF77 receivers from conrad.de and hooked one up to the Bob-clock. Some fancy DCF77-decoding was added to the firmware, and although the signal is not optimal, it occasionally gets a fix (I guess living nearer to Frankfurt would help here). It also turned out that the switch-mode power supply I used was making a lot of electrical noise, which disrupted the signal. I have replaced it with a different type, but although the new one seems to be much more stable (it was a lot more expensive as well), it seems it may be even more noisy. At least I have not been able to get any DCF-signal at all after the replacement. I should probably try to take a look at the voltage (with a scope). I wouldn't be too surprised if the switching frequency is near the 77kHz used by the DCF-signal. Perhaps the easiest solution abandoning the switch-mode supply and getting a simple unregulated wall-wart transformer. I will update this page when I find a good solution.
The firmware for the Bob-clock is written in C (compiled with avr-gcc). I have used WinAVR, but since I normally use Linux on my desktop, I will look into getting a nice development set up on Linux. This should be fairly simple, since avr-gcc works fine on this platform. Also the avrdude programmer software (which ships with WinAVR) is originally written for BSD, and compiles on Linux as well, so there should really be no changes needed to the code or Makefile to get this running on Linux.
I have tried to structure the code in the way I found most logical (split it into appropriate modules), although some pieces of code are a little integrated due to the hardware being used for multiple purposes (especially the timers). Any hardware-related differences between the clocks are put in config.h. The firmware is not yet fully done (I'm still cleaning up the code a little and adding some extra features - I also need to get the clock calibration worked into the code again), but I have decided to put the latest version here anyway: bobclock.zip. This archive contains both the code and the Eagle schematics and PCB design. If you find it useful, please let me know. I might even get some of the updates that I have thought of implemented.
The firmware handles the multiplexing of the LEDs. Currently it cycles through all the groups and determines (based on the real-time clock) whether any LEDs in each group should be on. The easiest way to think of the adressing is that the group is selected by the 4515. Each group is 8 consecutive leds in the circle. So the first group consists of LED0 thru LED7, which corresponds to the topmost (LED0) and the next 7 to the right (e.g. for representing the minutes from 0-7). The most significant bit of the group controls the color.
The group configuration allows all the LEDs to be turned on at the same time (well, they are not all on, due to the multiplexing, but because of the persistence of vision, they appear that way). This can in turn be used to have the arms (or just one of them) be shown by a line of lit LEDs instead of a single one. For instance if the minutes are 37, the first 38 LEDs (with LED0) could be turned on. This is similar to some other clocks I have since seen, such as the Circle Line Time Display. I also recently found The CycloChron, which has a similar concept, although with only one LED-color it is far less obvious how the time is read on this one. I recall seeing another similar clock (I think it was called something with "studio"), but I cant seem to find the URL now. If you know it, please let me know.
In the current mode of operation (with only 2 or 3 LEDs on at any time), it would be possible to only enable the needed groups, thus getting a duty-cycle of one 4th as opposed to the current one 16th. This should allow for a brighter display, especially with the older LEDs (red/green), which are not that bright with only 1/16 duty cycle. Actually I used this technique in the original Bob-clock (which my uncle has), since this has de-multiplexers on both the rows and columns (so only one LED can be turned on at the time, and 1/128 duty cycle is not very bright with the old LEDs).
As mentioned earlier, the Bob-clock now has a DCF77 decoder. The signal received from the transmitter near Frankfurt consists of one bit per second, coded with varying pulse lengths (100 or 200ms). This is decoded by the firmware. The signal contains a couple of checksums that are used to make sure the decoded signal was received correctly. The transmission of a timestamp takes an entire minute (59 bits followed by a pause of 1 second). Currently I don't compare the local time with the received timestamp, although this could probably make the decoding a little bit more robust. When a timestamp is received with a correct checksum, the RTC is simply updated with this new value.
If no signal is received, the local RTC is simply used. With the calibration this is adequate, even with a week between to fixes from the DCF transmitter.
In order to better cope with the noisy DCF-signal, I am currently working on an option where the LEDs will be turned off from 4AM to 5AM if it has been more than a week since a valid timestamp was last received. Hopefully turning off the LEDs will mean less noise, and a better chance of getting a correct time fix.
The front plate of the Bob-clock is made from 2mm aluminium. This was cut to 25x25cm on a machine. I then printed the PCB layout on regular paper and taped it to the front plate. This could then be used as a template for marking the positions of the LEDs. The holes in the front plate were drilled with a 5mm drill.
Then I ground the whole thing with sandpaper. I used P800 Wet-or-dry with a bit of water. First the burr arround the holes were removed, and then the entire surface was sanded down to get a smooth even texture (removing a few scratches from the cutting and drilling). The process of getting the surface smooth took several hours, and the aluminium slurry was removed with tissue paper now and then. Once the surface appeared clean I dried it with tissue paper, and careful to avoid putting fingerprints on it, I placed it on a couple of newspapers and gave it a couple of coatings of a matte lacquer. When this had dried I added the text in the lower right-hand corner (this was made with dry transfer/rub-down letters). Several more coats of lacquer helped make the surface more durable and giving the final appearance.
The schematics and PCB layout, as well as the source code for the Bob-clock is available as bobclock.zip. Don't hesitate to drop me a note if you need any additional information.