Very Simple Clock using PIC series microcontroller

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.
















Experiment running using 2 - AA 1.5V type battery, because the lithium battery gives to small current consumption, and the time may stop running and gives the bad result when it comes to live again. This experience base on my BCD clock before, that give the bad result. AA batteries will give a long life prevention.

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!!!






If you want to see the visual performance of this VSC clock, here I capture a view of it (in 3GP format) :

  • 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

Labels

PROJECTS 8086 PIN CONFIGURATION 80X86 PROCESSORS TRANSDUCERS 8086 – ARCHITECTURE Hall-Effect Transducers INTEL 8085 OPTICAL MATERIALS BIPOLAR TRANSISTORS INTEL 8255 Optoelectronic Devices Thermistors thevenin's theorem MAXIMUM MODE CONFIGURATION OF 8086 SYSTEM ASSEMBLY LANGUAGE PROGRAMME OF 80X86 PROCESSORS POWER PLANT ENGINEERING PRIME MOVERS 8279 with 8085 MINIMUM MODE CONFIGURATION OF 8086 SYSTEM MISCELLANEOUS DEVICES MODERN ENGINEERING MATERIALS 8085 Processor- Q and A-1 BASIC CONCEPTS OF FLUID MECHANICS OSCILLATORS 8085 Processor- Q and A-2 Features of 8086 PUMPS AND TURBINES 8031/8051 MICROCONTROLLER Chemfet Transducers DIODES FIRST LAW OF THERMODYNAMICS METHOD OF STATEMENTS 8279 with 8086 HIGH VOLTAGE ENGINEERING OVERVOLATGES AND INSULATION COORDINATION Thermocouples 8251A to 8086 ARCHITECTURE OF 8031/8051 Angle-Beam Transducers DATA TRANSFER INSTRUCTIONS IN 8051/8031 INSTRUCTION SET FOR 8051/8031 INTEL 8279 KEYBOARD AND DISPLAY INTERFACES USING 8279 LOGICAL INSTRUCTIONS FOR 8051/8031 Photonic Transducers TECHNOLOGICAL TIPS THREE POINT STARTER 8257 with 8085 ARITHMETIC INSTRUCTIONS IN 8051/8031 LIGHTNING PHENOMENA Photoelectric Detectors Physical Strain Gage Transducers 8259 PROCESSOR APPLICATIONS OF HALL EFFECT BRANCHING INSTRUCTIONS FOR 8051/8031 CPU OF 8031/8051 Capacitive Transducers DECODER Electromagnetic Transducer Hall voltage INTEL 8051 MICROCONTROLLER INTEL 8251A Insulation Resistance Test PINS AND SIGNALS OF 8031/8051 Physical Transducers Resistive Transducer STARTERS Thermocouple Vacuum Gages USART-INTEL 8251A APPLICATIONs OF 8085 MICROPROCESSOR CAPACITANCE Data Transfer Instructions In 8086 Processors EARTH FAULT RELAY ELECTRIC MOTORS ELECTRICAL AND ELECTRONIC INSTRUMENTS ELECTRICAL BREAKDOWN IN GASES FIELD EFFECT TRANSISTOR (FET) INTEL 8257 IONIZATION AND DECAY PROCESSES Inductive Transducers Microprocessor and Microcontroller OVER CURRENT RELAY OVER CURRENT RELAY TESTING METHODS PhotoConductive Detectors PhotoVoltaic Detectors Registers Of 8051/8031 Microcontroller Testing Methods ADC INTERFACE AMPLIFIERS APPLICATIONS OF 8259 EARTH ELECTRODE RESISTANCE MEASUREMENT TESTING METHODS EARTH FAULT RELAY TESTING METHODS Electricity Ferrodynamic Wattmeter Fiber-Optic Transducers IC TESTER IC TESTER part-2 INTERRUPTS Intravascular imaging transducer LIGHTNING ARRESTERS MEASUREMENT SYSTEM Mechanical imaging transducers Mesh Current-2 Millman's Theorem NEGATIVE FEEDBACK Norton's Polarity Test Potentiometric transducers Ratio Test SERIAL DATA COMMUNICATION SFR OF 8051/8031 SOLIDS AND LIQUIDS Speed Control System 8085 Stepper Motor Control System Winding Resistance Test 20 MVA 6-digits 6-digits 7-segment LEDs 7-segment A-to-D A/D ADC ADVANTAGES OF CORONA ALTERNATOR BY POTIER & ASA METHOD ANALOG TO DIGITAL CONVERTER AUXILIARY TRANSFORMER AUXILIARY TRANSFORMER TESTING AUXILIARY TRANSFORMER TESTING METHODS Analog Devices A–D BERNOULLI’S PRINCIPLE BUS BAR BUS BAR TESTING Basic measuring circuits Bernoulli's Equation Bit Manipulation Instruction Buchholz relay test CORONA POWER LOSS CURRENT TRANSFORMER CURRENT TRANSFORMER TESTING Contact resistance test Current to voltage converter DAC INTERFACE DESCRIBE MULTIPLY-EXCITED Digital Storage Oscilloscope Display Driver Circuit E PROMER ELPLUS NT-111 EPROM AND STATIC RAM EXCITED MAGNETIC FIELD Electrical Machines II- Exp NO.1 Energy Meters FACTORS AFFECTING CORONA FLIP FLOPS Fluid Dynamics and Bernoulli's Equation Fluorescence Chemical Transducers Foil Strain Gages HALL EFFECT HIGH VOLTAGE ENGG HV test HYSTERESIS MOTOR Hall co-efficient Hall voltage and Hall Co-efficient High Voltage Insulator Coating Hot-wire anemometer How to Read a Capacitor? IC TESTER part-1 INSTRUMENT TRANSFORMERS Importance of Hall Effect Insulation resistance check Insulator Coating Knee point Test LEDs LEDs Display Driver LEDs Display Driver Circuit LM35 LOGIC CONTROLLER LPT LPT PORT LPT PORT EXPANDER LPT PORT LPT PORT EXTENDER Life Gone? MAGNETIC FIELD MAGNETIC FIELD SYSTEMS METHOD OF STATEMENT FOR TRANSFORMER STABILITY TEST METHODS OF REDUCING CORONA EFFECT MULTIPLY-EXCITED MULTIPLY-EXCITED MAGNETIC FIELD SYSTEMS Mesh Current Mesh Current-1 Moving Iron Instruments Multiplexing Network Theorems Node Voltage Method On-No Load And On Load Condition PLC PORT EXTENDER POTIER & ASA METHOD POWER TRANSFORMER POWER TRANSFORMER TESTING POWER TRANSFORMER TESTING METHODS PROGRAMMABLE LOGIC PROGRAMMABLE LOGIC CONTROLLER Parallel Port EXPANDER Paschen's law Piezoelectric Wave-Propagation Transducers Potential Transformer RADIO INTERFERENCE RECTIFIERS REGULATION OF ALTERNATOR REGULATION OF THREE PHASE ALTERNATOR Read a Capacitor SINGLY-EXCITED SOLIDS AND LIQUIDS Classical gas laws Secondary effects Semiconductor strain gages Speaker Driver Strain Gages Streamer theory Superposition Superposition theorem Swinburne’s Test TMOD TRANSFORMER TESTING METHODS Tape Recorder Three-Phase Wattmeter Transformer Tap Changer Transformer Testing Vector group test Virus Activity Voltage Insulator Coating Voltage To Frequency Converter Voltage to current converter What is analog-to-digital conversion Windows work for Nokia capacitor labels excitation current test magnetic balance voltage to frequency converter wiki electronic frequency converter testing voltage with a multimeter 50 hz voltages voltmeter

Search More Posts

Followers