A. PREFACE
This project comes when I search the net for an unusual clock. I bump to Elektor Electronics magazine site Jul 2007 edition. It call Very Simple Clock, because it takes only a small quantity of components. You can find it at download section (U070466 - for the article, 060350-11 for the firmware source code, and 060350-PCB layout). It use PIC16F628 type. The perfect match for my PIC microcontroller learning. A pity that the firmware program takes the clock from DCF77 signal to generate the time. This signal only available at Frankfurt-Germany, transmit at 77.5kHz and has a range about 2000km. Its so far enough since I lived in Indonesia. The signal may lost in its transmission. I must make my own firmware to run it. Besides that I am very pleasure to play with the microcontroller itself. So the project begin.
Last month, I buy a few PIC chips since my stock already out. But I got a new type of PIC16F628 series. This is a new one with A in follow, new generation I think since PIC16F84 series already obsolete. But PIC16F84A still could be obtained in my country. I think that this is the perfect time for me to learn more about PIC microcontroller by this PIC16F628A series. At first it can't be programmed using my usual programmer, the El-Cheapo. The programmer not support this type yet. So the matters begin. More complicate and more fun.
B. SCHEMATIC
I make some change from the original design. Input RA-4 originally use for clock signal input, change to be come power failure input. Leds indicator used originally 28 pieces, 12 pcs for hours indicator, 12 pcs for multiple 5 minutes indicator, and 4 pcs for resolution minutes indicator between. I use 27 pcs, minus one for multiple 5 minutes indicator, since the 60th minutes indicator is never on. I plan to make this position for AM/PM sign. Some additional also for leds direction. Original design has connection from anode to port-B and chatode to port-A. I make it reverse, so I can save more resistors to limit the current. Original design takes 8 I/O port-B and 4 I/O port-A to multiplexed these leds. I use 7 I/O port-B and 4 I/O port A, so I still have 1 I/O for setting the time option (for push button). I already had an experience before, when I made myke static clock how to do this option. So it was not to difficult to make some changes from it. Also add the circuitry to accommodate battery back-up system. For the brain, I use PIC16F628A series. In fact that it can still use PIC16F84/A series. Over all schematic are like below.
VSC Clock schematic are like this (VSC_ClkS2.sch, VSC_Clock_Schematic.pdf).
C. LAYOUT
I just design the PCB only for the PIC microcontroller part, because the leds indicator mount directly to the clock body itself. Not much left from the circuitry because its already so simple. Not to good but run well. Here is one of PCB prototype. The power supply already include in the PCB design. Just connect it to a small wall wart transformer to run it. Leds connection have flying wires. Additional circuit put in another PCB layout, or direct flying wire connection.
Here is the PCB layout (VSC_ClkP_2.pcb, VSC_Clock_Layout.pdf, VSC_Clock_Artwork.pdf).
D. PART LIST
Here are the part list for this clock circuit :
1. Resistors :
R1 ~ R4, R4a = 220 Ohm, 1/4W, 5% ........................... 5 pcs
R5 ~ R7 = 10k, 1/4W, 5% .................................... 3 pcs
R8 = 4k7, 1/4W, 5% ......................................... 1 pcs
R9 = 100 Ohm, 1/4W, 5% ..................................... 1 pcs
R10 ~ R11 = 1k, 1/4W, 5% ................................... 2 pcs
R12 = 100k, 1/4W, 5% ....................................... 1 pcs
2. Capasitors : C1 ~ C2 = 22 pF (for oscillator) ........................... 2 pcs C3 = 100 nF (for IC decoupling, used as necessary).......... 1 pcs C4 = 33 uF/16 V ............................................ 1 pcs C5 = 100 uF/ 16 V .......................................... 1 pcs C6 = 10 uF/ 16 V ........................................... 1 pcs
3. Semiconductors : IC1 = PIC16F84/A (PIC microcontroller) .................... 1 pcs IC1 optional = PIC16F628/A (PIC microcontroller) alt ....... 1 pcs Q1 = BC548B (NPN Transistor) ............................... 1 pcs D2, D3, D4 = 1N914 (Silicon diode) ......................... 3 pcs D1, BD = 1N4007 (Silicon diode) ............................ 5 pcs DZ = 5V1 (Zener diode) ..................................... 1 pcs BZ1 = Piezo buzzer ......................................... 1 pcs LED1 ~ LED12 = 5mm, Red (Clear type) (for hours ind) ...... 12 pcs LED13 ~ LED23 = 5mm, Blu (Clear type) (for minutes-5 ind) . 11 pcs LED24 = 12mm, Red/Grn (Clear type, bicolor) (for AM/PM ind) 1 pcs LED25 ~ LED28 = 5mm, Grn (Clear type) (for minutes part ind) 4 pcs LED29 ~ LED32 = 5mm, Yel (Clear type) (for direction ind) .. 4 pcs
4. Others : X1 = 4 MHz (Clock Crystal oscillator) ...................... 1 pcs Optional IC socket for 18-pins (use 20-pins) ............... 1 pcs Optional terminal connector CON1 ~ CON2 = 2 pin (power) .... 2 pcs S1 = Miniature push button (Push on) ....................... 1 pcs PCB = 4 x 6 cm (single layer) .............................. 1 pcs 1-sec. clock generator, from orig. clock circuit pcb ....... 1 pcs T1 = Miniature transformer P=220V/S=6V3, 100mA, 1W ......... 1 pcs
E. FIRMWARE
I already had design before, when I made my PIC Digital Clock. This clock has the same algorithm except for the different display indicator subroutine. But both has a multiplexed method. The real complicated to me is the new chip itself. At first I can't programmed it using my El-Cheapo programmer (my PIC programmer). The programmer not support this type yet. So I search the net for the new programmer. At last I found a simple one, called RCD programmer. Using a free software from DL4YHF's WinPic - A PIC Programmer for Windows, the chip could be programmed well. The firmware write in ASM type, compiled with the free MPLAB assembler compiler also. Note that the compiled hex file is for the PIC16F628/A type. For PIC16F84/A you must change the proper lines.
Some info about the algorithm :
- Routine using 1 msec interrupt timer, using PIC timer as RTC clock
- Displayed leds indicator using multiplexed method. There is a ring counter to refresh display between hours, minutes-5, minutes+1, and AM/PM leds indicator. The speed is about 976/4 msec. Only the proper clock number will be displayed at a time, so the current use is very small. May be about 1 led consumption only.
Here is the final firmware for version 2.0 : VSC Clock (VSC_Clk2a.asm, VSC_Clk2a.hex).
F. EXTENDED VERSION OF PIC SERIES
This following experiment connected to PIC16F628/A series only. PIC 16F628/A or we call it new PIC afterwards, has the ability to programmed more. The MCLRE pin (port RA-5) can be programmed to become an input pin. Besides that it has an internal clock oscillator also. It means that, we can omit the x'tal clock and caps, and only use the internal clock oscillator itself. There are 2 kind of internal clock oscillator could be selected. PIC16F628 has 4 MHz and 37 kHz, while PIC16F628A has 4 MHz and 48 kHz. By using this internal clock oscillator, we have a spare another 2 I/O (port RA-6 and RA-7). The total I/O that could be utilized from this new PIC are (8 x 2) I/O. All of its pin are for I/O, just left 2 for power. Hard to believe it, but its true. None of others microcontroller, as I know, has the ability like this. What a piece of a chip???
Experiment later with this option, gives the result that the clock moving to faster, when I run it for a night, the clock faster by 6 minutes or about 1 minutes every hour. So the option can not be used for the problem where the critical timing must be keep. But to run for a usual program like a roaming robot, its a good choice, because the 'brain' is so simple enough and have all the spare of its I/O pins. So for our clock it still must use x'tal clock to retain the time, or if you have much more time, you can experiment with the correction factor to make the clock run well. It means only 1 I/O spare to use for the other option. There are so many option I want to add to this clock, like: an indicator option to differentiate AM/PM time, a sound for each hour to indicated what time now by count the number of it, more direction led to sign the clock when see it in the dark, etc...etc... Only RA-5 could be utilize for another purpose, so all option must be choose which one you want to use. New firmware to experiment with could be obtain here (VSC_Clk3.asm). But the firmware experiment still not final and have many bugs yet!
G. PROTOTYPE
Here is my prototype clock looks like. I use an already broken clock for the body. All leds directly put in the front panel and connect using flying wires. It use 2 pcs AA battery for backup and retain the clock. Backup current is about 1 mA, while run it normally takes about 6 to 7 mA or more for the other support circuitry. Some info, for AM/PM led, I use a bi-color led and not a bi-polar led, because if using a bipolar led, it will be interfere by another line if on. So don't use a bipolar led as I told before. It can't be used at all. This is an errata. I will cover this technical on my next project, Sun Clock.
H. IMPLEMENTATION
Base on my experience before (BCD clock), since this is an unusual clock, it may be too difficult to read by another person. I lived with my family, so I didn't put it at my dining room, because another person always complain about the time, it's a little hard to interpreted it. Better to put this VSC clock at my living room just to compare the result and I could see the performance itself. I will put the visual performance later on. Isn't it cool? Build your own VSC clock know!!!
- Development phase view, see the changer of green led (minutes+1) and in the dark view - 11 seconds
- Final view, see the changer of green leds (minutes+1) and blue led (minutes 5) - 25 seconds
- Final view, with a closer angle, see the changer in the dark - 20 seconds
I. HOW TO READ
Someone always ask, how to read the clock?
Here how to read the clock. Red leds at the most inner side represent the hours from the usual clock number location. The count start from 1 to 12. Blue leds at the outer side represent the minutes in unit 5 count depends on the clock number location, the count start from 5 ... 10 ... 15 , and continue up to 55, No need to represent the 60 number because it will be jump to next hour. The 4 most outer orange leds are for the direction only, it will be blink for about 1 sec continuously, for the night vision. 4 green leds at the top line represent the minutes adder in 1 unit each. It start from 1 to 4 count. These green leds must be add to the minutes count location number from blue leds. Both leds then represent the minutes now time. At last the center led represent AM/PM time. This is a bi-color leds. First color represent AM time and if both color on, it represent PM time. The clock reads from red led position, blue led position + green leds an the center led. eg: clock at the right above (dark) picture represent that the time is : 10:32 - PM.
No comments:
Post a Comment