Silicon ChipBig-Digit 12/24-Hour Clock - March 2001 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: The electrical wiring debate - reform is needed
  4. Feature: What's On Offer In "Walkie Talkies" by Ross Tester
  5. Feature: Mobile Magic: Driving Your Mobile Phone From A PC by Greg Swain
  6. Feature: Using Infrared Devices With Your PC by Greg Swain
  7. Review: Reiew: Marantz DR 6000 CD Recorder by Leo Simpson
  8. Feature: CB Radio Can Now Transmit Data by Silicon Chip
  9. Project: Big-Digit 12/24-Hour Clock by John Clarke
  10. Product Showcase
  11. Project: A Sun-Seeking Sunflower by Craig Maynard & Ross Tester
  12. Project: Parallel Port PIC Programmer & Checkerboard by David Deer
  13. Feature: Making Photo Resist PC Boards At Home by Ross Tester
  14. Project: Protoboards: More Fun With Comparators by Leo Simpson
  15. Project: More-MIDI: A Simple MIDI Expansion Box by Jim Rowe
  16. Vintage Radio: The 1929 AWA C58 radiogram by Rodney Champness
  17. Back Issues
  18. Notes & Errata
  19. Product Showcase
  20. Market Centre
  21. Advertising Index
  22. Outer Back Cover

This is only a preview of the March 2001 issue of Silicon Chip.

You can view 32 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Articles in this series:
  • Amateur Radio (November 1987)
  • Amateur Radio (November 1987)
  • Amateur Radio (December 1987)
  • Amateur Radio (December 1987)
  • Amateur Radio (February 1988)
  • Amateur Radio (February 1988)
  • Amateur Radio (March 1988)
  • Amateur Radio (March 1988)
  • Amateur Radio (April 1988)
  • Amateur Radio (April 1988)
  • Amateur Radio (May 1988)
  • Amateur Radio (May 1988)
  • Amateur Radio (June 1988)
  • Amateur Radio (June 1988)
  • Amateur Radio (July 1988)
  • Amateur Radio (July 1988)
  • Amateur Radio (August 1988)
  • Amateur Radio (August 1988)
  • Amateur Radio (September 1988)
  • Amateur Radio (September 1988)
  • Amateur Radio (October 1988)
  • Amateur Radio (October 1988)
  • Amateur Radio (November 1988)
  • Amateur Radio (November 1988)
  • Amateur Radio (December 1988)
  • Amateur Radio (December 1988)
  • Amateur Radio (January 1989)
  • Amateur Radio (January 1989)
  • Amateur Radio (April 1989)
  • Amateur Radio (April 1989)
  • Amateur Radio (May 1989)
  • Amateur Radio (May 1989)
  • Amateur Radio (June 1989)
  • Amateur Radio (June 1989)
  • Amateur Radio (July 1989)
  • Amateur Radio (July 1989)
  • Amateur Radio (August 1989)
  • Amateur Radio (August 1989)
  • Amateur Radio (September 1989)
  • Amateur Radio (September 1989)
  • Amateur Radio (October 1989)
  • Amateur Radio (October 1989)
  • Amateur Radio (November 1989)
  • Amateur Radio (November 1989)
  • Amateur Radio (December 1989)
  • Amateur Radio (December 1989)
  • Amateur Radio (February 1990)
  • Amateur Radio (February 1990)
  • Amateur Radio (March 1990)
  • Amateur Radio (March 1990)
  • Amateur Radio (April 1990)
  • Amateur Radio (April 1990)
  • Amateur Radio (May 1990)
  • Amateur Radio (May 1990)
  • Amateur Radio (June 1990)
  • Amateur Radio (June 1990)
  • Amateur Radio (July 1990)
  • Amateur Radio (July 1990)
  • The "Tube" vs. The Microchip (August 1990)
  • The "Tube" vs. The Microchip (August 1990)
  • Amateur Radio (September 1990)
  • Amateur Radio (September 1990)
  • Amateur Radio (October 1990)
  • Amateur Radio (October 1990)
  • Amateur Radio (November 1990)
  • Amateur Radio (November 1990)
  • Amateur Radio (December 1990)
  • Amateur Radio (December 1990)
  • Amateur Radio (January 1991)
  • Amateur Radio (January 1991)
  • Amateur Radio (February 1991)
  • Amateur Radio (February 1991)
  • Amateur Radio (March 1991)
  • Amateur Radio (March 1991)
  • Amateur Radio (April 1991)
  • Amateur Radio (April 1991)
  • Amateur Radio (May 1991)
  • Amateur Radio (May 1991)
  • Amateur Radio (June 1991)
  • Amateur Radio (June 1991)
  • Amateur Radio (July 1991)
  • Amateur Radio (July 1991)
  • Amateur Radio (August 1991)
  • Amateur Radio (August 1991)
  • Amateur Radio (September 1991)
  • Amateur Radio (September 1991)
  • Amateur Radio (October 1991)
  • Amateur Radio (October 1991)
  • Amateur Radio (November 1991)
  • Amateur Radio (November 1991)
  • Amateur Radio (January 1992)
  • Amateur Radio (January 1992)
  • Amateur Radio (February 1992)
  • Amateur Radio (February 1992)
  • Amateur Radio (March 1992)
  • Amateur Radio (March 1992)
  • Amateur Radio (July 1992)
  • Amateur Radio (July 1992)
  • Amateur Radio (August 1992)
  • Amateur Radio (August 1992)
  • Amateur Radio (September 1992)
  • Amateur Radio (September 1992)
  • Amateur Radio (October 1992)
  • Amateur Radio (October 1992)
  • Amateur Radio (November 1992)
  • Amateur Radio (November 1992)
  • Amateur Radio (January 1993)
  • Amateur Radio (January 1993)
  • Amateur Radio (March 1993)
  • Amateur Radio (March 1993)
  • Amateur Radio (May 1993)
  • Amateur Radio (May 1993)
  • Amateur Radio (June 1993)
  • Amateur Radio (June 1993)
  • Amateur Radio (July 1993)
  • Amateur Radio (July 1993)
  • Amateur Radio (August 1993)
  • Amateur Radio (August 1993)
  • Amateur Radio (September 1993)
  • Amateur Radio (September 1993)
  • Amateur Radio (October 1993)
  • Amateur Radio (October 1993)
  • Amateur Radio (December 1993)
  • Amateur Radio (December 1993)
  • Amateur Radio (February 1994)
  • Amateur Radio (February 1994)
  • Amateur Radio (March 1994)
  • Amateur Radio (March 1994)
  • Amateur Radio (May 1994)
  • Amateur Radio (May 1994)
  • Amateur Radio (June 1994)
  • Amateur Radio (June 1994)
  • Amateur Radio (September 1994)
  • Amateur Radio (September 1994)
  • Amateur Radio (December 1994)
  • Amateur Radio (December 1994)
  • Amateur Radio (January 1995)
  • Amateur Radio (January 1995)
  • CB Radio Can Now Transmit Data (March 2001)
  • CB Radio Can Now Transmit Data (March 2001)
  • What's On Offer In "Walkie Talkies" (March 2001)
  • What's On Offer In "Walkie Talkies" (March 2001)
  • Stressless Wireless (October 2004)
  • Stressless Wireless (October 2004)
  • WiNRADiO: Marrying A Radio Receiver To A PC (January 2007)
  • WiNRADiO: Marrying A Radio Receiver To A PC (January 2007)
  • “Degen” Synthesised HF Communications Receiver (January 2007)
  • “Degen” Synthesised HF Communications Receiver (January 2007)
  • PICAXE-08M 433MHz Data Transceiver (October 2008)
  • PICAXE-08M 433MHz Data Transceiver (October 2008)
  • Half-Duplex With HopeRF’s HM-TR UHF Transceivers (April 2009)
  • Half-Duplex With HopeRF’s HM-TR UHF Transceivers (April 2009)
  • Dorji 433MHz Wireless Data Modules (January 2012)
  • Dorji 433MHz Wireless Data Modules (January 2012)
