G. IMPLEMENTATION
Here is the implementation of my prototype, before and after using the new one.
H. DUAL TIMER SCHEMATIC
Some people ask me to build the dual timer version, while I don't see the benefit of this dual timer for. They want 2 output relays, which could be set as what the single do. But for the curiosity and enthusiasm I made what they ask! The difficulty is I already run out of the I/O spare. So by making some changes with pin MCLR and utilize it, then it become one more input. But this could be done only with PIC16F628/A types and not for PIC16F84/A types. What a pity, there is no help for it! With this new configuration, not to much changes, the I/O map are like these :
The schematics are like these : (Dual_TimerS.sch, Dual_Timer-24_Schematic.pdf)
I/O port A-0 = Function Select button (Input) I/O port A-1 = Driving Relay 2 (Output) I/O port A-2 = Led indicator 1 (Output) I/O port A-3 = Led indicator 2 (Output) I/O port A-4 = Driving Relay 1 (Output) I/O port A-5 = Increment button (Input) I/O port B-0 ~ B-7 = Number indicator (Output)
Now there are 4 leds to distinguish the operation option for setting the time!
I. LAYOUT
The PCB design changed from the original with some modification to accommodate the 2 option relay outputs. Almost all of the other components not different. here is the new design :
Here is the PCB Layout : (Dual_TimerP.pcb, Dual_Timer-24_Layout.pdf, Dual_Timer-24_Artwork.pdf)
J. PART LIST
Here are the part list for this dual timers controller :
1. Resistors :
R1 ~ R8, R11 ~ R14 = 1k, 1/4W, 5% ......................... 12 pcs
R9, R10 = 4k7, 1/4W, 5% .................................... 2 pcs
R15, R16 = 10k, 1/4W, 5% ................................... 2 pcs
2. Capasitors : C1 ~ C2 = 33 pF (for oscillator) ........................... 2 pcs C3 = 100 nF (for IC decoupling, used as necessary).......... 1 pcs C4 = 220 uF/ 25 V .......................................... 1 pcs C5 = 100 uF/ 25 V .......................................... 1 pcs
3. Semiconductors : IC1 = PIC16F628/A (PIC microcontroller) ................... 1 pcs IC2 = 7805 (Voltage regulator) ............................. 1 pcs Q1, Q2 = C1061 or H1061 (Power NPN transistor) ............. 2 pcs Q1, Q2 (alt) = BC548B (NPN transistor) output up to 25 mA .. 2 pcs D1, D2 = 1N914 (Silicon diode) ............................. 2 pcs D3, D4, BD = 1N4007 (Silicon diode) ........................ 6 pcs LED1 ~ LED12 = 3mm, Red, Yel, Grn (For indicator) ......... 12 pcs
4. Others : X1 = 32.768 kHz (Clock Crystal oscillator) ................. 1 pcs X1 = 4 MHz (Optional Clock Crystal oscillator) ............. 1 pcs Optional IC socket for 18-pins (use 20-pins) ............... 1 pcs Optional terminal connector CON1 ~ CON4 = 2 pin (power) .... 4 pcs S1 ~S2 = Miniature push button (Push on) ................... 2 pcs TR1 = Miniature transformer, P-220V/S-12V, 100 mA .......... 1 pcs PCB material or vero board, (6x6cm, 6x8cm) ................. 2 pcs RL1 = 12V/20mA Power Relay (output 220V-AC/3A) ............. 2 pcs
K. FIRMWARE
Dual timer Firmware design not to much different from the single one. The new algorithm has the sequence like this :
Real time clock run using TMR0 interrupt timer 1 sec. There are 13 states made by Function Select button consecutively roll over, ie;
State 1 - Normal Clock operation, just display the hours and minutes in interval 2 sec. State 2 - Setting Clock hour, display only clock hour number part State 3 - Setting Clock minute, display clock minute number part State 4 - Setting Time1-On set, display hour number part State 5 - Setting Time1-On set, display minute number part State 6 - Setting Time1-Off set, display hour number part State 7 - Setting Time1-Off set, display minute number part State 8 - Setting Time2-On set, display hour number part State 9 - Setting Time2-On set, display minute number part State 10 - Setting Time2-Off set, display hour number part State 11 - Setting Time2-Off set, display minute number part Each state pair indicates by 2 output leds Minute or hour number count up by pressing increment button Clock setting to set the real time clock Time1-On setting to set the time when relay1 output on Time1-Off setting to set the time when relay1 output off Time2-On setting to set the time when relay2 output on Time2-Off setting to set the time when relay2 output off Number are show in BCD format in 2-digits
I made 2 version of these firmware, one using the low crystal clock 32.768 kHz, and another using 4 MHz crystal clock. Low crystal clock gave the result some flicker of output relays when on. While the high one none seem the symptom. I doubt that the latency time to long for low crystal use (?). Both still had some bugs, when setting the time for relay1 output, led L11 was never on. I still don't know why? Where the wrong routine point is? Could some one find it? Please inform me. The functionality of the firmware still run well. The time can be adjusted normally, but a little difficult to different which one still set.
Here is the firmware both : (Dual_Timer.asm, Dual_Timer.hex, Dual_Timers.asm, Dual_Timers.hex)
I use PIC16F628A type controller both, and dual_timer for low crystal use 32.768 kHz, and dual_timers for 4MHz crystal use.
L. PROTOTYPE
Here are a few shot of my prototype looks like :
Bro do not download bro plz help me bro
ReplyDelete