Silicon ChipHigh Visibility 6-Digit LED GPS Clock - December 2015 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: The economics of hybrid solar systems
  4. Subscriptions
  5. Feature: The 2015 Bridgestone World Solar Challenge by Ross Tester
  6. PartShop
  7. Feature: The Largest Astronomical Image Of All Time by Ross Tester
  8. Feature: Super & Ultra-Super-Critical Steam Power Stations by Dr David Maddison
  9. Project: High Visibility 6-Digit LED GPS Clock by Nicholas Vinen
  10. Feature: High-Quality Audio Transformers From Sweden
  11. Product Showcase
  12. Project: Check Turntable Speed With This White LED Strobe by John Clarke
  13. Project: Speech Timer For Contests & Debates by John Clarke
  14. Project: Arduino-Based Fridge Monitor & Data Logger by Somnath Bera
  15. Vintage Radio: A practical guide to vibrator power supplies by John Hunter
  16. Market Centre
  17. Notes & Errata
  18. Advertising Index
  19. Outer Back Cover

This is only a preview of the December 2015 issue of Silicon Chip.

You can view 37 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.

Items relevant to "High Visibility 6-Digit LED GPS Clock":
  • High Visibility 6-Digit LED GPS Clock PCB [19110151] (AUD $15.00)
  • PIC32MX170F256B-I/SP programmed for the High Visibility 6-Digit LED GPS Clock [1911015D.HEX] (Programmed Microcontroller, AUD $15.00)
  • MCP1700 3.3V LDO (TO-92) (Component, AUD $2.00)
  • VK2828U7G5LF TTL GPS/GLONASS/GALILEO module with antenna and cable (Component, AUD $25.00)
  • Six 70mm tall 7-segment displays, BLUE plus four matching diffused 5mm LEDs (Component, AUD $40.00)
  • Six 70mm tall 7-segment displays, EMERALD GREEN plus four matching 5mm LEDs (Component, AUD $50.00)
  • Six 70mm tall 7-segment displays, HIGH BRIGHTNESS RED plus four matching diffused 5mm LEDs (Component, AUD $25.00)
  • Six 70mm tall 7-segment displays, GREEN plus four matching diffused 5mm LEDs (Component, AUD $30.00)
  • Blue 5mm LED with diffused lens (25mm leads) (Component, AUD $0.20)
  • Blue 5mm LED with diffused lens (15mm leads) (Component, AUD $0.20)
  • 40109B level shifter IC (DIP-16) (Component, AUD $2.00)
  • High Visibility 6-Digit LED GPS Clock acrylic case pieces - CLEAR (PCB, AUD $20.00)
  • High Visibility 6-Digit LED GPS Clock acrylic case pieces - BLUE TINTED (PCB, AUD $25.00)
  • High Visibility 6-Digit LED GPS Clock acrylic case pieces - GREEN TINTED (PCB, AUD $25.00)
  • High Visibility 6-Digit LED GPS Clock acrylic case pieces - RED TINTED (PCB, AUD $25.00)
  • Firmware (HEX) file and C source code for the High Visibility 6-Digit LED GPS Clock [1911015D.HEX] (Software, Free)
  • High Visibility 6-Digit LED GPS Clock PCB pattern (PDF download) [19110151] (Free)
  • High Visibility 6-Digit LED GPS Clock case cutting diagram (download) (Software, Free)
Articles in this series:
  • High Visibility 6-Digit LED GPS Clock (December 2015)
  • High Visibility 6-Digit LED GPS Clock (December 2015)
  • High Visibility 6-Digit LED GPS Clock, Pt.2 (January 2016)
  • High Visibility 6-Digit LED GPS Clock, Pt.2 (January 2016)