Articles in this series:
  • Amateur Radio (November 1987)
  • Amateur Radio (November 1987)
  • Amateur Radio (December 1987)
  • Amateur Radio (December 1987)
  • Amateur Radio (February 1988)
  • Amateur Radio (February 1988)
  • Amateur Radio (March 1988)
  • Amateur Radio (March 1988)
  • Amateur Radio (April 1988)
  • Amateur Radio (April 1988)
  • Amateur Radio (May 1988)
  • Amateur Radio (May 1988)
  • Amateur Radio (June 1988)
  • Amateur Radio (June 1988)
  • Amateur Radio (July 1988)
  • Amateur Radio (July 1988)
  • Amateur Radio (August 1988)
  • Amateur Radio (August 1988)
  • Amateur Radio (September 1988)
  • Amateur Radio (September 1988)
  • Amateur Radio (October 1988)
  • Amateur Radio (October 1988)
  • Amateur Radio (November 1988)
  • Amateur Radio (November 1988)
  • Amateur Radio (December 1988)
  • Amateur Radio (December 1988)
  • Amateur Radio (January 1989)
  • Amateur Radio (January 1989)
  • Amateur Radio (April 1989)
  • Amateur Radio (April 1989)
  • Amateur Radio (May 1989)
  • Amateur Radio (May 1989)
  • Amateur Radio (June 1989)
  • Amateur Radio (June 1989)
  • Amateur Radio (July 1989)
  • Amateur Radio (July 1989)
  • Amateur Radio (August 1989)
  • Amateur Radio (August 1989)
  • Amateur Radio (September 1989)
  • Amateur Radio (September 1989)
  • Amateur Radio (October 1989)
  • Amateur Radio (October 1989)
  • Amateur Radio (November 1989)
  • Amateur Radio (November 1989)
  • Amateur Radio (December 1989)
  • Amateur Radio (December 1989)
  • Amateur Radio (February 1990)
  • Amateur Radio (February 1990)
  • Amateur Radio (March 1990)
  • Amateur Radio (March 1990)
  • Amateur Radio (April 1990)
  • Amateur Radio (April 1990)
  • Amateur Radio (May 1990)
  • Amateur Radio (May 1990)
  • Amateur Radio (June 1990)
  • Amateur Radio (June 1990)
  • Amateur Radio (July 1990)
  • Amateur Radio (July 1990)
  • The "Tube" vs. The Microchip (August 1990)
  • The "Tube" vs. The Microchip (August 1990)
  • Amateur Radio (September 1990)
  • Amateur Radio (September 1990)
  • Amateur Radio (October 1990)
  • Amateur Radio (October 1990)
  • Amateur Radio (November 1990)
  • Amateur Radio (November 1990)
  • Amateur Radio (December 1990)
  • Amateur Radio (December 1990)
  • Amateur Radio (January 1991)
  • Amateur Radio (January 1991)
  • Amateur Radio (February 1991)
  • Amateur Radio (February 1991)
  • Amateur Radio (March 1991)
  • Amateur Radio (March 1991)
  • Amateur Radio (April 1991)
  • Amateur Radio (April 1991)
  • Amateur Radio (May 1991)
  • Amateur Radio (May 1991)
  • Amateur Radio (June 1991)
  • Amateur Radio (June 1991)
  • Amateur Radio (July 1991)
  • Amateur Radio (July 1991)
  • Amateur Radio (August 1991)
  • Amateur Radio (August 1991)
  • Amateur Radio (September 1991)
  • Amateur Radio (September 1991)
  • Amateur Radio (October 1991)
  • Amateur Radio (October 1991)
  • Amateur Radio (November 1991)
  • Amateur Radio (November 1991)
  • Amateur Radio (January 1992)
  • Amateur Radio (January 1992)
  • Amateur Radio (February 1992)
  • Amateur Radio (February 1992)
  • Amateur Radio (March 1992)
  • Amateur Radio (March 1992)
  • Amateur Radio (July 1992)
  • Amateur Radio (July 1992)
  • Amateur Radio (August 1992)
  • Amateur Radio (August 1992)
  • Amateur Radio (September 1992)
  • Amateur Radio (September 1992)
  • Amateur Radio (October 1992)
  • Amateur Radio (October 1992)
  • Amateur Radio (November 1992)
  • Amateur Radio (November 1992)
  • Amateur Radio (January 1993)
  • Amateur Radio (January 1993)
  • Amateur Radio (March 1993)
  • Amateur Radio (March 1993)
  • Amateur Radio (May 1993)
  • Amateur Radio (May 1993)
  • Amateur Radio (June 1993)
  • Amateur Radio (June 1993)
  • Amateur Radio (July 1993)
  • Amateur Radio (July 1993)
  • Amateur Radio (August 1993)
  • Amateur Radio (August 1993)
  • Amateur Radio (September 1993)
  • Amateur Radio (September 1993)
  • Amateur Radio (October 1993)
  • Amateur Radio (October 1993)
  • Amateur Radio (December 1993)
  • Amateur Radio (December 1993)
  • Amateur Radio (February 1994)
  • Amateur Radio (February 1994)
  • Amateur Radio (March 1994)
  • Amateur Radio (March 1994)
  • Amateur Radio (May 1994)
  • Amateur Radio (May 1994)
  • Amateur Radio (June 1994)
  • Amateur Radio (June 1994)
  • Amateur Radio (September 1994)
  • Amateur Radio (September 1994)
  • Amateur Radio (December 1994)
  • Amateur Radio (December 1994)
  • Amateur Radio (January 1995)
  • Amateur Radio (January 1995)
  • CB Radio Can Now Transmit Data (March 2001)
  • CB Radio Can Now Transmit Data (March 2001)
  • What's On Offer In "Walkie Talkies" (March 2001)
  • What's On Offer In "Walkie Talkies" (March 2001)
  • Stressless Wireless (October 2004)
  • Stressless Wireless (October 2004)
  • WiNRADiO: Marrying A Radio Receiver To A PC (January 2007)
  • WiNRADiO: Marrying A Radio Receiver To A PC (January 2007)
  • “Degen” Synthesised HF Communications Receiver (January 2007)
  • “Degen” Synthesised HF Communications Receiver (January 2007)
  • PICAXE-08M 433MHz Data Transceiver (October 2008)
  • PICAXE-08M 433MHz Data Transceiver (October 2008)
  • Half-Duplex With HopeRF’s HM-TR UHF Transceivers (April 2009)
  • Half-Duplex With HopeRF’s HM-TR UHF Transceivers (April 2009)
  • Dorji 433MHz Wireless Data Modules (January 2012)
  • Dorji 433MHz Wireless Data Modules (January 2012)
