Monday, December 5, 2011

LightDial: Done!

I cooked up a quick Solidworks model of the clock. Protip: don't set your parts' appearances to transparent plastic until you're done. Basically working in wireframe the entire time.

The clock is planned to have a five inch diameter face, with two buttons and an RPG (rotary pulse generator) to adjust the time.

Using the Invention Studio's laser cutter, the pieces were cut out without hiccups. Holes were also cut out in the pieces for the LED leads. The LEDs were slotted in and wired together with a common cathode. This is when the true hairiness of 36 individual wires came into play, and we realized what we were getting ourselves into.

A digression: Through a random experiment, we discovered that a backlit clock face looks better than a frontlit clock face. Thus, we reversed the order of the clock rings, so instead of two LED rings and a face, it was a face and then two LED rings. This is why the actual build doesn't look like the Solidworks model.

Populating the board was easy enough. Until I realized the wire I have doesn't fit inside the connector, and the Molex connector crimper I can use is too big for the 1.25 mm pitch connectors I have. Begrudgingly, my lab partner and I decide in the interest of time to solder the LED wires directly onto the board. This we did.
The horror! The horror!
Then I found out the LED drivers (the ones underneath all the wires) were soldered on backwards. Desolder and resolder all the wires!

There was a good thing that came out of all the soldering. In code, the lights were ordered B7G7R7B6G6R6...B0G0R0. In circuitry, the green and red channels were swapped, as in B7R7G7. Headaches were had all around, but they were wired in order to simplify programming.

After that, the major hardships were over.


First light!
Wiring done, all that was left was a matter of coding. Using the SPI peripheral was a matter of setting registers. Time was kept by counting program cycles. I did add a watch crystal to the board, but due to time, I didn't bother enabling it, so the timekeeping accuracy is only good enough for short term use.

In terms of human interface, I used two buttons and a rotary pulse generator. Holding down one button and turning the RPG adjusts minutes, the other hours.

Hour lights
And so, putting it all together,
Hours and minutes. Woohoo!
Rats nest

Blue LEDs look funny on camera
Appendix
Source Code: 
Eagle Design Files:  
Solidworks Models: