This project is a unique timepiece combining a normal digital clock with a binary representation, allowing you to see time in both formats. This is especially useful to those who can’t quite decipher the binary time. As a bonus an LCD displays the day, date and temperature.
You’ve probably seen some of the “Hacker” clocks floating around the internet. These clocks display the time in binary format, the native language of a computer (Based on 1s and 0s). The time is shown using LEDs instead of 7-segment displays. Ever since I got mine people have asked me what it’s displaying, and some don’t even believe me when I tell them it’s the time in binary. Technically it is BCD or Binary-Coded Decimal, but we’ll simplify the terminology by sticking with the binary number system.
I told a few people I was going to build a binary clock that also showed the “normal” time so that people could see the relationship between the two formats and hopefully understand it better. That and a desire for more functions is what got this project started.
When I started this project I already knew I was looking for and drew a concept drawing on my white board at work. The Binary / Digital Clock would have the binary display on top with the 7-segment displays directly below each set of LEDs.
Since I already intended to use the DS1302 for timekeeping I decided I might as well make use of the date information available to me as well and so a Parallax 2×16 Serial LCD Display was added to show the day, date and temperature.
The temperature idea was added when I realized I had a lot of free space on the LCD, and could add the DS1620 using only 1 more I/O line. This also makes another point in that the DS1302, DS1620, MAX7219 and all three 74HC595s are all sharing the same Data and Clock lines. This saves a lot of I/O pins compared with them each using their own and demonstrates one way to consolidate I/O lines.
Another feature demonstrated here is shared variables and constants. By sharing I/O lines we can also have some common variables, constants and pin declarations. And for variables we can re-use many of them. Variables are conserved by re-using the same variables in many routines where the information needs to be retrieved and displayed and then it is free to use for reading the next device in line.
With all the hardware in use I needed an additional breadboard just to break out the binary displays. Several T1 LEDs can be seen here forming the Binary Display. The digital display makes use of the 7-segment displays on the PDB, but we lose 1 digit, so seconds are not being displayed in this photo.
Here I added a Grayhill rotary encoder for testing one method of setting the date / time on the clock. This is preferred over using buttons, but I still need to come up with an intuitive way to do it since the encoder has a single button built into it. I am thinking, press the button to enter ‘set’ mode, then adjust first parameter, push to advance to next parameter, etc until all are done.
The backlight on the LCD can be independently controlled allowing for it to be set for automatic or manual operation. I am leaning toward a mix where it is based on the time as well as the current light conditions. Anyone have any feedback on a preference?
Eventually I decided I really needed to test this unit with the displays I intended to use so I got a huge Jameco breadboard (JE27) out and added the 1″ 7-Segment LED Displays plus the 10 mm LEDs.
You can get an idea now about how big of a case I will need to house the finished project. As a note, the colons are run from the decimal point output of the MAX7219. This allows them to be current / brightness adjusted with the 7-Segment displays for a more uniform look.
Here’s a close-up of the LCD so you can see how the data is formatted on it. Since the displays only update when the seconds change, jitter from the temperature being on the threshold should be taken care of. Basically it can’t change any faster than once per second now.
Here I was using Red, Yellow and Green LEDs to see which I liked. In the end I will use one uniform color for the entire display. Red were the brightest. Green were not bad. Yellow were the dimmest. Mixing displays like this makes it impossible for the MAX7219 to regulate current / brightness. Next test will be with Blue LEDs, although the single element version of these only come in .8″ so I may have to wait on that. dual element version require more voltage than the MAX7219 can provide.
Here is the schematic that includes the Rotary Encoder for input. In the end I will probably still use this so I included it here. The full-size schematic is also included in the download below with the code.
I never did decide on how I wanted to handle date / time entry. Once I figure that out I will update this project. Of course, by then I will probably have more than one unit built. Until then I am posting the code I have. Everything works as expected, except you have to set the time using another program first (included), then afterward download the actual clock program. Bear with me while I get past this point. Until then, enjoy! A parts list / bill of materials will be posted when I create the boards and order the parts.
Binary / Digital Clock by Chris Savage is licensed under a Creative Commons Attribution 3.0 Unported License.