Items relevant to "Big-Digit 12/24-Hour Clock":
  • Big-Digit 12/24-Hour Clock display PCB [04103012/04102011] (AUD $15.00)
  • Big-Digit 12/24-Hour Clock processor PCB [04103011] (AUD $15.00)
  • PIC16F84(A)-04/P programmed for the Big-Digit 12/24-Hour Clock [CLOCK1.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F84 firmware and source code for the Big-Digit 12/24-Hour Clock [CLOCK1.HEX] (Software, Free)
  • Big-Digit 12/24-Hour Clock PCB patterns (PDF download) [04103011/2] (Free)
  • Big-Digit 12/24-Hour Clock panel artwork and mask (PDF download) (Free)
Items relevant to "A Sun-Seeking Sunflower":
  • Sun-seeking Sunflower PCB patterns (PDF download) (Free)
Items relevant to "Parallel Port PIC Programmer & Checkerboard":
  • DOS and Windows software for the Parallel Port PIC Programmer (Free)
  • Parallel Port PIC Programmer PCB pattern (PDF download) (Free)
Items relevant to "More-MIDI: A Simple MIDI Expansion Box":
  • More-MIDI PCB pattern (PDF download) (Free)
  • More-MIDI panel artwork (PDF download) (Free)

Purchase a printed copy of this issue for $10.00.

Do you need a big digital clock that you can see from a lo-onggg way away? Then have a look at this PIC-based clock. It’s large, it’s bright, it’s very accurate and can be used in either 12 or 24-hour modes. It’s ideal for the home, in factories, offices, emergency services, armed forces, airports, satellite control centres ... By JOHN CLARKE This latest clock from SILICON CHIP is no ordinary clock. It is based on a PIC microcontroller to provide a number of unique features including the ability to adjust for very accurate timekeeping. For high visibility, it uses super large digits, 57mm high, for the hours and minutes and smaller digits for the seconds. The large digits use high efficiency LEDs which means they are bright and much more visible from a distance than any Liquid Crystal Display (LCD) could ever be. Nor does this mean they are blinding at night. The circuit senses the ambient light and so the display brightness is maximum in bright light 30  Silicon Chip but becomes dimmer in darker conditions. So visibility is good in virtually all light conditions (apart from direct sunlight). Not only is this clock big but it can also be adjusted for very good longterm accuracy. All crystal-based clocks exhibit some tendency to run fast or slow. Some have a trimmer on the crystal and can be adjusted for better accuracy but they will still drift due to temperature effects over a period of time. Our new design uses a PIC microcontroller and since this is programmed to provide a counter circuit which is actually a clock, we can incorporate a neat feature in the software to adjust the count for even better accuracy. Carefully done, it should mean that the clock keeps time within a few seconds a year – dramatically better than the average watch or crystal clock. The adjustment technique requires you to correctly set the clock and wait a few days to see how accurately it keeps time. Then a special adjustment mode is selected on the clock and the number of seconds the clock differs from correct time (calculated over a period of 60 days) is entered in. However, it is not necessary to wait 60 days and often a day or so is enough to get a good idea of how fast or slow the clock is running. The only requirement is that you then calculate the number of seconds it would gain or lose in 60 days. Of course, the more days you wait, the more accurate the adjustment but you can readjust the figure after a first attempt. Short seconds & long seconds After entering the adjustment figure, the clock then main­ tains time by slightly adjusting the length of a second every so often. If the crystal was running slow, there will be an occa­ sional shorter second to speed up the clock. If the clock was running fast, there will be an occasional longer second to slow down the clock. The actual variation in the seconds is so slight that they will be totally unnoticeable. A short second will be 999ms long, which is 1ms shorter than a full 1000ms second. A long second will be 1ms extra at 1.001 seconds. Internal to the microcontroller, the adjustment figure of seconds per 60 days is divided into the number 10,368 to obtain a reference counter value. For example, if the adjustment figure is 60 (1 second per day), then the reference counter value will be 10,368/60 = 172. This value is compared with a second counter which is increased once every 500ms. When the second counter value reaches the value of the reference counter, the current second is altered by 1ms. The second counter is then reset ready to count up again. For our example value, the second counter will reach 172 after 500 x 172ms = 86,400ms. Therefore, we make a correction of 1ms every 86,400ms which is equivalent to 1 second per day. Thus there will be 1000 correction seconds per day. Note that one day has 86,400 seconds. The number of seconds per 60 days adjustment figure re­quires a positive or negative sign to indicate whether the clock needs to use slow seconds or long seconds. A minus means that the clock is slow and needs speeding up Main Features • • • • • • • • • • • • Large 57mm 7-segment hour and minute displays Easily readable at 20m or more Smaller 14.2mm seconds displays 12 or 24-hour operation Plugpack powered with battery backup Automatic display dimming AM indicator in 12-hour mode Flashing colon between hours and minutes displays Easy-to-use Hour and Minute time setting switches Easy daylight saving adjustment Unique time accuracy adjustment technique requires no equipment Suitable for standard and variant pinout large displays while a plus (no sign) means the clock is fast and will need to be slowed. The adjustment range is from 0 to -255 and from 0 to 255 seconds per 60 days with a 1-second/60 day resolution. This corresponds to 0ppm through to ±50ppm adjustment with just under 0.2ppm steps. The time adjustment mode is initiated by pressing both the hour and minute switches together. The seconds display will then show “Ad” for “Adjustment” and when the switches are released will show the current adjustment figure. This is initially set to “0” and you can increase the number by pressing the hour switch and decrease it by pressing the minutes switch. If the number goes below zero, the value becomes negative as shown by the (-) sign and these negative numbers are used when the clock is running slow. The positive numbers are for fast clocks. You return to the clock mode by again pressing both switch­es and the display will show the time again. If the switches are not released but held down for about three seconds, the display will return to the adjust The prototype was built into a wooden (MDF) case, painted black and fitted with a red Perspex cover. Alternatively, you can build the unit into a folded aluminium case. MARCH 2001  31 32  Silicon Chip Fig.1 (left): the circuit uses an unusual supply arrangement to cope with the fact that IC1 runs from a 5V supply while the large 7-segment displays run from 12V (nominal). IC2 decodes the binary output from IC1 and performs logic level translation. mode again. Note that the time may alter when moving to the adjust mode as you press both switches but the adjustment number will not change when returning to the time mode provided the switches are pressed together within less than about 0.5 seconds of each other. The time will then need to be set correctly once the adjustment mode has been completed. The adjustment number is stored in memory and will be retained unless changed by entering this mode again. You can change the adjust value at any time by re-entering this mode. This may be necessary to adjust the number to set the best figure for accurate timekeeping over a yearly period. For example, if you find that the clock is one second fast every 60 days, you need to add a +1 to the current adjust figure. Thus, if the current adjust figure is -35 seconds/60 day correction, it must be changed using the hour switch to -34. If the original number was 35, then the new value would be 36. Clock setting The time on the clock is set by comparing against a refer­ence clock or the Telstra time service. You can hold the hours switch down so the numbers count up at a nominal 0.5s rate until the current hour is reached. Similarly, the minutes switch can be held down so that the count increases consecutively to reach the current minutes. You then wait until the reference clock begins the next minute and press the minutes switch. It will immediately return the seconds to 00 and set the minutes to the next count. This enables the clock to be set to start accurately. Easy daylight saving Changing to summer time for daylight saving can be a major exercise with some clocks since they require complete resetting of the minutes and seconds to change the hour. Not Parts List 1 processor PC board, code 04103011, 233 x 76mm 1 display PC board, code 04103012, 233 x 76mm 1 98 x 253 x 3mm red Perspex sheet 1 display mask, 98 x 253mm 1 12VDC 450mA plugpack 1 2.5mm PC-mount male power socket 1 4MHz crystal (X1) 4 56.9mm common cathode HE red 7-segment displays (Jaycar ZD-1850, LED Technology D23C4RRR141, Farnell 622-618 or equivalent) (DISP1DISP4) 2 12.7-14.2mm common cathode HE red 7-segment displays (LTS543R or equivalent) (DISP5,DISP6) 4 AA NiCd or NiMH cells with solder tags 2 click-action momentary push-on switches (S1,S2) 1 LDR (Jaycar RD-3480 or equivalent) (LDR1) 1 20-pin DIL IC socket for mounting DISP5 & DISP6 1 18-pin DIL IC socket for IC1 3 16-pin DIL sockets for 8-way pin headers 1 14-pin DIL socket for mounting S1 & S2 3 8-way pin headers 1 2-way pin header 1 shorting plug for 2-way header 4 15mm M3 tapped standoffs 4 M3 x 6mm screws 4 M3 x 10mm countersunk screws 2 blackened 4G self-tapping screws 8 PC stakes 1 1m length of 0.8mm tinned copper wire Semiconductors 1 PIC16F84AP or PIC16F84P microcontroller programmed with clock.hex (IC1) 1 4051 8-way analog multiplexer (IC2) 1 ULN2003A Darlington transistor driver (IC3) 1 7905 -5V 3-terminal regulator (REG1) 8 BC328 PNP transistors (Q1-Q8) 1 15V 1W zener diode (ZD1) 4 1N4004 1A diodes (D1-D4) 2 1N914, 1N4148 switching diodes (D5,D6) Capacitors 1 100µF 25VW PC electrolytic 5 10µF 16VW PC electrolytic 1 0.1µF MKT polyester 1 .0015µF MKT polyester 2 27pF NPO ceramic Resistors (0.25W, 1%) 1 470kΩ 7 220Ω 1 10kΩ 1 180Ω 1 4.7kΩ 7 82Ω 1 2.2kΩ 1 10Ω 1 1kΩ 1 2.2Ω 1W 5% 9 470Ω Miscellaneous Wooden case: 9mm MDF 100 x 235mm, 3mm MDF 98 x 253mm, picture frame hooks Metal Case: 1mm aluminium 347 x 192mm, 4 x 6mm tapped spacers Note: the source code for the clock chip (clock.hex) is available from www.siliconchip.com.au so with the SILICON CHIP PIC Clock. When daylight savings starts, simply press the hour switch ones. When it ends, hold down the hour switch until the previous hour is shown. The minutes and seconds are unaffected and the clock remains correctly set. Returning to standard time is even easier; just momentarily press the hour switch to set it to the next hour. Options The SILICON CHIP Clock is initially set for 12-hour time. It includes an AM indicator at the top lefthand side. You can set the clock for 24-hour operation simply by holding down the hour switch as power is first applied to the clock. The seconds dis­play will show “24” and when the switch is released the clock will be in 24-hour mode. The 24-hour mode will remain selected even if the power is disconnected. To return to 12-hour mode, simply press the hour switch again when power is applied to the clock and the seconds display will show “12”, indicating the 12-hour mode is seMARCH 2001  33 lected. Releasing the switch will start the clock. Although not really important to operation of the clock, there is an option to use two different pinout types for the large displays. We have called the two types “standard” and “variant”. The variant selection is the default. However, you can select for the standard pinout version by holding down the minutes switch at power up. The seconds display will show an “S” for standard and when released will drive the displays assuming the standard pinout. This selection will remain even if power is removed and then reapplied. To re-select the variant display, press the minutes switch at power up and the seconds display will show a “U” for variant (Yes, it’s a “U” but a “V” cannot be made with 7-segment displays). The standard/variant selection also involves inserting the correct links on the display PC board to configure the common cathode pins and the display segments for the two display types. The standard and variant mode selections within the PIC microcon­ troller swap some of the segments so that they show the correct characters. Display dimming In our previous PIC designs involving 7-segment LED dis­plays, we used a simple LDR-controlled transistor to vary the drive voltage for dimming. However, this does not work well with this clock circuit because of the varying number of LEDs used in the display segments. The large displays use four LEDs in series in their segments and two LEDs in the decimal 1/6th of the time (ie, the duty cycle is 16.6%). The dimming feature uses a .0015µF capacitor and LDR (Light Dependent Resistor) associated with pin 3 (RA4) of IC1. The capacitor is discharged each time a digit is about to be lit and the PIC waits until the capacitor is charged before lighting the display. In bright light the resistance of the LDR is low so the capacitor charges up quickly and the display is lit within a very short delay. In darkness or low light, the LDR has a much higher resistance and the capacitor takes longer to charge up, so the duty cycle for each digit is much reduced and it is dimmed down. The actual dimming resolution is about 155 steps from full brightness to minimum. The displays are only dimmed when the clock is in time mode. The displays are at full brightness when in the adjustment mode because the PIC processor has to perform a lot of calcula­tions which do not leave enough time for the dimming function. The clock is powered by a 12V DC plugpack but has battery backup to maintain timekeeping during power outages. During a blackout, only the seconds display, the flashing colon and the AM indicator will be visible Fig.2: two different large 7-segment displays can be used. These are the pinouts for both. points. The smaller seconds digits only have one LED per segment. So if the drive voltage was reduced to dim the displays, the large display segments would be dimmed much more than the decimal points or the seconds digits. For this reason, the display dimming is under software control and we do this by varying the duty cycle of the multi­ plexed signals for the 6-digit display. In a multiplexed display, only one digit is lit at a time but the displays are cycled at a rapid rate so that there is no noticeable flicker. When the displays are driven at full brightness, each display is lit for Table 2: Capacitor Codes     Value IEC Code  EIA Code 0.1µF   104   100n .0015µF   152   1n5 27pF    27   27p Table 1: Resistor Colour Codes  No.   1   1   1   1   1   9   7   1   7   1   1 34  Silicon Chip Value 470kΩ 10kΩ 4.7kΩ 2.2kΩ 1kΩ 470Ω 220Ω 180Ω 82Ω 10Ω 2.2Ω 4-Band Code (1%) yellow violet yellow brown brown black orange brown yellow violet red brown red red red brown brown black red brown yellow violet brown brown red red brown brown brown grey brown brown grey red black brown brown black black brown red red gold gold 5-Band Code (1%) yellow violet black orange brown brown black black red brown yellow violet black brown brown red red black brown brown brown black black brown brown yellow violet black black brown red red black black brown brown grey black black brown grey red black gold brown brown black black gold brown Fig.3: follow these parts layout diagrams to build the PC boards. Note the different link options on the display board for the stan­dard and variant large 7-segment displays. MARCH 2001  35 Fig.4: these diagrams show how the two PC boards stack together for a wooden MDF case (top) and for a metal case bottom. The display board plugs into the processor board via the pin headers, so there is no wiring. because the 12V supply is absent and IC2 does not work. The fabricated clock case is quite compact, measuring 252mm wide, 98mm high and just 40mm deep. It can sit on a desk or hang on a wall. Inside, there are two fairly large PC board stacked together and the backup batteries are on one of the boards. Circuit description The heart of the circuit is IC1, a PIC16F84 microcontroller. This works in conjunction with IC2, IC3 and eight transistors to drive the LED displays. The circuit is complicated by the fact that IC1 needs to operate at 5V while the large displays require a nominal 12V. The different voltage requirements are catered for by connecting the Vdd terminal of IC1 (pin 14) to the +12V rail and the Vss terminal (pin 5) to a +7V (ie, 12V - 5V) rail derived from a negative 3-terminal This is the completed display PC board. Note that two of the displays are mounted upside down (ie, with their decimal point at top, right). The two small 7-segment displays show the seconds. 36  Silicon Chip 5V regulator. IC2 then acts as a level translator (voltage shifter) for the outputs of IC1 so that they can drive IC3 and the large displays. Let’s now look at the circuit of Fig.1 in more detail. Power from the 12VDC plugpack is applied to the circuit via a 2.2Ω resistor and diode D1 which provides reverse polarity protection. The 2.2Ω resistor limits the current into zener diode ZD1 should the voltage go above 15V. REG1 is the negative 5V regulator referred to above. Diode D2, in the GND leg of the regulator, actually sets the output at about -5.6V below the +12V rail but this extra 0.6V is lost via diode D3 which feeds pin 5 of IC1. The 100µF and 10µF capacitors decouple the inputs and outputs of REG1, ensuring its stability. The reason for increasing the output of REG1 to 5.6V is to give a slightly higher “charged voltage” for the backup batteries which are charged via the 10Ω resistor. D3 is included to reduce the supply to IC1 down to 5V (the A version of the PIC is rated at only 5.5V max). D4 is included to bypass the 10Ω resistor when the circuit is powered from the batteries. This lowers the im­ pedance of the battery supply which is desirable when driving a multiplexed display, otherwise voltage variations to IC1 could cause false resetting. Note that there is a link (LK1) between the battery connec­tions to allow the backup supply to be disconnected. This is necessary if you wish to swap between 12-hour and 24-hour modes. IC1 operates at 4MHz as set by crystal X1. The 27pF capaci­tors on the oscillator pins provide the loading for the crystal so that it will oscillate within tolerance. These capacitors are NPO (Negative Positive Zero) types, which means that their temperature coefficient is zero and they do not alter their capacitance with normal temperature variations. Traditionally, clocks have always used crystals which os­cillate at a fre- quency that is a power of 2, making it easier to divide the frequency down to 1Hz using binary counters. The most common value is 32.768kHz, used in watches and clocks. Other values commonly used are 3.2768MHz and 4.096MHz which need to be divided by 100 and 1000 respectively first before division by powers of 2. In our case, we have used a standard 4MHz crystal because it is readily available and the need to divide by powers of 2 is unnecessary when using a microcontroller to provide the clock function. We divide the 4MHz by 16 then by 250 to obtain a 1kHz signal to multiplex the displays. This is again divided by 500 to obtain a 2Hz signal which is used to flash the colon on and off. The seconds display is updated on every second 2Hz signal (ie, 1Hz). The RA4 pin on IC1 is set as an output and is used to discharge the .0015µF capacitor via the 470Ω resistor. When RA4 is taken high, its output is open-circuit and the capacitor charges via the 2.2kΩ resistor and the LDR1. The capacitor charg­es faster when LDR1 is low resistance (in bright light) and slower when the LDR is high resistance (darkness). The charge time is monitored by RA4 and used to control the display dimming described earlier. The RB0-RB7 outputs of IC1 drive transistors Q1-Q8 via 470Ω base resistors. When the outputs are low, the transistors are switched on to drive the segments in displays DISP1DISP6. Segments for DISP1-DISP4 are driven via 82Ω resistors while the decimal points are driven via a 180Ω resistor. The DISP5 & DISP6 The track side of the display board is fitted with socket strips, as shown here. These are fitted with header pins which are then plugged into matching socket strips on the processor board MARCH 2001  37 IC2 can do this because it has three supply connections: the Vdd pin (16) connects to +12V, the Vss pin (8) connects to the -5V from REG1 (ie, 5V below +12V supply) and the Vee pin (7) connects to 0V. As well as acting as the B & C outputs to IC2, pins 17 & 18 of IC1 are monitored via diodes D5 & D6 which connect to the Minutes and Hours switches, respectively. The other side of the switches both connect to the RA3 input (pin2) of IC1. Normally, pin 2 is held low via the 10kΩ resistor to pin 5. However, if a switch is pressed and the B or C line driving the switch is high, the RA3 input will also be pulled high. This signals to IC1 that the switch is pressed. IC1 can determine which switch is pressed because it “knows” which line (B or C) is high at the time. Fig.5: the wooden case is made from 9mm MDF for the sides and 3mm for the base. Construction Fig.6: the metal case is folded up from 1mm aluminium. display segments are driven via 220Ω resistors. Different feed resistors are used because, as already mentioned, the large displays have four series LEDs per segment and two series LEDs in the decimal points, while the seconds displays have only one LED per segment. Upside-down displays Normally, with a multiplexed display such as this, the same segments for each digit are connected in parallel. Hence, the A segments on one digit connect to all the A segments on the other digits. However this clock circuit is not quite that simple. Both DISP1 and DISP3 are mounted upside down and we connect the seg­ments of those digits differently. This has been done to obtain the colon between the hours and minutes digits and the AM indica­tor. Hence, while the centre “g” segments are all connected in parallel, 38  Silicon Chip the “d” segments on the upside down digits connect to the “a” segments on the normal digits and so on. These details are all shown on Fig.1. Note that Fig.1 also shows the pinouts for the standard large 7-segment pinout displays. As noted above, the variant displays have different pin numbers connected but the display will show the same characters when wired up correctly. The common cathode connections to each display are driven via IC3, a ULN2003A 7-transistor array. IC3 is driven via IC2, a 4051 which is often referred to as an 8-channel analog switch or an 8-channel demultiplexer. In this circuit, it has two roles. First, it acts a decoder which converts the binary signals on its three input lines (A,B,C) to drive six outputs, one for each common cathode LED display. Second, it provides logic level (voltage) translation, changing the 5V signals on its inputs to 12V signals to drive IC3. The 12/24 hour large-display clock is constructed on two PC boards, both measuring 233 x 76mm: a processor board (coded 04103011) and a display board (coded 04103012). The two PC boards stack together using pin headers and single-in-line sockets. The boards are housed in a metal or wooden box and we give details for each in Fig.5 & Fig.6. The wooden box measures 98 x 253 x 39mm. The folded metal case measures 98 x 253 x 38mm. Begin construction by checking the PC boards for shorts between tracks and possible breaks and undrilled holes. You will need 3mm holes for the corner mounting and elongated holes for the DC socket. Also the holes for the PC stakes need to be just large enough to provide a tight fit. Before starting, you need to check on whether the large displays you have are the standard pinout or variant type. The two smaller displays will be the standard pinout type. Of the large displays, the Para Light C-2301E (as supplied by Jaycar) have the variant pinout. You can also check the pinout using a power supply (at 12V ) and 2.2kΩ resistor. Connect the negative lead to pin 3 or pin 8 and the positive lead via a series 2.2kΩ resistor to one of the segment pins as shown in the pinout diagram of Fig.2. If each segment lights up when the connection is made then this is a standard pinout display. If not, then it is likely to be The processor board carries the PIC microcontroller and the display driver circuitry. Also on this board are the four 1.2V nicad backup batteries. a vari­ant pinout display. Connect the negative lead to the pin 1 or pin 5 common and check that each segment lights with the positive lead via the 2.2kΩ resistor. Now have a look at the component layouts for the two boards, shown in Fig.3. On the overlay diagram for the display PC board there are several links marked “S” and “V”. Use the “V” links when install­ing the variant displays and the “S” links when installing the standard displays. Do not use both variant and standard links, just one or the other. Also do not mix both types of pinout displays for DISP1DISP4. The links that are not marked should be inserted for both display pinout types. Insert and solder in all the required links on the display board and the processor board. The resistors can be mounted next. Use the colour codes in Table 1 as a guide to selecting the correct value. It is also good practice to use a digital multimeter to check each value. When installing the socket for IC1, take care with its orientation and the same comment applies when installing IC2 & IC3, zener diode ZD1 and diodes D1-D6. The electrolytic capaci­ tors must also be oriented correctly, as shown. REG1 has its leads bent over to insert them into the holes on the PC board and the metal tab is secured with an M3 nut and bolt, with the bolt inserted from the underside of the board. The 4MHz crystal (X1) is laid over on its side and the case has a short lead soldered to it to anchor it to the board. The large displays are mounted directly on the PC board, while the smaller displays are mounted on two 10-way single in-line IC sockets made by cutting a 20-pin dual in-line (DIL) socket into halves. Insert these into the holes for DISP5 and DISP6. Make sure that DISP1 and DISP3 are mounted upside down with the decimal point in the top lefthand corner. DISP2, DISP4, DISP5 & DISP6 are mounted normally, with the decimal point in the lower righthand side. LDR1 is mounted so that its top face is level with the top face of the displays. Switches S1 & S2 are mounted in sockets made by cutting down a 14pin DIL socket into four 3-way SIL sockets. Remove the centre pin with side cutters and insert the sockets in the holes allocated for S1 & S2. The switches are mounted by inserting their pins into the sockets. Inter-board connectors Three 16-pin IC sockets need to be cut into six 8-way sin­gle-in-line strips. The sockets on the processor PC board are mounted normally, with the pins inserted through from the top of the PC board. The remaining sockets strips are mounted on the underside of the display PC board. The pins are soldered to the copper pads, with the socket raised slightly off the board to allow soldering. The two PC boards are then connected together by inserting 8-way pin headers into the sockets and plugging the boards together. The details of how the boards stack together are shown in Fig.4 A 2-pin header is mounted in the link 1 position on the processor board. The 1.2V cells are connected to the PC board using the solder tags. Pass the holes in the tags over the PC stakes ready for soldering. Check that they are oriented correct­ly and solder in place. Testing It is best to check the power supply voltages before in­serting IC1. This is done with just the processor board; ie, not connected to the display PC board. Connect the +12VDC plugpack and apply power. Use a multimeter to check that there is +5V between both pins 4 & 14 and pin 5 of the IC1 socket. There should also be 5V between pins 16 & 8 of IC2. The 12V (nominal) rail should also be present between pins 16 & 7 of IC2. If this is correct, disconnect the power and insert IC1 into its socket, ensuring that it is oriented correctly. Then connect both boards together and reapply power. The display should light and show 12:00. Note that the default selection is for 12hour time and with the variant pinout selected for the large displays. If you are using the standard displays, switch off power and wait about five seconds. Then reapply power with the minutes switch held down. This will then select the standard display pinout. If you want 24-hour time, press the hour switch at power up. Check that the time can be increased with the hour and minutes switches. You can test the dimming feature MARCH 2001  39 by holding your finger over the LDR. Yep, the displays should dim. Press both switches to check if you can access the adjust mode. The initial value is 0, meaning there is no adjustment for crystal frequency. You can now fit the shorting plug for link 1 and this will allow the batteries to charge via the power from the plugpack. Fig.7: this diagram shows the detail of the Perspex panel masking and labelling. Making the case 40  Silicon Chip The clock can be housed in a wooden box or folded metal enclosure. Diagrams for these are shown in Fig.5 and Fig.6. The wooden box uses 9mm MDF (Medium Density Fibre board) for the sides and 3mm MDF for the back. These can be cut to size and glued with PVA glue. The alternative metal box is folded as shown in Fig.6. It is made slightly deeper than the metal box so that the PC board can be mounted onto the rear with 6mm tapped spac­ers. These spacers keep the PC board tracks underneath from making contact with the metal case. Drill holes in the back to mount the PC board in place and a large hole in the side for the DC plug. The clock is assembled using countersunk screws from the rear. A red Perspex sheet mounts over the front, using two small self-tapping screws to hold it in place. A display mask can be used beneath the Perspex to show only the displays and hide the remaining PC board area. Details of the Perspex mask and front panel are shown in Fig.7. We placed a couple of picture frame hooks on the rear of our wooden case so it can be hung on a wall. When your clock is complete, you can set it to the correct time using the time available from Telstra or another accurate source. Run the clock for a period of at least a couple of days to check its accuracy. Then make the adjustment described in the first part of the article. Note that with some crystals that are outside the 50ppm tolerance, you may need to use an adjustment value that is ap­ proaching the maximum range of either -255 or +255. In this case, you will need to alter the crystal frequency slightly. This is done by changing the 27pF crystal loading capacitors on pins 15 & 16 of IC1. If the clock runs fast and the adjustment value needs to be 255 or more, then increase the 27pF capacitors to 33pF each. Fig.8: here are the actual size artworks for the two PC boards. Check your etched board carefully against these patterns before installing any of the parts. Alternatively, if the clock runs too slow and the adjust­ment figure needs to be -255 or greater (ie -256, -257 etc), you have to make the loading capacitors smaller. Use 22pF or 18pF values for each. SC MARCH 2001  41