Posts Tagged ‘binary clock’
I made this binary clock to learn how to use Eagle and go through a real PCB ordering process. Until I made this clock, all my PCBs had been made through ExpressPCB. ExpressPCB’s PCB ordering process is very easy but their PCB design tool is not as advanced as Eagle, puts out proprietary files, and is not well used by the PCB community. In addition their PCBs are a little on the expensive side at $51+shipping for 3 boards although you do get them in 1-2 weeks.
For this project I had the PCB manufactured by BatchPCB – a service run by SparkFun. However, since then I’ve switched over to OSH Park. OSH Park has much better looking and higher quality PCBs than SparkFun. In addition they are purple and come with nice looking gold plating.
The clock layout is very simple since this was a beginner project. Most binary clocks represent the time in binary-coded-decimal (BCD) format where each digit in the time is encoded as a binary number. I chose to do a full binary clock where the entire hour (or minute, or second) is displayed in binary.
Putting the schematic together in Eagle was easy and so was laying out the PCB. I took the easy way out and used the autoroute feature to lay the traces. The autorouter isn’t very smart and I recommend against it, it routed several traces under the small 1206 parts and inserted vias where it was very easy to bridge them to pads with solder.
A few places that I screwed up was in connecting the LEDs to the IO pins and not putting in a screw down terminal connector for the input power. I randomly assigned the LEDs to various pins and this made addressing them difficult when writing the code. For the input power, I figured that I would just solder the power adapter directly to the voltage regulator pins (7805). I found out the hard way that this is not a very secure way to tie down the supply and it made re-using the supply difficult because I now had solder on the tips of the wires!
I based much of the code on a binary clock I made a while back. I set up timer1 to overflow every 100ms and increment the seconds every 10 overflows. I increment the minutes and set the number of seconds to 0 when seconds is greater than 60, and increment the hours when minutes are greater than 60. Updating the display only needs to be done after you increment the seconds. I also did a crude PWM where I toggled the LEDs on each overflow to reduce power consumption.
You can download the code here.
The schematic is not very interesting, so here is the layout. I have four buttons to set the time; the ATmega32; 6 LEDs per for the hours, minutes, and seconds; a 6 pin AVR-ISP header; and a 7805 voltage regulator. I initially thought about powering the device via USB – There are pads for a USB socket – but I never got around to it.
|18||1206 100ohm resistors||current limiting resistors for the LEDs|
|18||1206 LEDs||For the display. Mine are blue.|
|4||Momentary on Omron switches||Part name: B3F-10XX|
|4||10KOhm resistors||pull up resistors for the switches|
|1||2×3 header||AVRISP connector|
|1||7805T||5v Power regulator|
|1||USB header||USB header as alternate powersupply – not used|
|misc||capacitors||Used for AC bypass and switch debouncing|
You can download the eagle files by clicking here.