Silicon ChipGPS Synchronisation For Clocks With Sweep Hands - November 2009 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: High-speed broadband in Australia will be an expensive farce
  4. Review: Quantumdata 780 HDMI Tester by Leo Simpson
  5. Review: Milling Prototype PC Boards With The Roland EGX-350 by Mauro Grassi
  6. Project: WIB: Web Server In A Box, Pt.1 by Mauro Grassi
  7. Project: Twin-Engine Speed Match Indicator For Boats by John Clarke
  8. Feature: PICAXE Update: The Latest Releases by Clive Seager
  9. Project: High-Quality Stereo Digital-To-Analog Converter, Pt.3 by Nicholas Vinen
  10. Project: GPS Synchronisation For Clocks With Sweep Hands by Geoff Graham
  11. Project: A Dead-Simple Masthead Amplifier by Branko Justic & Ross Tester
  12. Book Store
  13. Vintage Radio: The development of AC mains power supplies, Pt.2 by Rodney Champness
  14. Advertising Index
  15. Outer Back Cover

This is only a preview of the November 2009 issue of Silicon Chip.

You can view 34 of the 112 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.

Items relevant to "WIB: Web Server In A Box, Pt.1":
  • dsPIC33FJ64GP802-I/SP programmed for the Webserver in a Box (WIB) [0711109A.HEX] (Programmed Microcontroller, AUD $25.00)
  • Webserver in-a-Box (WIB) Programming Tables (PDF download) (Software, Free)
  • dsPIC33 firmware (HEX file) and website files for the Webserver in-a-Box project (Software, Free)
  • Webserver in-a-Box (WIB) PCB pattern (PDF download) [07111092] (Free)
  • Webserver in-a-Box (WIB) front panel artwork (PDF download) (Free)
Articles in this series:
  • WIB: Web Server In A Box, Pt.1 (November 2009)
  • WIB: Web Server In A Box, Pt.2 (December 2009)
  • Web Server In a Box, Pt.3 (January 2010)
  • Internet Time Display Module For The WIB (February 2010)
  • FAQs On The Web Server In A Box (WIB) (April 2010)
Items relevant to "Twin-Engine Speed Match Indicator For Boats":
  • Twin Engine SpeedMatch Inducator PCB [04111091] (AUD $10.00)
  • Twin Engine SpeedMatch Indicator for Boats PCB pattern (PDF download) [04111091] (Free)
  • SpeedMatch meter scale artwork (PDF download) (Panel Artwork, Free)
Items relevant to "High-Quality Stereo Digital-To-Analog Converter, Pt.3":
  • 4-Output Universal Regulator PCB [18105151] (AUD $5.00)
  • High-Quality Stereo DAC Input PCB [01109091] (AUD $10.00)
  • High-Quality Stereo DAC main PCB [01109092] (AUD $10.00)
  • High-Quality Stereo DAC front panel PCB [01109093] (AUD $7.50)
  • ATmega48 programmed for the Stereo DAC [0110909A.HEX] (Programmed Microcontroller, AUD $15.00)
  • ATmega48 firmware and C source code for the Stereo DAC [0110909A.HEX] (Software, Free)
  • Stereo DAC Digital/Control board PCB pattern (PDF download) [01109091] (Free)
  • Stereo DAC Analog board PCB pattern (PDF download) [01109092] (Free)
  • Stereo DAC Switch board PCB pattern (PDF download) [01109093] (Free)
Articles in this series:
  • High-Quality Stereo Digital-To-Analog Converter, Pt.1 (September 2009)
  • High-Quality Stereo Digital-To-Analog Converter, Pt.2 (October 2009)
  • High-Quality Stereo Digital-To-Analog Converter, Pt.3 (November 2009)
  • A Balanced Output Board for the Stereo DAC (January 2010)
Items relevant to "GPS Synchronisation For Clocks With Sweep Hands":
  • VK2828U7G5LF TTL GPS/GLONASS/GALILEO module with antenna and cable (Component, AUD $25.00)
  • GPS-Synchronised Clock PCB pattern (PDF download) [04203091] (Free)
  • PIC16LF88-I/P programmed for the GPS Synchronised Clock for sweep hands [0420309B.HEX] (Programmed Microcontroller, AUD $15.00)
  • VK2828U7G5LF TTL GPS/GLONASS/GALILEO module with antenna and cable (Component, AUD $25.00)
  • PIC18LF88 firmware and C source code for the GPS-Synchronised Clock with sweep hands [0420309B.HEX] (Software, Free)
