Here is another clock... but what kind of clock !
Take a piece of wood, and drill 27 5mm holes.
Insert a LED into each hole.
Take a Dymo labeler, print a few numbers and stick them to the board.
Wire the LEDs, connect them to a PIC... That's all !
This example will show you how to connect up to 30 LEDs to a PIC, using only six I/O pins.
I wanted to build a clock as simple as possible :
The solution of direct LED driving comes from a Microchip Application Note AN234, and as I'm using 25 mA LEDs, I simply removed all current limiting resistors.
A silicon diode is used as temperature sensor, and the rest of the circuit is very classic around a PIC16F819 :
Click on the schematic to enlarge
Upper row : hours
Middle row : minutes or seconds or degrees C
Lower row : add it to middle row
For example, the clock is displaying 5 hours and 23 minutes
The wiring side of the LEDs is a little bit messy,
some colored wires are helpful !
See the source code for LED numbering.
The Source Code
The is the mikroC source code, feel free to use it at your own risk !
#define TEMP_REF 115 // silicon junction offset : 600 mV
ss++ ; // next second
INTCON.TMR0IF = 0 ; // clear interrupt flag
if(BUTTON_MODE) // advance hour ?
hh++ ; // next hour
if(BUTTON_TOGGLE) // valid ?
mn = 1 ; // set minutes
if(BUTTON_MODE) // advance minute ?
mn++ ; // next minute
if(BUTTON_TOGGLE) // valid ?
ss = 0 ; // reset seconds
ADCON1 = 0b00001110 ; // RA0 as analog input, other input as digital I/O
TRISB = 0xff ; // switch off display
INTCON.TMR0IF = 0 ; // clear timer 0 overflow interrupt flag
OPTION_REG.PS2 = 0 ; // no prescaler
if(BUTTON) // if at least one button is pressed
VDelay_ms(1000) ; // 1 second delay
setTime() ; // enter time setting
mode++ ; // next mode
toggleMode = !toggleMode ; // toggle display mode
dymoLight(mnTableH[mn], 5) ; // light minutes, upper row
if(loopCtr > 20) // if delay expired
temp *= 221 ; // temperature coefficient of the silicon junction
tdeg[tidx] = temp ; // store temperature sample into array
temp = 0 ; // compute average temperature
if((temp > 0) && (temp < 60)) // if temperature wihtin 0...59
if(toggleMode && (toggleCtr > 200)) // if toggle mode and delay expired
How to use it ?
First, the clock enters time setting mode :
Only the hours row is displayed : press ADVANCE button to change hour, and press VALID button when it is correct.
The hours row is shut off, and the middle and lower rows of minutes are displayed : press ADVANCE to change minutes, and press VALID when it is correct.
The clock starts with seconds set to zero.
To change display : press the MODE button to switch display in this order :
Hours/minutes -> Seconds -> Temperature -> back to Hours/minutes
To toggle automatically from Hours/minute display to Temperature display : press the TOGGLE button.
To enter time setting : press both MODE and TOGGLE buttons at the same time.
How to read the display :
If both three rows are used : you are reading the time (hours/minutes).
If hour row is shut off : if the middle an lower rows count, you are reading the seconds. If it does not count, you are reading the temperature.
Note that it could be easy to add 3 more LEDs (30 are possible, 27 are used) to show display status : either time, seconds or temperature. Do it yourself !
Please report bugs & comments in my forum, thanks !
A user's Dymoclock
Lubo_plan built the PIC DymoClock, he made very good job and his clock looks great !
As you can see, the most complicated part of this clock is the display panel :
and recently another one :
Thank you to Lubo_plan who sent me this pictures.
Here is another user's clock :Gérard sent me the picture, source code and circuit diagram of his bleu-blanc-rouge binary clock :
see details and discussion here