Picaxe Digital Art Clock


.
.

(click image for better view)

Introduction

I wanted to build something I could use daily, for no reason, other than the satisfaction of building something truly useful. A clock is a pretty useful appliance. Even though you can purchase one for a few dollars, how many people can say that they built one that they use everyday? This is a digital clock built around the picaxe 18X microcontroller and the DS1307 real time clock. Since simply displaying the time is useful, but really boring, and the microcontroller has capability to spare, I added a bit of code to the display section to do some "digit-rolling" animation. In between displaying the time every second or two, random digits roll by on the display starting from right-to-left, and then back to the right again... not only geeky, but artsy too!

Hardware Design

The basic hardware has the following features:

- Crystal controlled real-time clock
- LED time display with animation
- time-set buttons
- Battery back-up


Parts and Design

Picaxe 18X microcontroller
7805 regulator
HC4 4-digital SPI LED display
DS1307 real-time clock chip
32767 Hz crystal
Misc resistors
Picaxe 18x prototyping board
Solderless breadboard

From the pictures, you can see that I built the clock on a Picaxe 18X prototyping board. Purchasing this board and mounting a wireless breadboard on it was easier than starting with perf board or Vero (strip) board, and cost only a few dollars more. On the prototyping board, I socketed the DS1307 with crystal and also a 24LC256 i2c RAM chip. The RAM is not needed for this project, but at an extra $0.50, it gives the design significantly more capability. With a small amount of additional code, this design could become a datalogger. Or add a piezo, some switches, and some code, and this becomes an alarm clock. But for now, it is an art clock. See the picaxe project page for part sources.

BTW, the HC4 is a 4 digit LED display controlled via a serial interface that was produced in 1985 and ended up as surplus 20 years later. Unfortunately it looks like it is now unavailable and I'm unaware of a replacement of similar value, but you could use a serial LCD display as a simple but more costly replacement. Alternately, you could get four 7-segment LEDs and roll your own using the MAX7219 display driver, or buy one of the higher-pinout Picaxe controllers and just control the LED segments directly. Email me if you know of an inexpensive easily available serially controlled multi-digit display and I'll list it on my sources page.

Because I don't have the 18X included in my schematic drawing program, I'll just list the very simple connections that the device requires. Basically, a 2 line (DAT and CLK) interface between the 18X and HC4 display, and a 2 line (SCL and SLA) interface between the 18X and the DS1307 are all that are required. When I loaded the Picaxe code over the serial link, it initialized the DS1307 with the proper time, and a 1.5v battery back up keeps it. But hooking up 2 N.O. buttons on the 18X and a bit of additional code will allow the clock to be set without downloading new code via the serial interface.

Software

The software started out as 2 distinct code pieces; one which reads the time from the DS1307 via the I2C interface of the 1307, and the other which bangs bits to display a number on the HC4 display. After a few minutes of testing to make sure that the code was functioning, it was clear that the clock should and would need to do something else to make it "unique"; otherwise it would just be a digital clock... and you can imagine the passionate responses that would elicit from onlookers. So the animated random digit display starts at the least significant digit, creeps across until all digits are changing randomly, then fixes the digits at the correct time starting with the most significant digit makes the display a bit more interesting if not a bit puzzling at first glance.


Comments

Like many projects, packaging the device in an aestheticly pleasing case is challenging, mostly because it takes an equivalent time as the rest of the project. I'm thinking that an antique steam-punk style case might look good and be appropriate for the circa 1985 display.

 

 

This code is explicitly released under the GPL. And this page is licensed under a Creative Commons Attribution 2.5 License.  

Write me if you find this project interesting. Link to this page if you find it relevant..

Warning, building a digital clock is not cost effective over commercial products. This project is provided without any warranty and probably isn't suitable for anything.

Read or write a comment on the hardware projects

Back to Picaxe Projects