Items relevant to "Check Turntable Speed With This White LED Strobe":
  • White LED Turntable Strobe PCB [04101161] (AUD $5.00)
  • PIC12F675-I/P programmed for the White LED Turntable Strobe [0410116A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Calibrated Turntable Strobe Disc [04101162] (PCB, AUD $7.50)
  • Firmware (HEX) file and source code for the White LED Turntable Strobe [0410116A.HEX] (Software, Free)
  • White LED Turntable Strobe PCB pattern (PDF download) [04101161] (Free)
  • Lid panel artwork and drilling templates for the White LED Turntable Strobe (PDF download) (Free)
Items relevant to "Speech Timer For Contests & Debates":
  • Speech Timer PCB [19111151] (AUD $15.00)
  • PIC16F88-I/P programmed for the Speech Timer [1911115A.HEX] (Programmed Microcontroller, AUD $15.00)
  • Firmware (HEX) file and source code for the Speech Timer [1911115A.HEX] (Software, Free)
  • Speech Timer PCB pattern (PDF download) [19111151] (Free)
  • Front/side panel artwork and drilling diagram for the Speech Timer (PDF download) (Free)
Items relevant to "Arduino-Based Fridge Monitor & Data Logger":
  • Arduino sketches for the Fridge Monitor and Data Logger (Software, Free)

Purchase a printed copy of this issue for $10.00.

High Visibility 6-Digit LED GPS Clock Want a really bright 6-digit clock that you can see at a considerable distance? Would you like it to have GPS time precision with automatic time zone and daylight saving adjustment? Well, have we got a clock for you! This new clock design uses six 56mm-high LED digits which are so bright that they seem larger than they really are. And with optional GPS time-keeping, it would be ideal for those who are travelling around the country as well those who simply want a highly visible clock. F OLLOWING ON from the 6-Digit Nixie Clock described in the February & March 2015 issues, we have had a number of enquiries from readers who want a modern clock (ie, without Nixies!) with GPS accuracy but also high visibility. So we have combined the GPS time-keeping features with a 6digit LED display which comes in a range of colours: red, blue, yellow, green and emerald green. For sheer impact, we suggest that you go for the blue or the emerald green. The unit can be wall-mounted or can sit on a desk. It runs from a 12-18V DC plugpack or power supply and has solid or flashing colons (at 1Hz). With a GPS module, as long as the unit is placed where it can receive the satellite transmissions, all you have to do is power it up and it will show the correct time year-round – even after an extended blackout. 36  Silicon Chip The unit is housed in a custom lasercut 3mm clear or tinted acrylic case. The case incorporates two slots for screw heads to hold it on the wall as well as cut-outs for the pushbuttons and DC socket and holes for the piezo buzzer sound to exit the case. An infrared remote control can be used to change the display brightness, show the date, set the time and alarm and also to use the unit as a timer. It can count up or down, showing fractional seconds for times under one hour and sound its piezo buzzer after a preset period. The same piezo buzzer is used for its 7-day alarm feature – a different alarm time can be set for each day and the alarm can be enabled or disabled for any given day. The display can be set to 12 or 24hour time, with or without leading zero blanking. Time is kept using an internal crystal which can be trimmed for long-term accuracy (not necessary if a GPS module is fitted). An on-board light sensor allows the display to automatically dim at night. Basic functions such as setting the time or showing the date can be performed using two onboard pushbuttons. All functions can also be performed using the infrared remote control. All parts mount on a single PCB for easy construction and it’s controlled by a PIC32 microcontroller with 512KB of flash memory. Most of this is taken up with geographic data which is used to determine the local time zone and daylight savings rules, based on the GPS co-ordinates. Most GPS modules are suitable and start at just $10 – we mention some possibilities later in the article. Circuit description The complete circuit of the GPSsiliconchip.com.au The completed clock is shown here fitted with blue 7-segment LED displays but red, yellow, green and emerald green displays could also be used. The finished clock measures 308 x 36 x 76mm and fits into a laser-cut transparent Perspex case. By Nicholas Vinen disciplined LED clock is shown in Fig.1. The digit anodes are driven by MPSA13 monolithic NPN Darlington transistors Q20-Q25 which are configured as emitter-followers (ie, current buffers) which are in turn driven by the outputs of a single HEF4028 CMOS decimal decoder, IC2. The Darlingtons are required due to the very weak drive capabilities of IC2 (~1mA). IC2 drives one of its B0-B9 outputs high and the others low, depending on the states of the S0-S3 inputs. For “invalid” input combinations, all outputs are low. An HEF4028 is used rather than a regular 4028B due to its higher maximum voltage rating (18V vs 15V), giving more flexibility in matching the DC supply voltage to the LED display requirements. IC2’s inputs are controlled by level shifter IC3, a 40109 which is also a CMOS device. The VDD pins of IC2 and siliconchip.com.au Features & Specifications •  Choice of six display colours: blue, emerald green, red, green, yellow or white •  Optional GPS module for automatic time zone determination and daylight saving •  Housed in custom laser-cut wall-mounting transparent acrylic case •  Adjustable brightness •  Automatic dimming based on ambient light •  Date display (via pushbutton/remote control) •  Manual time zone override with GPS module •  Keeps time for over one hour during blackout •  Power consumption: depending on display colour, ~100-500mA <at> 12-18V •  Some colour versions suitable for use with 12V automotive supply •  Also operates as count-up/count-down timer with sub-second resolution •  7-day alarm with piezo buzzer •  Functions can be controlled with universal infrared remote IC3 connect to the main DC supply of around 15V while IC3’s VCC pin connects to the 3.3V supply which is also used by the microcontroller. Thus, the micro’s 3.3V outputs are suitable for driving IC3’s A, B & C inputs, which are then level-shifted to 0-15V signals at pin 4 (OA), pin 5 (OB) and pin 11 December 2015  37 D1 1N5819 CON1 100 µF A V+ K 22Ω 0.5W D2 1N5819 REG1 7805 25V 22Ω +5V OUT IN GND 0.5W 100 µF REG2 MCP1700-3.3TO K A 100 µF 100nF 16V 16V MMC 1F 5.5V 100Ω (CERAMIC PATCH ANTENNA) SUPERCAP 100 µF GPS PWR +5V 16V CON2 10k +3.3V2 +3.3V2 REG3 MCP1700-3.3TO +5V 1 λ 10k LK1 GND 5 100 µF 2 2 3 OUT IN 1 4 SerRx 3 IRD1 V+ +3.3V GND 22Ω 100 µF 25V OUT IN 16V 1PPS 12-18V DC 6 V+ RxD TxD 1PPS GPS RECEIVER MODULE (OPTIONAL) GND VBAT V+ +3.3V + 10Ω PB1 BUZZER ZD1 13V MMC 100nF A MMC 100k Q10 BC337 C 2 B 5 3 RA0 /AN 0 /VREF+ AN11/RB13 RB1/AN3/PGEC1 CLK1/RA2 RA1/AN1/VREF– AN9/RB15 PGED1/AN2/RB0 AN4/RB2 10k 10 1 ICSP 1 14 2 15 3 11 4 12 5 S2 S1 CON3 VDD 10k +3.3V LDR1 λ 47k 13 28 AVDD 6.8k E 100nF 22pF X1 32768Hz 22pF RA3/CLKO IC1 PIC32MX170PIC3 2 MX170F256B MCLR TDI/RB7 TCK/RB8 TD0/RB9 PGED2/RB10 PGED3/RB5 AN10/RB14 PGEC3/RB6 AN12/RB12 PGEC2/RB11 SOSCI/RB4 AN5/RB3 SOSCO/RA4 VCAP AVSS 27 VSS 19 VSS 8 24 9 SerRx 1PPS 26 A2 4 A1 6 A0 16 KG 17 KF 18 KE 21 KD 25 KC 23 KB 22 KA 7 Kdp 7x 1k 20 10 µF 6.3V SMD/TANT +3.3V2 K 1k 1k 1N5819 A SC 20 1 5 K ZD1 A K SIX LED DIGIT GPS DISCIPLINED CLOCK RESISTOR VALUES CHANGE FOR DIFFERENT COLOUR LEDS – SEE TEXT Fig.1: the LED clock circuit is based around 32-bit microcontroller IC1. It drives the 7-segment display anodes via level shifter IC3, decimal decoder IC2 and Darlington transistors Q20-Q26. The cathodes are driven by NPN transistors Q1Q9 and Q11-Q19. The power supply includes 5V and 3.3V rails to run the optional GPS module plus a supercapacitorbacked 3.3V rail for the microcontroller. (OC) to control IC2. IC3’s enable pins are all tied high to VCC, so these outputs are always active. If the micro wants to disable drive to the digits, it simply sets IC3’s inputs A, B & C high which causes output O7 (pin 4) of IC2 to be selected. 38  Silicon Chip B7 is not connected to anything so all the Darlington transistors are switched off. Output pins O0-O5 select digits DISP1-DISP6 while output pin O6 drives Darlington Q26 which powers the four discrete colon LEDs. Each of the seven segment cath- odes, including the decimal point, is switched by the micro, using a separate control pin to power an NPN transistor (Q11-Q18) operating as a commonemitter amplifier. These are combined with emitter resistors and additional NPN transistors (Q1-Q8) which limit siliconchip.com.au V+ 100nF MMC 16 +3.3V Vdd O9 100nF O8 MMC 9 7 2 14 A2 10 A1 6 A0 3 O7 16 1 Vdd Vcc 15 EnD O5 EnC EnB EnA Din O6 12 OD 13 11 11 IC3 OC 40109B OB OA Cin 12 5 13 4 10 5 9 4 7 COLONS 6 D6 IC2 40 28 B O4 1 A3 O3 A2 O2 A1 O1 A0 O0 Vss Bin D5 15 D4 2 D3 14 D2 3 D1 8 Ain Vss 8 COLONDRV V+ V+ C C Q26 B E A LED4 LED3 COLON LEDS 7 6 λ K LED2 LED1 b A e 9 K f 10 8 λ e 6 b bd c d e 9 f 10 g dp b 8 dp e f C Q8 E B R8 68Ω C B Q18 E C Q9 E B E R9 18Ω e c d e 9 f 10 g 8 dp B Q1 R1 18Ω E C b e f 6 c d e b e 9 f 10 g dp COM COM a 8 dp f 6 bd g c d e 9 f 10 g dp b 8 dp e f DISP 6 1 5 COM COM a 6 b bd e c d e 9 f 10 g dp 5 COM COM a b a 4 c 3 d f 2 e c g g 7 a a 4 c 3 d f 2 c e g 7 a b a 4 c 3 d f 2 c bd g e g 7 a b a E 2 3 the current through each segment when that segment is enabled. For example, if segment A of the current digit is to be lit, output RB11 (pin 22) of microcontroller IC1 is driven high. This provides base current to Q11 which sinks current from the seg- E R2 18Ω 8 dp E C E R3 18Ω C e f b g e c d g g 10 dp E E ment A LED string within that digit. Once this current rises to approximately 30mA, there is enough voltage across the 18Ω emitter resistor to forward-bias Q1’s base-emitter junction, shunting any additional base driven current away from Q11 and to ground. IN C OUT CG CF E B E C Q7 E R6 18Ω Q17 B E R7 18Ω 7805 GND IN GND C B Q16 MC P1700 B E C Q6 R5 18Ω BC 337, BC 547 B E C B Q15 B Q5 R4 18Ω MPSA13 C E C B Q14 B Q4 CE CD CC B Q3 E C B Q13 C LEDS K A C B Q12 B Q2 IRD1 1 C B Q11 C E CB C B Q19 TRANSISTORS Q1-Q9 : BC547 TRANSISTORS Q10-Q19 : BC337 TRANSISTORS Q20-Q26 : MPSA13 siliconchip.com.au bd g COM COM a 4 c 3 d f 2 c dp CA C 6 b a g 7 a SECx1 DISP 5 1 5 K Cdp B COM COM a 4 c 3 d f 2 c g g 7 a a 4 c 3 d f 2 λ A COM COM a E SECx10 DISP 4 1 5 Q25 B E MINx1 DISP 3 1 5 C Q24 B E MINx10 DISP 2 1 5 C Q23 B E HRSx1 DISP 1 1 C Q22 B E HRSx10 K C Q21 B E λ A C Q20 B GND OUT Since the decimal points are physically smaller than the other segments, the associated emitter resistor value is higher (eg, 33Ω), reducing the relative current and thus providing visually similar brightness levels. The colon LEDs have a similar cathode driving December 2015  39 Parts List: High-Visibility 6-Digit LED GPS Clock 1 double-sided PCB with plated through-holes, coded 19110151, 302 x 70mm 1 set of laser-cut transparent acrylic pieces to make case* 1 small tube acrylic adhesive 1 3.3V or 5V GPS module (optional; up to 200mA draw, TTL interface preferred) 1 mini TO-220 flag heatsink (6073B type, for REG1) 1 8-way pin header, 2.54mm pitch, snapped into 3-pin & 5-pin sections (CON3,LK1) 1 jumper shunt (LK1) 1 32.768kHz watch crystal (X1) 1 mini 9-14V piezo buzzer, 7.62mm pin spacing (PB1) (Jaycar AB3459, Altronics S6105) 1 47-100kΩ LDR (LDR1) 2 right-angle tactile switches, 4.5mm-long actuators (S1,S2) 1 28-pin narrow DIL socket 2 40-pin socket strips 1 PCB-mount DC socket to suit power supply 1 M3 x 10mm machine screw, flat and shakeproof washer plus nut 4 4G x 6-9mm self-tapping countersink head screws 1 60mm length foam-cored double-sided tape (optional, for attaching GPS module) 4 small stick-on rubber feet (optional, for desktop usage) 1 universal remote control Semiconductors 1 PIC32MX170F256B-I/P 32-bit microcontroller programmed with 1911015A.hex (IC1) arrangement although since they can be controlled entirely by switching the anode supply, this is not controlled by the micro but rather enabled as long as the DC supply is present. Timekeeping The digits are multiplexed at around 100Hz by micro IC1, to avoid noticeable flicker. Crystal X1 is used to run its internal real-time clock and calendar (RTCC) for timekeeping. If a GPS receiver is connected via CON2, its serial data stream is received by IC1 at pin 24 and once sufficient data is available to determine accurate local time, the RTCC is updated and kept 40  Silicon Chip 1 HEF4028 BCD to decimal decoder CMOS IC (IC2) 1 40109B CMOS quad levelshifter IC (IC3) 1 3.3V infrared receiver (IRD1) 1 7805 5V 1A linear regulator (REG1) 2 MCP1700-3.3/TO micropower 250mA 3.3V LDO regulators (REG2,REG3) 9 BC547 NPN transistors (Q1-Q9) 10 BC337 NPN transistors (Q10-Q19) 7 MPSA13 30V 1.2A NPN Darlington transistors (Q20-Q26) 1 13V 1W zener diode (ZD1) 2 1N5819 1A 40V Schottky diodes (D1, D2) Capacitors 1 1F 5.5V supercapacitor 6 100µF 25V electrolytic, maximum height 11mm 1 10µF 4V SMD ceramic (1206) or tantalum SMD/through-hole capacitor 5 100nF disc or multilayer/ monolithic ceramic 2 22pF disc ceramic Resistors (0.25W, 1%) 1 100kΩ 4 10kΩ 2 6.8kΩ (one optional, for RS-232 GPS modules) 9 1kΩ 1 100Ω 3 22Ω 0.5W 1 10Ω synchronised with the GPS data. If the unit loses power, the GPS unit is powered down as it is supplied by either REG1 (if it runs off 5V) or REG3 (3.3V) and these are powered from the incoming ~15V supply from CON1 via D1. However, a 1F (one Farad) super capacitor is charged from REG1’s output via Schottky diode D2, to around 4.7V. This capacitor powers micropower low-dropout 3.3V regulator REG2 which supplies microcontroller IC1 and the GPS unit’s memory backup (if required). The micro detects a loss of power by monitoring the voltage at its AN1 input. If the 15V rail drops below 7V (the Additional parts for the blue display version 6 LBT23101BB blue 2.3-inch 7-segment LED displays* (DISP1-6) 4 5mm blue LEDs with diffused lenses* (LED1-4) 8 18Ω 0.25W resistors (R1R7,R9) 1 68Ω 0.25W resistor (R8) 1 15-18V DC 500mA+ regulated power supply (eg, Jaycar MP3318, Altronics M8950) Additional parts for the emerald green display version 6 LBT23101BGG emerald green 2.3-inch 7-segment LED displays* (DISP1-6) 4 5mm emerald green LEDs with diffused lenses* (LED1-4) 8 18Ω 0.25W resistors (R1R7,R9) 1 68Ω 0.25W resistor (R8) 1 15-18V DC 500mA+ regulated power supply (eg, Jaycar MP3318, Altronics M8950) Additional parts for the red display version 6 CAI23101BS or SA23-11SRWA red 2.3-inch 7-segment LED displays* (DISP1-6) 4 5mm bright red LEDs with diffused lenses (LEDs1-4) 8 18Ω 0.25W resistors (R1-R7,R9) 1 68Ω 0.25W resistor (R8) 1 12-15V DC 1A regulated plugpack or 12V power supply (eg, Jaycar MP3310, Altronics M8932A) voltage required to keep the supercap charged), it immediately switches off all the LEDs and goes into a low-power sleep mode while keeping its RTCC active. It wakes up every few seconds to check if power has been restored and if so, resumes displaying the time. If a GPS receiver is present, after some time (usually a minute or so), it will regain satellite lock and the time will be re-synchronised. However, given that the supercap charge will only last a few hours, it’s unlikely the RTCC will have drifted more than a small fraction of a second during this time. Infrared receiver IRD1’s output is connected to input RB1 of IC1 (pin 5) siliconchip.com.au Additional parts for the white display version 6 LBT23101BW white 2.3-inch 7-segment LED displays (DISP1-6) 4 5mm white LEDs with diffused lenses (LED1-4) 8 18Ω 0.25W resistors (R1-R7,R9) 1 68Ω 0.25W resistor (R8) 1 15-18V DC 500mA+ regulated power supply (eg, Jaycar MP3318, Altronics M8950) Additional parts for the yellow-green display version 6 LBT23101BG green 2.3-inch 7-segment LED displays* (DISP1-6) 4 5mm bright green LEDs with diffused lenses (LEDs1-4) 7 5.6Ω 0.25W resistors (R1-R7) 2 22Ω 0.25W resistors (R8,R9) 1 15-18V DC 500mA+ regulated power supply (eg, Jaycar MP3318, Altronics M8950) Additional parts for the yellow display version 6 LBT23101BY yellow 2.3-inch 7-segment LED displays (DISP1-6) 4 5mm yellow LEDs with diffused lenses (LED1-4) 7 5.6Ω 0.25W resistors (R1-R7) 2 22Ω 0.25W resistors (R8,R9) 1 15-18V DC 500mA+ regulated power supply (eg, Jaycar MP3318, Altronics M8950) * Available from the SILICON CHIP online shop and so a universal remote can be used to set the time and control the unit, allowing it to be used as a timer as well as a clock. The remote can also be used to set an alarm. In the absence of a remote control, pushbuttons S1 & S2 can be used to perform basic tasks such as setting the time. When pressed, these pull down inputs RB5 and RB6 (pins 14 & 15) which are also used initially to program IC1 via CON3. IC1 can activate a piezo buzzer by bringing its RA3 output (pin 10) high. This supplies current to the base of NPN transistor Q26 which then sinks current from the buzzer’s negative terminal. ZD1 limits the voltage applied siliconchip.com.au across the buzzer, while the current through Q10 is limited to a safe level by its 6.8kΩ base resistor. Microcontroller IC1 uses LDR1 to monitor the ambient light level and adjust the LED brightness to suit. LDR1 forms a voltage divider across the 3.3V supply in combination with a 10kΩ resistor and thus the voltage at pin 2 of IC1 (AN0) varies depending upon the amount of light falling on LDR1. The top of this divider is connected to REG3 so it doesn’t draw power from the supercap via REG2 when the main supply is off. REG1 is fitted with a flag heatsink; while the circuit does not draw a great deal of current from the regulator, the voltage across it can exceed 10V. The two 22Ω resistors in series with the input reduce regulator dissipation by up to half a watt. D1 provides reverse supply polarity protection while minimising voltage drop. Most LED displays we tested worked best when the clock was driven by a regulated DC supply of 15-18V. Lower voltages can be used, down to around 12V (depending on the exact displays used), however maximum brightness and display uniformity may not be quite as good. For lower supply voltage, red is the safest display choice. Software operation The micro’s hardware Real Time Clock and Calendar (RTCC) is used for timekeeping, in combination with an external 32.768kHz crystal. If a GPS unit is present, when a valid time is received via the serial port, it is compared against the RTCC which is moved forward or back if necessary to keep correct time. Display multiplexing is performed using a timer interrupt so that if the micro is busy doing some processing (eg, geographic searching to determine your time zone) it won’t interfere with the display. Infrared reception is similarly interrupt-based, however this uses a pin change interrupt as well as a timer to measure infrared pulse duration. For details on how the GPS latitude/ longitude information is used to search an extensive geographic database for time zone determination, see the explanation on pages 34 & 35 of the February 2015 issue. We re-used this part of the code from the Nixie Clock project, along with the geographic data. There were some bugs in the original Nixie Clock code in handling some time zones and the fixes have been incorporated into this project. We used some other lessons learned in the design of the Nixie Clock when designing this project. For example, we’ve connected the LDR to the 3.3V supply which is not derived from the 1F supercapacitor, to increase the time that the supercap lasts in a blackout. We changed D2 to a Schottky type for the same reason. Originally we used a standard diode for this role due to the much lower reverse leakage but it turns out that the lower forward voltage of the Schottky diode more than makes up for this. Choosing a GPS module You need a GPS module that will fit in the space available but also with good sensitivity as it must work well indoors. Many such modules are available at surprisingly low prices. The GlobalSat EM408 we used in our prototype (US$17.81) has a tracking sensitivity of -159dBm while the more expensive Fastrax UP501 is -165dBm (ie, better). We found a VK16E (-159dBm) on Ali Express for US$8.79 and a u-blox Neo-6M (-161dBm) for US$10.42. Other differences between modules are: TTL or RS-232 signalling, 4800 or 9600 baud, whether it has an onboard battery back-up, whether it has a 1PPS output and whether there’s an enable pin and how it’s driven. TTL is preferred over RS-232 as RS-232 requires a resistor to be added in series with the TX pin of the module. The software will automatically detect the baud rate. Whichever module you choose, you will need to check the data sheet to determine these factors and its pinout. A 1PPS output is desirable and gives the most accurate time but is not vital. Onboard battery back-up will let the module ride out longer black-outs but modules without can have VBAT connected to the supercap so that it doesn’t have to go through a slow coldstart each time it powers up. Many modules have no enable pin or if they do, it may be left floating. However, the EM408 we used required a pull-up resistor between its enable input and its power supply so we soldered one onto the pin header. It looks a bit messy but does the job. Construction The first step in the assembly is to fit the control components to the back December 2015  41 100nF COM COM BC337 DISP2 COM PB1 6.8k LED1 LDR1 LED2 E LED3 A A COM COM COM DISP4 C D E COM COM DISP5 C D E CON3 COM LED GPS CLOCK/TIMER GPS POWER LK1 5V DISP6 COM COM S1 C 2015 19110151 REVB 3.3V 1PPS +V TX RX GND 1 2 3 4 5 6 VBAT CON2 GPS ICSP 22pF 22pF B A Dp F G DISP6 SILICON CHIPC D E E (OR G LOBALSAT EM-406/EM-408) D G FRONT VIEW (81% FULL SIZE) C B E F (PATCH ANT) F 6 FASTRAX UP501 GPS RX A 1 DISP1 10k X1 32768Hz 42  Silicon Chip DISP3 C D E R8 R7 R6 R5 R4 R3 1 10k B A Dp F G A 100k D R2 10 µF 10k DISP5 IC1 PIC32MX170F256B G R1 LED3 LED4 100 µF C 10Ω 100nF 100nF DISP2 R9 Q19 Q18 Q17 Q16 Q15 Q14 Q13 Q1 IRD1 10k 100Ω (FACING DOWN) Q12 Q5 Q3 Q2 B A Dp F G DISP4 D E LED2 Q11 C Q4 Q1-Q9: BC547 Q10-Q19: BC337 Q20-Q26: MPSA13 E F Q6 Q7 Q8 B A Dp F G D G DISP3 A DISP4 F 1k A 18Ω 1k G 18Ω 1k A 18Ω 1k B 18Ω LED1 1k 18Ω B 1k A 18Ω 1k DISP3 18Ω 1k LDR1 68Ω Q9 1k 18Ω C B LED4 DISP1 C D E SUPERCAP 100 µF Q10 100nF Q23 Q21 Q26 Q25 Q20 Q24 Q22 F D C D E REG3 D2 MCP1700 100nF B A Dp F G G IC2 HEF4028 DISP2 A C IC3 40109B 13V DISP5 COM + S2 CON1 1F 5819 D1 100 µF 100 µF DISP1 G REG1 7805 100 µF D G B A Dp F 100 µF C B A DISP6 B REG2 REAR VIEW (81% FULL SIZE) MCP1700 ZD1 22Ω 5819 E 22Ω F 22Ω + Fig.2: most of the components are fitted to the rear of the PCB. Note that the values of resistors R1-R9 are varied to suit the 7-segment LED displays used and that the 10µF capacitor can be either an SMD ceramic (as in our photos and recommended) or a through-hole tantalum type. The six large displays are mounted on the front of the PCB via socket strips, along with the LDR for ambient light sensing and four discrete LEDs which form the colons between the hours, minutes and seconds. IRD1 is mounted on the back of the PCB but “peers” through a hole between the minutes and seconds displays. of the PCB, as shown in Fig.2. Start with the resistors; it’s best to check each batch with a DMM before fitting them although you can also use Table 1 as a guide. Remember to change the resistor values to suit the display colour you’re using (see parts list). Follow with the two Schottky diodes, orientated as shown in Fig.2, then zener diode ZD1. Then fit the socket for IC1, with the notch at the top as shown. The watch crystal can go in next; be careful since its leads are very thin. Bend them so that the siliconchip.com.au crystal can lie flat on the board without the leads touching the metal can and solder a resistor lead off-cut to the pads on either side after bending it tight over the can to hold it down. Next, bend REG1’s leads down by 90° exactly 5mm from its body and attach it to the PCB with a flag heatsink wedged in-between. The head of the M3 machine screw goes on the other side of the PCB, with a flat washer under the screw head and a shakeproof washer under the nut. Do the screw up tightly and make sure that the heatsink is straight and that the regulator pins pass through the appropriate mounting holes before soldering and trimming the three leads. Now solder IC2 and IC3 in place. Be very careful to get the orienta- Above: compare these photos with the layout diagrams (Fig.2) when building the unit. Note that our prototype used an RS-232 GPS module. This meant that we had to install a couple of extra 6.8kΩ resistors (see text). tion correct (pin 1 at upper-left) and don’t get them mixed up as it’s very difficult to de-solder DIL ICs from a plated-through board. You could use sockets, as we did for our prototype, however direct soldering provides better reliability. The ceramic capacitors can go in next, followed by the transistors. There are 26 in total and three different types, so don’t get them mixed up. Fig.2 shows the position and orientation of each. You will probably need to crank the leads out in each case, which is easy to do with a small pair of pliers. The two MCP1700 regulators can then go in, using the same procedure. Now fit the two pushbuttons at either end of the PCB, making sure they are pushed all the way down onto the board before soldering them. Follow with the DC socket (the same comment applies). The two pin headers can then be soldered in place, followed by the remaining capacitors. Watch the electrolytic and tantalum (if used) capacitor polarity, especially the supercap, as you may need to check its markings carefully to figure out which terminal is positive and which is negative. Three sets of holes are provided for the supercap, to suit different lead spacings. Mount the piezo buzzer now; it’s also polarised and the Table 1: Resistor Colour Codes   o o o o o o o o siliconchip.com.au No.   1   4   2   9   1   3   1 Value 100kΩ 10kΩ 6.8kΩ 1kΩ 100Ω 22Ω 10Ω 4-Band Code (1%) brown black yellow brown brown black orange brown blue grey red brown brown black red brown brown black brown brown red red black brown brown black black brown 5-Band Code (1%) brown black black orange brown brown black black red brown blue grey black brown brown brown black black brown brown brown black black black brown red red black gold brown brown black black gold brown December 2015  43 The six 7-segment digits which form the clock display are in separate modules measuring 48 x 70 x 12mm, each with 10 pins. The digits themselves are 57mm tall and 32mm wide. Each segment consists of four series LEDs, except for the decimal points which comprise two series LEDs. Two of the 10 pins are the common anode connections while the remaining eight are the separate cathodes for each segment. In our clock, the colons between the digits are formed from discrete 5mm LEDs which are chosen to have a similar colour and brightness to the digit segments. Most 7-segment display data sheets lack good data on the LED characteristics, which is important to determine how best to drive them. We purchased a number of compatible 7-segment modules in various colours and tested them. Some of these came from long-established LED manufacturer Kingbright while others came from Chinese factories. While it may seem surprising, overall we found the Chinesesourced displays to give the best results, offering very high and even brightness at a reasonable price. We’ll be offering some of these in our on-line shop for readers who wish to build a clock using these units. The results of our measurements are shown in Fig.3. This shows the forward voltage of the four series LEDs in one segment from each display along with the current flow for that voltage. The dot on each curve shows the point at which we considered the light output to be subjectively bright and gives some idea of how hard each display type would have to be driven to achieve a sufficient brightness level. The LBT23101BG curve has no dot because it did not achieve what we would consider to be a sufficient brightness level even at 100mA! These also showed a dramatic colour shift towards red at higher DC currents so we would not recommend these be used, especially for a multiplexed display like this one. As expected, the blue LEDs have the highest forward voltage (a typical blue LED has a voltage drop of 3-3.6V) while the red LEDs have the lowest and thus would be suitable for 44  Silicon Chip 90 Current Flow (milliamps) LED Display Characteristics 100 CA123101BS SA23-11SRWA LBT23101BG SA23-11YWA SA23-11GWA LBT23101BGG LBT23101BB 80 70 60 50 40 30 20 10 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Anode-Cathode Potential Difference (Volts) Fig.3: voltage/current curves for various types of 2.3-inch 7-segment LED displays. The SA23 types are from Kingbright while the others are from various Chinese LED factories. The dots on each curve indicate the current level at which high brightness is apparent. Note the dramatic colour shift with current of the LBT23101BG. use with a 12V supply such as in a car or caravan. Green and yellow LEDs tend to fall in-between. We didn’t test white displays but we expect they would have similar characteristics to the blue types. There were some surprises in the results. Of the green displays, the most expensive were the “emerald green” types and these have a colour more towards the blue end of the spectrum, while the standard green types are more yellow. As you can see, the emerald green LEDs have quite similar characteristics to the blue LEDs, with a high forward voltage, but they are also extremely bright even at low currents. This, combined with the pleasant shade of green and good colour consistently would make them our first choice for building a green LED clock. Our conclusions are as follows: the Kingbright SA23-11SRWA and Chinese CA123101BS are similar and both quite suitable red displays. Kingbright SA23-11YWA (yellow) and SA23-11GWA (green) are usable but need to be driven right to their instantaneous current limits for sufficient brightness. For colours other than red, the Chinese-sourced LBT­ 23101BGG (emerald green) and LBT23101BB (blue) look excellent however they also require a 15-18V supply to get a good and consistent brightness level. siliconchip.com.au Next, plug IC1 into its socket. Make sure its orientation is correct. If your chip is not already programmed, you can connect a PICkit3 (or similar) to CON3, the ICSP header. Switch on the PIC­kit’s internal 3.3V power supply and program the chip. Alternatively, you could feed 12V DC into CON1; assuming the board has been built correctly, this should also allow you to program the chip. Displays Above: the 7-segment LED displays plug into sets of 5-way SIL sockets, as shown on Fig.2. Make sure that the displays are all correctly orientated (ie, decimal points at bottom right). plus symbol on the PCB shows how it is orientated. Infrared receiver IRD1 is mounted on the same side of the PCB as the other components installed so far, however it’s flush against the PCB and “looks” through the adjacent hole. Bend its leads down very close to the body, towards the lens, but don’t let them actually touch the body as it may be made of conductive plastic. Push it down so that the lens protrudes through the hole in the PCB as much as possible, then solder and trim the leads. Assuming you are fitting a GPS module, attach it in the mounting location provided using doubled-sided tape, with the ceramic patch antenna at the top, and solder the four, five or six wires to the adjacent pads. Refer to Fig.2 to see which wires go where. All modules will need the GND, RX, TX and V+ wires connected. Modules with a 1PPS output should also have that wire connected and if the module requires a RAM back-up supply, connect it to the “VBAT” pad. Place the jumper shunt on LK1 to select either the 3.3V or 5V supply as needed (if your module will run off both, use the 3.3V supply). As mentioned earlier, if your GPS module uses RS-232 levels, you will need to solder a series resistor of around 6.8kΩ between the module and the TX pad on the PCB or IC1 could be damaged. We used an RS-232 EM408 module in our prototype so we soldered two resistors to CON2, one from +V to pull its enable pin high and one in series with the TX pin as mentioned above. siliconchip.com.au The displays are not soldered to the PCB directly as this would block access to the solder joints for the remaining components, should one of them require replacement. Instead, they plug into socket strips. Snap or cut the socket strips into 12 lengths with five pins each. Do this carefully as the plastic surround can break off in the wrong place if you aren’t careful. The overlay diagram for this side of the board is also shown in Fig.2. Solder these on the opposite side of the PCB to the other components, at the top and bottom of each display location. Make sure they are all pushed down fully into the PCB and line up properly. Now trim the leads of all the displays to 5mm and plug them in. The easiest way to ensure the displays sit at a consistent level is to cut a 5mm wide strip of cardboard and use this as a template while trimming the pins. When plugged in, the back of each display should rest just above the top of the socket strips. Make sure the display orientation is correct, ie, the decimal points are all lined up along the bottom of the PCB. Check that the distance from the front of the displays to the top of the tallest component on the other side of the board is no more than 30mm. If it’s more than this, you will need to trim the display leads further. In practice, this means the top of each display should be just under 17mm from the PCB surface. The LDR is located on the same side as the displays and fits between DISP2 and DISP3. Solder it a couple of millimetres above the surface of the PCB, just below the bottom edge of the displays. The final components to install are the four LEDs which form the colons between the hours, minutes and seconds parts of the display (and flash at 1Hz). These are fitted so the domed parts of their lenses protrude above For our prototype, we plugged the 5mm blue LEDs into short sections of socket strip cut from what was left after fashioning the sockets for the six digits. This makes it easier to try out different LEDs for the best colour match and viewing angle to go with the clock display. the top of the displays. This requires them to be mounted so that their plastic bodies are 11mm above the PCB. You can achieve this by placing an 11mm tall cardboard spacer between the leads and pushing the LED down so that bottom of its lens is in contact with the spacer. It’s then just a matter of soldering and trimming the leads and sliding the spacer out. Make sure all four anodes (longer leads) are orientated towards the lefthand edge of the PCB as shown in Fig.2. Similarly, the flat sides of the LEDs should go to the right. For our prototype, we trimmed the LED leads shorter and plugged them in using short pieces of socket strip, as shown in the above photo. This allowed us to easily experiment with several different types of LED to find a good match for the 7-segment displays. If you’re using LEDs that we’ve supplied with the 7-segment displays, you don’t need to do this but if using other LED types, it might be a good idea. Note that the LED mounting locations are slightly staggered, so that the “colons” they form line up with the slanted 7-segment digits. The 5mm LED lens domes protrude above the 7-segment displays so that they can be seen when the display is viewed at an angle; these poke through holes in the laser-cut case which hold them neatly in place despite the long leads. That’s all for this month. Next month, we’ll go over testing the PCB, making the case, putting it all together and explain how to set up the remote control, set the time and use the variSC ous functions of the clock. December 2015  45