Articles in this series:
  • A GPS-Synchronised Clock (March 2009)
  • GPS Synchronisation For Clocks With Sweep Hands (November 2009)
Articles in this series:
  • The development of AC mains power supplies, Pt.1 (October 2009)
  • The development of AC mains power supplies, Pt.2 (November 2009)

Purchase a printed copy of this issue for $10.00.

GPS Synchronisation for Clocks with Sweep Hands The GPS Synchronised Clock described in the March 2009 issue only worked with crystal clocks that ticked once a second. The more upmarket clocks have silent sweep hands, which are much more acceptable in a quiet lounge room situation. Now, with just a few simple modifications, you can upgrade to one of these. T here has been a lot of interest in the GPS Synchronised Clock published in the March 2009 issue of SILICON CHIP. It introduced a completely new way of driving the humble analog wall clock and turned it into an amazingly accurate timekeeper. However, it was only capable of driving clocks that stepped once per second and that stepping mechanism can be very annoying to some peo82  Silicon Chip ple – especially in the dead of night and even more especially when sleep eludes them! Tick. . . tick. . . tick. . . tick. . . They crave the silent, continuous sweep hand on the old-style electric clocks. The good news is that some of the more expensive crystal clocks, such as those from Seiko and Citizen, now By GEOFF GRAHAM have a sweep second hand that continuously and silently glides around the dial. You do not have to part with a lot of cash to get this new silent treatment. K-mart sell a reasonably cheap clock with a continuous sweep second hand while replacement movements with a continuous sweep hand are available on the internet for $10 to $15 (Google “clock movement continuous sweep”). Note that some suppliers use the term siliconchip.com.au “sweep second hand” when referring to the old stepping movement, so look 14 Vdd “continuous for the words sweep” or PIC 1.5V 16LF88 “silent”. We had already had emails from 17 readers who wanted RA0to upgrade these CLOCK improved crystal clocks to COIL GPS ac1.5V curacy and so we thought it worth Vss revisiting the GPS Synchronised Clock 5 design to see if it could be modified to drive the new sweep hand movements. The answer was yes, although with an important caveat. A standard crystal clock movement uses a coil with a soft iron core and a small bar magnet (the rotor) positioned in the magnetic field. An alternating current flows through the coil which causes an alternating magnetic field and the rotor rotates to follow this field. It is this rotation that, via gears, drives the clock’s hands. Fig.1 shows the driving waveform for a clock with continuous sweep hands. It consists of a positive pulse, an idle period, a negative pulse and another idle period. This repeats eight times a second. The rotor in the clock’s movement has a certain amount of momentum which keeps it spinning while driven by this pulse train, so it never stops. This is different to the stepping clock movement where the voltage pulse on the coil pulls the rotor around and then stops it dead – once every second – thereby creating that tick sound. The driving waveform is created by holding one wire of the coil at 0V volts, +1.5V +1.5V 14 Vdd 1.5V 17 0V RA0 31.12ms 31.12ms 31.12ms 31.12ms 0V CLOCK COIL 31.1 1.5V Vss 5 –1.5V –1.5V Fig.1: the waveform used to drive the coil of a sweep hands clock. The clock pulses alternate with a positive pulse, an idle period and a negative pulse. This is repeated at 16 pulses per second to drive the clock’s hands around the dial. while pulling the other wire to the battery voltage, +1.5V. For the next pulse the coil wires are reversed causing a negative pulse compared to the first. Both types of clock essentially work in the same way; they use a series of alternating pulses to drive the clock. The only difference is in the speed of the pulse train, one pulse per second for the stepping clocks compared to 16 pulses per second for the swepthand variety. Driving the clock So, it seems that all we need to do is modify the firmware for the GPSSynchronised Clock to generate a faster pulse train. That should be easy, shouldn’t it? Even better, the pulse width re- This scope screen grab shows the output signal from pin 17 of the microcontroller (IC1), with no load connected and is measured with the centrepoint of the batteries as the ground reference. siliconchip.com.au PIC 16LF88 Fig.2: this is how the clock’s coil is driven in the modified circuit. The micro can take pin 17 high for a positive pulse on the coil, low for a negative pulse, or open circuit (represented as a centre-off position) for the idle period between pulses. quired is exactly one 32nd of a second and it can be created by dividing the 32.768kHz crystal frequency by 1024, a neat binary number. The way the timer in the PIC microcontroller works it is easy to generate these precise binary divisions; this is why you could only change the pulse width in the original firmware in steps of 8ms. A wrinkle! At this point the first difficulty became obvious. The waveform in Fig.1 has a 50% duty cycle compared to the stepping clocks that have a duty cycle of just 4%. The current drawn by the coil in a sweep hand clock is lower but it is still about 1.25mA during each pulse. With a 50% duty cycle this results in an average current drain of This shows the signal from pin 17 of IC1 when the clock movement is connected. The voltage spikes are created by the clock movement’s inductance, each time the drive current is reduced to zero. The spikes are effectively clipped by the Schottky diodes, D3 & D4. November 2009  83 Fig.3: these are the four modications to allow the circuit to work with a quartz clock with sweep second hands. A is a 14 link from the clock Vdd mechanism to the RB2 junction of the two RB4 batteries. B and C are Schottky diodes RA1 used to clamp RA0 voltage spikes IC1 PIC16LF88 created by the Vss clock’s coil. D 5 links the GPS data to pin 8, the hardware UART built into IC1. A C 8 D DATA FROM EM-408 10 CONFIG S1 4 A A cell. This option is not open to us as we need at least 2V (1V per cell) to power the microcontroller. Incidentally, most clocks of this type can only start with fresh batteries. If you remove and replace half-used batteries they will not have enough energy to get the hands moving again. It is this requirement to provide at least 2V to the microcontroller that is the problem for us. The clock coil only needs to be driven by one battery and Q2 BC337 14 Vdd MCLR RA4 3 4.7k Q1 BC557 B 22k RING 16 9 C 4.7k A 220 F LOW ESR RB5 RA7 RA2 2 1 RA3 RB2 RB4 13 X1 32.768kHz  K 22pF 2009 3 6 IC2 MAX756 22pF T1OSC1 RA1 RA0 12 220 F LOW ESR 2 7 3V 5V GPS VOLTS SELECT 8 1k 5 V+ 1 EN 3 EM-408 Rx GPS MODULE 4 Tx 2 GND D 10 10k 18 17 T1OSC0 Vss 5 GPS SYNCHRONISED CLOCK C K D3 A TO CLOCK MECHANISM 270 D1: 1N4148 A A BC327, BC557 LED K D2–D4: 1N5819 SC  1 100nF RB3 47 LED1 4 5 AA ALKALINE CELL K 8 100nF STARTUP A D2 L1 40 H IC1 PIC16LF88 TIP SLEEVE B E AA ALKALINE CELL A E C 11 220 CON2 D4 10 F SERIAL RS-232C CON1 TO CLOCK MECHANISM K B 100nF 100k A D3 270 17 K D1 AA ALKALINE CELL 18 0.625mA and dividing that into the capacity of an alkaline AA cell gives a life of less than six months; not good and that does not include the small drain of the microcontroller and the specified EM-408 GPS module. So how does the electronics in a normal sweep hands clock manage to deliver a reasonable battery life? In the main they achieve it by continuing to operate at very low battery voltages, down to 0.7V or so from the single 10k K in the original design, we wasted half our battery power in the 270 resistor used to reduce the microcontroller’s output to the voltage equivalent of one cell. Ultimately, there is always a novel solution, isn’t there? This is illustrated in Fig 2. One wire of the clock’s coil is taken to the mid-point between the two batteries, nominally at 1.5V. The other is driven by an output of the microcontroller. The chip has the capability of driving the output to the positive rail, driving it to the negative rail and thirdly, making it high impedance and not driving anything. This is depicted in Fig.2 as a centre-off switch. So now, during each clock pulse, we take the microcontroller’s output high or low as required and during the idle period we make it high impedance. The clock’s coil will see positive and negative pulses of 1.5V, with nothing during the idle periods. This alternates the current consumption between the two batteries and in one stroke almost doubles the battery life! As you might suspect though, it was not quite as easy as that. Didn’t AA ALKALINE CELL K K A SWEEP SECOND VERSION B E K B CON2 D4 A C EM-408 CONNECTIONS 1 2 3 4 5 PC BOARD Fig.4: just in case you’re starting from scratch, here’s the complete circuit diagram, reprinted from the March 2009 issue, with the four modifications referred to above. The wiring to CON1 has also been corrected in this diagram. 84  Silicon Chip siliconchip.com.au 22pF 32kHz 22pF 100k D1 4148 22k 4.7k X1 EN GND Rx Tx Vcc 10k 100nF 10k + A CON1 o 9185 5819 C IC1 16LF88 5819 GPS MODULE (ON TOP SIDE) 04103091 © 2009 Fig.6: and here is the opposite (copper) side of the same PC board showing the four modifications – also labelled A, B, C and D to agree with those on the circuit diagram. No cuts are required to copper tracks, just the addition of two diodes, a wire link between the pins of the microcontroller and a new wire connecting to the junction of the two AA batteries in their holder. CON2 100nF B IC2 MAX756 + 10 F 2 x AA CELL HOLDER (ON TOP SIDE) + 5V 220 GPS MODULE Vcc Tx Rx GND EN 220 F CON1 R 1k 5819 IC1 16LF88 D1 Fig.5: again reprinted from the March 2009 issue, this is the original component overlay for the GPS Clock Driver. S T 9002 © 19030140 PRESS ON STARTUP 47 IC2 MAX756 100nF S1 LED1 + 3V CON2 Q2 o 4.7k 220 F 47 H 2 x AA CELL HOLDER Q1 + L1 TO PC 270 TO CLOCK D Fn 0 0 1 8414 (BOARD VIEWED ON COPPER SIDE) someone once say “life wasn’t meant to be easy?” The clock’s coil has a significant inductance and when the microcontroller switches its output to high impedance the magnetic field in that coil collapses, generating a large spike voltage across its windings. In the normal circuitry both sides of the coil will be held at ground during the idle period and the coil will be effectively shorted out. In our case the coil was free to generate a sizeable spike which was caught by the protective diodes in the microcontroller but this created all sorts of mayhem within the chip. The solution was to place Schottky diodes from the output pin on the PIC micro to the positive and negative battery rails. Before we get too far with describing the modifications, have a look at the circuit of Fig.5. This is similar to that for the original GPS Synchronised Clock, as published in the March 2009 issue of SILICON CHIP but shows the necessary mods to work with crystal clocks with sweep second hands. It also corrects an error in the wiring to CON1 where the tip and ring siliconchip.com.au The four modifications can clearly be seen in this under-board photo. Make sure you use insulated wire (or a length of insulation spaghetti slid over a wire) for the link (D) as it crosses over another track underneath the microcontroller. Similarly, ensure that the leads for the two Schottky diodes do not come even close to the tracks underneath, just to be safe! November 2009  85 Here’s the opposite end of that blue wire we added to the underside of the PC board (Fig. 6) – it emerges through a suitable hole and solders to the riveted “common” connector between the two batteries. Be very careful soldering this connector – it doesn’t take much to melt the plastic! were shown transposed. The additional Schottky diodes are shown as D3 and D4 in Fig.5. Schottky diodes are fast-acting and have a low voltage drop, so they catch the spike before the diodes inside the microcontroller are subjected to it. The result is that the energy is harmlessly dumped back into the AA cells. The pulse generated by the collapsing magnetic field is of opposite polarity to the driving voltage. When the resulting voltage pulse is caught by the diode it acts as a slight brake on the spinning rotor and we found that the pulse width needed to be a little longer to compensate. As pointed out earlier, the original pulse width was easy to create. Now a major rewrite of the firmware was required to allow a finer degree of control over the pulse width. UART required But when the new firmware was tested it became obvious that the microcontroller could not reliably receive data from the EM-408 GPS module. The firmware in the microcontroller used a software timing loop to clock in the bits of data transmitted by the GPS module and it seems that when an interrupt was generated by the microcontroller’s timer it interfered with the timing loop and caused a character to be lost. The original design worked fine when there were only two interrupts in each second but now that we are generating 32 a second (to make 16 86  Silicon Chip pulses per second) one of them was guaranteed to zap a byte. And it only takes one error to invalidate a whole line of data. To overcome this we need to use the hardware UART (universal asynchronous receiver/transmitter) in the PIC16LF88 microcontroller, IC1. This serial transmit/receive component works independently of the firmware and is not affected by interrupts. The UART uses pin 8 of IC1. To get the data to the UART we simply need a wire link pin 10 to pin 8, on the underside of the PC board. Inevitably though, this change entailed yet another rewrite to part of the firmware. Operation The firmware for the sweep hand clock is similar in operation to the original version but with a few differences, the main one being that it is impossible to implement automatic daylight saving adjustment. This is because of the physics involved in spinning the rotor in the clock movement. It is balanced to operate at a certain speed and while the new firmware can run the clock 6% fast or slow, which is fine for correcting a few seconds error, it is no good for skipping forward or backwards by an hour. Losing the daylight saving adjustment feature is not as tragic as it seems. The microcontroller will keep driving the second hand with perfect accuracy, so all you need do is wind the hands back or forward an hour and ensure that the minute hand agrees with the position of the second hand as it sweeps around. This is much better than having to find an accurate time source to completely reset the clock. Not being able to run the clock at high speed also means that we cannot just set the clock to 12 o’clock and let it catch up with the correct time. Instead, in this design, you set the hands to exactly the next hour or half hour (whichever comes first) and then insert the batteries. This means that if (say) the time is ten past one, you should set the hands to 1:30 and the second hand to the 12 o’clock position. After the clock has checked the GPS for the correct time, it will sit and wait for the next precise hour or half hour to come around and then automatically start running. So that you do not fret while waiting for this to happen, the firmware will slowly flash the startup LED at about once every three seconds – just to let you know that it is alive and waiting for the right time to start. We have a small Catch-22 situation here. When you purchase a clock the second hand will be pointing at some random position on the dial and when you insert the batteries the clock will sit motionless until it is time to start. As the time adjustment on most clocks does not affect the second hand you will not have an opportunity to set the second hand to 12 o’clock before the clock starts – and then it is too late. Because of this we have added a new feature. While the clock is sitting, waiting for the correct starting time to arrive (slow flashes on the LED), you can press the setup button and while you hold this button down the clock will run, causing the second hand to move around the dial. When the second hand reaches the exact 12 o’clock position you can release the button and use the normal time setting facility of the clock to adjust the hour and minute hands to the correct position. Other features are the same as before. The LED will flash to indicate the controller’s progress as it starts up. One flash indicates that the microcontroller (PIC16LF88) is operating, two flashes means that the DC to DC converter (MAX756) is operating, three flashes mean that the GPS module is working and four means that the GPS module has got a lock on enough satellites. As before, you enter the configuration menu by holding down the startup siliconchip.com.au DB-9 FEMALE CONNECTOR (SOLDER SIDE) 6 8 7 6 5 TIP–PIN 5 RING – PIN 3 SLEEVE – PIN 2 Parts List – GPS Synchronised Clock (3.5mm STEREO PHONE PLUG) S 4 3 2 T S R T R 1 LINK PINS 4-6 AND 7-8 Fig.7: construction of the cable that connects the clock controller to a standard PC serial port. You will need this if you want to change the settings. Note this is different to the one originally published in March 2009 – use this one! button when you insert the batteries. You also need to connect the clock to your PC using the cable shown in Fig.7 and run a terminal emulation program on your PC set to 4800 baud. Because we do not need to set the time zone or daylight saving, the menu is much simpler – see the screen grab of Fig.8. The firmware will also check for a flat battery and halt at exactly the hour or half-hour position if the cells are below par. Before you replace the battery you need to set the hands to the next hour or half hour but hopefully you will not have to mess with the second hand because it should have stopped at the exact 12 o’clock position. If, after the clock has started, the signal level drops to a point that is too low for the GPS module to get a lock on enough satellites, the clock will stop at exactly five minutes before the hour/half hour. Similarly, if the GPS module stops running altogether the clock will stop at 10 minutes before. These indications make it easy to differentiate between a low battery and something more serious. In either event the firmware will retry 10 times with a 4-hour delay between each attempt before it gives up. This gives the GPS module plenty of opportunities to come good. Internally the firmware measures time in eighths of a second. This allows for much finer tracking of errors and control of where the clock’s hands are pointing. Theoretically it will mean a higher degree of accuracy although this is offset to some extent by the fact that most clocks with sweep hands will lose a fraction of a second when they start up. This is something that the firmware is not aware of and cannot correct for. Assembling and modifying the PC board While many readers will have seen siliconchip.com.au the original article in the March 2009 issue, we are repeating the constructional procedure here, along with the mods required to make the project work with sweep second hand movements. All of the components for the GPS Clock, including the GPS module and the AA cell holder, are mounted on a PC board measuring 140 x 57mm and coded 04203091. The component overlay is shown in Fig.6. Check the board carefully for etching defects, shorted tracks or undrilled holes. Then install the four wire links on the board and continue with the low profile components, moving up to the transistors and capacitors. When mounting the battery holder, use double-sided adhesive tape or put a dab of glue on its underside before soldering it in. This will hold it securely when you remove or replace the batteries. IC2 must be directly soldered to the printed circuit board. Do not use an IC socket as the switching current through L1 is quite high and the voltage drop through the socket contacts will prevent IC2 from working correctly at low battery voltages. On the other hand, you should use a socket for IC1 so that you can remove it for reprogramming. The PIC16LF88 (IC1) must be programmed with the file 0420309A.hex which will be available from the SILICON CHIP website. The GPS module comes with a connector cable with identical connectors at each end. We only need one, so cut the cable in the centre. This will give you two separate cables, each with a connector. On one of these cables you should bare the cut ends and solder them to the PC board, ready for the GPS module. Solder in the 3-pin header for LK1. Then install the jumper to select 3V for the GPS module. This must be 1 PC board code 04203091, 140mm x 57mm 1 GlobalSat Technology EM-408 GPS module * 1 32.768kHz crystal (X1) 1 47H high saturation inductor (Jaycar LF1274 or Altronics L6517) 1 3.5mm stereo phono socket (Altronics P0096 or equivalent) 1 momentary pushbutton switch (Altronics SP0601 or equivalent.) 1 dual AA battery holder (Altronics S5027 or equivalent) 1 18-pin IC socket 1 2-way header plug, 2.54mm pitch 1 2-way header socket, 2.54mm pitch, PC-mount, 90° pins 2 AA alkaline cells Semiconductors 1 PIC16LF88-I/P microcontroller programmed with GPS Clock (0420309A).hex (IC1) 1 MAX756CPA DC-DC Converter (IC2) Available from www.futurlec.com 1 BC557 PNP transistor (Q1) 1 BC327 PNP transistor (Q2) 1 1N4148 diode (D1) 1 1N5819 Schottky diode (D2) 1 3mm red LED (LED1) Capacitors 2 220F 25V low ESR electrolytic (Jaycar RE6324 or Altronics R6144) 1 10F 16V electrolytic 3 100nF monolithic 2 22pF ceramic Resistors (0.25W 5%) 1 100k 1 22k 2 10k 2 4.7k 1 1k 1 270 1 220 1 47 Additional components required for Sweep version: 2 1N5819 Schottky diodes (D3, D4) 2 insulated wire links (see text) * The EM-408 GPS module specified suits the PC board pattern and also has an integral antenna. It is available from www.sparkfun.com (part number GPS-08234) , or www. starlite-intl.com or www.coolcomponents.co.uk and other suppliers). Other modules may have different spacing and require an external antenna. November 2009  87 This is a replacement movement we purchased from China via the Internet. If you search on the Internet you will find many suppliers of clock movements with continuous sweep hands. They are generally hobby or craft shops catering for people who are making their own clocks. At right is the interior of a modified movement. The integrated circuit that normally drives the clock is bonded directly to the circuit board and hidden under the black blob. You can see our connection to the coil and if you look closely between the soldered connections you can see where we cut the copper track to disconnect the clock’s internal circuitry. done before the board is powered up. If you don’t do this, pin 2 of IC2 will float and might cause the IC to deliver a lethal voltage to your GPS module. With the PC board completed, you now need to make four changes to it, labelled A, B, C and D on the circuit diagram and (revised) component overlay. Note that all changes are made on the copper side of the PC board. A: Add an insulated wire from where the 270 resistor joins one pin of the clock connector socket (CON2) on the underside of the board. This is illustrated as point A in Fig.6 and we used a short length of blue light-duty hookup wire. The other end of the wire goes to the centre connection of the two batteries in the holder. B: Solder a 1N5819 Schottky diode (D4) between pins 17 and 5 of the microcontroller with the cathode (banded end) on pin 17. C: Solder a second 1N5819 diode (D3) between pins 17 and 14 of the microcontroller with the cathode (banded end) on pin 14. D: Solder a link between pins 10 and 8 of the microcontroller on the underside of the board. This connects the UART, as described above. You should use a short length of insulated wire to avoid shorting the track that runs under the link. Be very careful when soldering to the battery connector – the plastic will instantly melt with just a little 88  Silicon Chip too much heat. Use a knife to clean a patch of metal on the connector and use flux-cored solder to tin it first. Apply the soldering iron sparingly, half a second at a time. You should then be able to quickly solder your tinned wire to this patch. Even though the 270 resistor looks superfluous it should be left in place as the firmware will set pin 18 of the microcontroller to high impedance and this resistor will prevent the voltage on this pin from floating, which is not a good thing for CMOS ICs. Check all your changes with a high power magnifier, particularly looking for solder bridges between adjacent pins on the microcontroller. If you do have some of these use desoldering braid to pickup the excess solder. All you need to do now is reprogram your PIC16F88 (or 16LF88) with “0420309A.hex” which is available on the SILICON CHIP website. When it is reprogrammed, place IC1 back in its socket. Testing The original article provided a number of hints to help get the clock running and they apply equally to the modified GPS Controller. This firmware also has a new function in the setup menu that should help with testing. It will run the clock for an exact number of minutes and Fig.8: the configuration menu is much simpler now we do not have to set the daylight saving parameters. The Run command is new and makes it easy to test the clock movement for reliability. siliconchip.com.au then stop. start running at low voltages. Once A good test is for 60 minutes and the test has started running you can the idea is that the minute and second reduce the supply voltage. hands should return to exactly the A second point to note is that you same spot as they started from. Any must sit the clock upright in its normal error, even by half a second, will in- position while testing. The clock’s dicate a problem. motor has very little power and, if it If you have a variable power supply is going to misbehave, it will occur you can use this function to test the while the clock is trying to push the clock’s operation at various voltages. second hand up against gravity. To simulate the half voltage point between the two batteries you should Source code connect two 47 resistors in series The new firmware for sweep hands across the output of the power supply. clocks is written in the C language The most important test is with the and can be compiled with either power supply set to below 2V, the the CCS C compiler or the Hi-Tech minimum operating voltage, as it is C compiler Lite for the PIC 10/12/16 here that problems will surface if they microcontrollers. are going to. The good thing about the latter is If the clock does lose some time that it is totally free, so if you want you can experiment by increasing the to get into the C language and mess pulse width in the setup menu. This around with the code, this is one way allows the pulse width to be varied to do it. in steps of one millisecond with You can download the “Lite” comincreasing values delivering more piler (the free version) from www. energy to the clock’s motor at the cost htsoft.com of battery life. Before you install this you should Note that you need to start the test also download and install the MPLAB at a normal voltage (about 3V) because development environment from Mithe serial interface will not work at crochip (www.microchip.com) – also RDG_SiliconChip_1109.pdf 1 8/10/2009 10:40:50 AM low voltages and the clock will not totally free. Stepping clocks Readers who have a clock that steps once a second and are happy with the tock sound, may wonder if they can benefit from the remarkable improvement in the battery life described earlier. The answer is yes. You can download a new version (ver 2.0) of the firmware for stepping clocks from the SILICON CHIP website (“GPS Clock – Stepping.hex). If you have modified your board as described it will automatically detect the change and use it to deliver a greatly improved battery life. If you have not made these modifications you can still use the new version as it will work fine with the original circuit. Because this version includes some bug fixes and improvements over the original firmware it is recommended that you download and install it anyway, even if you do not plan to modify your board. The author has set up a web site to provide up to date errata, notes and new firmware for the GPS Synchronised Clock. You can check it out at http://geoffg.net/GPS_Synchronised_ Clock.html SC C M Y CM MY CY CMY K siliconchip.com.au November 2009  89