Silicon ChipGPS-Disciplined Oscillator - May 2023 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: The coming AI revolution will soon bring many changes
  4. Feature: Avalon Airshow 2023 by Dr David Maddison
  5. Project: Dual RF Amplifier by Charles Kosina
  6. Feature: UVM-30A UV Light Sensor by Jim Rowe
  7. Feature: ElectroneX 2023 by Australasian Exhibitions & Events
  8. Project: GPS-Disciplined Oscillator by Alan Cashin
  9. Project: Wideband Fuel Mixture Display, Pt2 by John Clarke
  10. Subscriptions
  11. Project: Songbird by Andrew Woodfifield
  12. Serviceman's Log: You win some, you lose some by Dave Thompson
  13. Vintage Radio: Astor APN transistor radio by Ian Batty
  14. PartShop
  15. Market Centre
  16. Advertising Index
  17. Notes & Errata: Active Mains Soft Starter, February & March 2023
  18. Outer Back Cover

This is only a preview of the May 2023 issue of Silicon Chip.

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

Articles in this series:
  • The Avalon 2013 Air Show (May 2013)
  • The Avalon 2013 Air Show (May 2013)
  • The Australian International Airshow 2015 (May 2015)
  • The Australian International Airshow 2015 (May 2015)
  • Avalon Airshow: from killer drones to spacecraft! (May 2019)
  • Avalon Airshow: from killer drones to spacecraft! (May 2019)
  • Avalon Airshow 2023 (May 2023)
  • Avalon Airshow 2023 (May 2023)
Items relevant to "Dual RF Amplifier":
  • Dual RF Amplifier PCB [CSE220602A] (AUD $2.50)
  • Short form kit for the Dual RF Amplifier (Component, AUD $25.00)
  • Dual RF Amplifier PCB pattern (PDF download) [CSE220602A]] (Free)
  • Dual RF Amplifier box drilling details (Panel Artwork, Free)
Items relevant to "UVM-30A UV Light Sensor":
  • Demonstration software for the UVM-30A UV light sensor module (Free)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
Items relevant to "GPS-Disciplined Oscillator":
  • GPS-Disciplined Oscillator PCB [04103231] (AUD $5.00)
  • PIC16F1455-I/P programmed for the GPS-Disciplined Oscillator (0410323A.HEX) (Programmed Microcontroller, AUD $10.00)
  • 12V to 7.5V buck module (DD4012SA 7.5V) (Component, AUD $5.00)
  • Neo-7M GPS module with onboard SMA connector & 5-pin header (Component, AUD $20.00)
  • GPS antenna with cable & SMA connector (Component, AUD $10.00)
  • CH340G-based USB/serial module with chassis-mounting extension cable (Component, AUD $15.00)
  • Firmware for the GPS-Disciplined Oscillator (0410323A.HEX) (Software, Free)
  • GPS-Disciplined Oscillator PCB pattern (PDF download) [04103231] (Free)
  • GPS-Disciplined Oscillator box drilling details (Panel Artwork, Free)
Items relevant to "Wideband Fuel Mixture Display, Pt2":
  • Wideband Fuel Mixture Display PCB [05104231] (AUD $10.00)
  • PIC16F18877-E/PT programmed for the Wideband Fuel Mixture Display (WFMD) [0510423A.HEX] (Programmed Microcontroller, AUD $15.00)
  • Wideband Fuel Mixture Display short-form kit (Component, AUD $120.00)
  • Firmware for the Wideband Fuel Mixture Display (WFMD) [0510423A.HEX] (Software, Free)
  • Wideband Fuel Mixture Display PCB pattern (PDF download) [05104231] (Free)
Articles in this series:
  • Wideband Fuel Mixture Display Part 1 (April 2023)
  • Wideband Fuel Mixture Display Part 1 (April 2023)
  • Wideband Fuel Mixture Display, Pt2 (May 2023)
  • Wideband Fuel Mixture Display, Pt2 (May 2023)
  • Wideband Fuel Mixture Display, Pt3 (June 2023)
  • Wideband Fuel Mixture Display, Pt3 (June 2023)
Items relevant to "Songbird":
  • Songbird PCB [08103231] (AUD $4.00)
  • Songbird kit (Component, AUD $30.00)
  • 3D printer files for the Songbird (Software, Free)
  • Songbird PCB pattern (PDF download) [08103231] (Free)

Purchase a printed copy of this issue for $11.50.

By Alan Cashin GPS-Disciplined Oscillator The GPS-Disciplined Oscillator (GPSDO) is built almost entirely in software, so it only requires a PIC, an oven-conditioned crystal oscillator and a few other supporting parts. It provides an extremely accurate 10MHz signal with an error in the parts per billion range. T here are a few situations where having a very accurate frequency is essential. Many pieces of test equipment, such as oscilloscopes and spectrum analysers, have an internal 10MHz reference that’s accurate to within a few Hz (around one part per million). They usually have an input socket for a more precise external signal source for operating with much higher precision. As people explore high and higher operating frequencies, reference accuracy becomes more critical. An error of 1 part per million (ppm) at 7MHz is only 7Hz, hardly noticeable in a single-­sided band (SSB) signal). But at 5GHz, the same error is 5kHz, enough for the signal to not be received at the expected frequency. Global Navigation Satellite System (GNSS) satellites have accurate atomic clocks onboard that are adjusted by signals from ground-based master clocks. The satellites broadcast signals with precise timing that allow a GPS receiver to determine the receiver’s location and the time. Many GPS receiver modules generate an accurately timed one pulse per second (1PPS). This project describes a GPSDO that uses the 1PPS signal to adjust (discipline) the frequency of a 10MHz oven-conditioned crystal oscillator (OCXO). The output is accurate to a few parts per billion (ppb) at worst and normally 1ppb or better. GNSS and GPS GPS refers to the constellation of navigation satellites launched by the US government but is sometimes used to describe any positioning system that uses satellite data for navigation. Last century, the only useful constellation was the GPS constellation. More recently, many nations have launched their own satellite constellations, such as GLONASS (Russia), BeiDou (China) and Galileo (Europe). We published a detailed article on this subject in the November 2019 issue (siliconchip.au/Article/12083). The term ‘global navigation satellite systems’ (GNSS) refers to all the available constellations. Many “GPS” receivers are actually GNSS receivers and can use data from several constellations. This means the receiver is more likely to pick up usable signals since many more satellites are available to it. However, there are differences between constellations, and the receiver may be less accurate if it switches between constellations. Designing a GPSDO You will need a GPS module with an SMA socket and 5-pin header, such as the Neo-7M shown above. Make sure the header is wired as per Fig.2. 62 Silicon Chip I first became interested in GPSDOs after reading the GPS-Based Frequency Reference by Jim Rowe (March & April 2007; siliconchip.au/Series/57). In theory, a microcontroller could replace most of the discrete Australia's electronics magazine components. To test this, I designed a GPSDO that used a PIC16F628A. It worked, but was too elaborate. I decided to improve my old design after seeing Tim Blythman’s Programmable GPS-synched Frequency Reference (October & November 2018 issue; siliconchip.au/Series/326), which has an accuracy of ±100ppb. The aim of this was to create a useful and inexpensive GPSDO that could deliver 10MHz into 50W with a maximum error of 0.01Hz. It is based on a cheap CTI OSC5A2B02 oscillator, a PIC16F1455 microcontroller and a 74HC04 hex CMOS inverter running from a 5V supply. The GPS module I used was the cheapest available, the u-blox NEO-6 (possibly a clone), using an active antenna with a 3m lead. There was no need for any display; anyone with a smartphone can see their position and get accurate time, so such a display is redundant. The operational status is indicated with a single LED. This prototype system performed well enough to justify creating a PCB, and several were built. However, it was overly sensitive when connected to other equipment. Another problem was that I had not designed the PCB with any enclosure in mind, so it needed a larger enclosure than necessary. And people may prefer a 12V supply rather than a 5V supply. Consequently, I designed the revised PCB that is presented in this article. The oscillator is substantially independent of the rest of the circuitry. The PCB fits a UB3 Jiffy box and runs from 12V DC. How it works The GPSDO is designed to use a 1PPS signal and NMEA (National siliconchip.com.au Marine Electronics Association) serial messages delivered at 9600 baud. Many GPS receivers have these capabilities in a wide range of prices and feature sets. The GPSDO counts the cycles of the local oscillator between successive 1PPS signals. Any deviation from ten million causes a change in the control voltage to ensure there are ten million cycles per 1PPS. The oscillator is locked to the 1PPS signal, and so it can be used to accurately time long periods, as well as provide an accurate frequency. In the long term (days or weeks), a GPS receiver provides a very accurate time signal. But in the short term (second to second), there can be variations due to receiver design, signal reception and other factors. Many GPSDO implementations use specialised GPS receivers designed to minimise these variations and allow for relatively straightforward control strategies. This GPSDO was designed to use low-cost GPS modules that deliver a time signal with significant shortterm variations. To overcome this, the processor uses the average of many 1PPS signals to produce a more accurate result. The oscillator control is then varied at intervals of many minutes rather than continuously. The default is 512 seconds, but this can be changed through the user interface (UI). This approach has benefits and shortcomings. One benefit is that the GPSDO can evaluate its own performance. Because the control is varied by a known amount after a known interval, a maximum error can be attributed to the oscillator output before the correction is applied. The drawback is that the local oscillator’s phase (the amount of lag or lead) can be greater than it would be with a PLL (phase-locked loop) design. But like a PLL design, the local oscillator is locked to the 1PPS signal in the long term. clock; in this case, they are the 16-bit timer Timer1 and the 10-bit PWM (Pulse Width Modulator) generator. Timer1 is used to measure the arrival time of the 1PPS signal. The 1PPS signal is one input to a comparator, with the other set to 1.9V from an internal voltage reference. The 1PPS signal swings from 0V to 3.3V, so the comparator can easily detect it. The comparator is set up to gate (pause) Timer1 when the signal arrives. Another timer (Timer2) is used to count 10 million cycles, then start Timer1 at a known point. Since Timer1 is clocked at 40MHz, the interval until it is stopped is known to within 25ns. This is compared to a target arrival time, so it can determine if the pulse arrived early or late compared to the local oscillator. From this, we can deduce whether the oscillator is running slow or fast. 25ns is a sufficiently short interval for timing when using a low-cost GPS module. The 1PPS is generated from the GPS module’s internal clock, which is not necessarily a multiple of 10MHz. Consequently, the pulse will not arrive precisely on time, but will appear to jitter around the correct value. This randomises the arrival time so that accumulating the arrival times over a period gives a statistically more accurate average arrival time. Also, the 1PPS pulse timing is affected by atmospheric conditions, the transition between GNSS constellations and other effects, so measuring to better than 25ns yields little improvement. The oscillator frequency can be varied by a few hertz on either side of 10MHz, based on a control voltage applied to the oscillator. The OSC5A2B02 has a nominal control voltage of 2V±2V and a sensitivity of around 0.1V/Hz. The PWM peripheral generates the required voltage, with its output going through a filter More capabilities All a GPSDO has to do is time the arrival of the 1Hz pulses and adjust the control voltage to correct any deviation of the oscillator from 10MHz, as described above. However, it is desirable to be able to determine if the GPS unit is generating valid pulses, measure the GPSDO’s performance, and indicate to users that it is functioning correctly (or not). The GPS module generates NMEA messages as 9600 baud serial data (the micro can be programmed to handle Photo 1: the preferred position for mounting the PCB on a UB3 enclosure. In more detail I chose a PIC16F1455 for the microcontroller as it has several useful peripherals. Its clock signal is the 10MHz output of the reference oscillator, which allows the micro to count the 1PPS pulses directly. The processor has a PLL to multiply this by 4, giving an internal 40MHz clock. Some of the inbuilt peripherals can use this siliconchip.com.au with a time constant of over a second to eliminate all traces of the pulses. The output pulses of the PWM unit are at 40kHz, with the pulse width variable from 0 to 25µs in 25ns increments. If the pulse width is only changed when a change of control voltage is required, there would be 1000 voltage steps between 0V and 5V, which would change the frequency in increments of 5ppb. This is too coarse to be helpful. The traditional way to tackle the problem is to add more hardware. Typical solutions are to use PWM over a smaller range and have a potentiometer to make a coarse adjustment; combine the output of two PWMs, one for coarse control and one for fine control; or use an external DAC (digitalto-­analog converter) with 16 bits (or more) of resolution. This GPSDO solves the problem in software by dithering the pulse width on every pulse. Selected pulses are made 25ns longer. The base number for this is a 24-bit number, allowing the control voltage to be varied in increments of less than 1µV. This is far finer than required, but as it is generated in software, it is effectively free. The unique pulse stream repeats more than twice a second, so the heavy filtering is adequate to remove any artefacts created by the dithering. Australia's electronics magazine May 2023  63 Fig.1: the GPSDO is built around oven-controlled crystal oscillator OCXO, GPS module MOD1 and microcontroller IC4. IC4’s clock is derived from the oscillator’s 10MHz output, and it analyses the 1Hz pulses from the GPS module to determine if the control voltage needs to change. That voltage is produced by error-diffused PWM buffered by Mosfets Q1/Q2 and filtered by a three-stage LPF. the less common 4800 baud). The GPSDO decodes the messages, looking specifically for $xxRMC messages (xx because some modules output $GPRMC [GPS], some use $GNRMC [multi-constellation] etc). RMC is the recommended minimum message, so almost all GPS modules will deliver it. One field in the message indicates if the GPS has a valid location fix. The GPSDO ignores the 1PPS pulses if the fix is not valid. Although not necessary for GPSDO operation, other messages are decoded to obtain data useful for logging such as the date and time. The GPSDO uses a single LED to indicate its status. The LED has patterns for error conditions, startup stages and operational status. When the OCXO is locked to the GPS 1PPS signal, the LED repeats a pattern once 64 Silicon Chip per second. A single 50ms flash indicates the OCXO should be within 1ppb of 10MHz. Otherwise, there are two closely-spaced 50ms flashes indicating the accuracy is uncertain. A UI is provided to obtain more status information, and some limited control over the GPSDO, via the microcontroller UART. By default, the NMEA data stream from the GPS module is passed through to the UART. Programs are available to decode the information and display items such as the number of satellites in view, their signal strength, position in the sky and the location data’s reliability. This can be useful to diagnose performance issues. The UI can also be accessed by a terminal program such as TeraTerm. The user can change the output from the NMEA stream to a log of what the GPSDO is doing. There are some Australia's electronics magazine control functions to change some defaults, reboot or update the software without removing power. Circuit details The entire circuit is shown in Fig.1. The controlling PWM signal produced by IC4 emanates from pin 7 and is fed to the gates of P-channel & N-channel Mosfets Q1 and Q2, which operate as an inverter. When the PWM signal is low, Q1 switches on, pulling the output up via a 10kW resistor, whereas when the PWM signal is high, Q2 switches on, pulling the output low via another 10kW resistor. The resulting signal is fed through three RC low-pass filters connected in series to the control terminal (pin 1) of the 10MHz crystal oscillator (OCXO). The time constant of this filter is around one second. siliconchip.com.au The main reason for inverting the PWM signal with two Mosfets was so the input to the PWM filter can have its amplitude determined by a very precise reference voltage for stability in the resulting control signal, generated by a MAX6350 voltage reference IC. However, testing showed that it was sufficient to isolate the PWM supply from the general 5V supply. The 5V rail from the standard linear regulator that powers the OCXO is stable enough that the MAX6350 IC is not required. Therefore, constructors should omit REF5 and instead solder a wire from the output of REG6 to REF5’s pad 6 (the dashed line in Fig.1). Regardless of the source of the reference voltage, it is fed through an LC low-pass filter (1mH/47μF) before being applied to the source of Mosfet Q1 to remove any digital noise. siliconchip.com.au The output signal from the OCXO at pin 3 is fed through an inverter (IC7a) and 22pF AC-coupling capacitor to the clock input pin (pin 2) of microcontroller IC4, which has an internal DC bias. It’s also fed to the remaining five inverters in IC7 connected in parallel, with series resistors on the outputs to prevent them from ‘fighting’ each other if they don’t switch simultaneously. The output of this set of inverters is AC-coupled to output connectors CON7 & CON9 with a 1kW resistor to provide 0V DC bias. An opto-isolated serial interface is provided at CON5, which can be plugged straight into a USB/serial converter module. By isolating it, we prevent electrical noise from being fed back from a connected computer. Isolation is via two opto-couplers, one Australia's electronics magazine for each direction (in/out) – OPTO1 & OPTO2. As for the power supply, the incoming 12V is filtered by a 100μF capacitor and then fed into a buck converter module (REG1) that efficiently drops it to 6.5-7.5V. Its output is filtered by a 220μF capacitor, then an LC low-pass filter to remove most of the switching noise (100μH/470μF) before being applied to two 5V low-dropout linear regulators, REG3 & REG6. REG3 powers microcontroller IC4, hex inverter IC7, the GPS module and some other bits and pieces, while REG6 powers the crystal oscillator and PWM control signal inverter, as mentioned earlier. Both regulators will remove any remaining switching noise from the buck regulator that passes through the LC filter. The GPS module is wired to CON6. May 2023  65 We recommend you use this type of USB/serial module, as it makes the overall wiring much easier. Note the non-standard orientation of Q1; see the panel on p68. The 1PPS signal is fed to pin 8 of IC4 while the serial stream goes to pin 12. The PCB has provision for data to be fed in from a GPS receiver via dual-differential receiver IC3. This is an experimental interface to allow remote location of the GPS receiver for situations where a local GPS antenna cannot pick up adequate GPS signals. The connection to the remote receiver utilises a standard Ethernet UTP cable, with two pairs for the two signals and the remaining pairs for 12V power. The remote end requires a buck converter, a line driver and the GPS receiver. This setup has been tested over a 12m cable, and worked over 20m. However, I did not design a PCB for this. If you wish to implement this, fit the line receiver IC using a socket. For remote use, install the line receiver. For local use, remove the line receiver and plug the GPS receiver into CON6. Otherwise, IC3, CON8 and the two associated 100W resistors can be left off. Preparing the enclosure Before mounting any parts on the PCB, use it as a drilling template for the mounting holes on the Jiffy box lid, which will become the base. Refer to Photo 1, which shows the preferred position for a UB3 enclosure, with the power connector close to the back and plenty of space for mounting the buck converter module. efficiency), although with the small flag heatsinks specified, that should not bother the regulators. The prototype used an LM2596based buck converter module with an adjustable output, set to 7.0V (6.5-7.0V is the ideal range). As it has suitable onboard capacitors, the 100μF and 220μF supply capacitors on the main PCB can be omitted. It was attached edge-on using a few pieces of solid copper wire scavenged from an Earth conductor; no additional support was necessary (see the photo below). With a UB3 Jiffy box, this converter just fits between the posts in the lid. You can do something similar, but using the specified regulator is neater and easier, and you don’t have to be so concerned with the exact mounting position of the PCB on the lid. If you want to use an adjustable buck regulator module, consider the MINI360 (SC4399; siliconchip.com.au/ Shop/7/4399), which is small, inexpensive and can deliver up to 1.8A. Construction The control PCB is coded 04103231 and measures 100 × 55mm. Refer to the overlay diagram, Fig.2, during construction. Begin the PCB assembly by fitting the only SMD component, inductor L1. It’s reasonably large and easy to handle but requires quite a bit of heat to flow the joints. Turning the iron up will help. First, spread a thin layer of flux paste on the pads and add some solder to one. Place L1 over its pads and use something to clamp it in place while adding solder to the sides of the two pads, one at a time. Once the solder contacts the inductor, it will solidify, and you will have to hold the iron there, continuing to apply heat until it melts again and flows to form a proper joint. When it remelts, feed in some extra solder until you have nice shiny fillets. With that in place, move on to the through-hole parts, starting with the resistors. All but one are mounted vertically to save space. While doing that, use one of the lead off-cuts to fit the wire link shown in red in Fig.2, bypassing the unused REF5. Follow with the two TO-92 Mosfets, being careful not to get the different types mixed up, then the ceramic capacitors, which are not polarised. Next, install the electrolytic capacitors, which need to have the longer positive leads inserted into the pads marked with a + symbol. The striped side of the can indicates the opposite (negative) lead. Then solder the opto-couplers (OPTO1 & OPTO2) plus hex inverter IC7. These can all be soldered to the board without a socket, but make sure pin 1 is in the right location in each case before soldering. Now fit microcontroller IC4, you can solder it to the board as there is The LM2596 module is inexpensive and adjustable, but mounting it can be messy. Buck converter We have specified a low-cost 7.5V 1A buck converter that should be a direct fit on the PCB, similar to a standard linear regulator. The 7.5V option provides plenty of headroom but will increase dissipation in the case (ie, reducing 66 Silicon Chip Australia's electronics magazine siliconchip.com.au provision for in-circuit programming/ reprogramming (ICSP) via CON3, but you might prefer to use a socket to make it easier to replace. If IC4 is programmed before installation, CON3 is not needed as updates can be made via the UI on the serial port. Next, install the linear regulators (REG3 & REG6) plus the buck regulator module (REG1), making sure they are orientated as shown in Fig.2. For REG1, various types can be used, and it isn’t always obvious which way around they should go. Check the module and verify that the input and output pins match the “IN” and “OUT” labels shown in Fig.2. After that, fit the OCXO, which can only be inserted into its pads in the correct orientation. We don’t recommend you fit IC3, CON8 or the two resistors next to IC3. Similarly, REF5 should be missing, although you will have already soldered a wire link to its pad 6. You can now fit the DC socket to complete the board. LED1 can be mounted on the PCB, but it is more convenient to fit a twopin polarised in its place and wire up the LED to a matching plug using a length of light-duty figure-8 cable (eg, two wires stripped from ribbon cable). That will let you mount it in a hole in the case later, so it’s externally visible. Similarly, the 10MHz output socket is chassis-mounted and connected via a two-pin header, CON7. It isn’t critical that this is a polarised/locking type header; you could use a standard header and DuPont plugs or just solder the wires to the output socket to the pads, although that does make disassembly/testing a bit more difficult. Fit a standard six-pin header for the isolated USB/serial interface at CON5. The specified USB/serial module has a socket that will plug into this header later. The direct serial interface header, CON4, should not be needed. Once the PCB has been assembled, it needs to be wired to the output socket, GPS module, USB socket and LED1. Note the omitted optional parts. Programming the micro If you purchased your microcontroller from Silicon Chip, it will come programmed. Otherwise, if you have a blank micro, you can fit CON3 and program it using an in-circuit serial programmer like a PICkit 3/4 or a Snap. The PICkit 3 or 4 can supply power to the board during programming. For the Snap, arrange for your own 5V supply or temporarily connect a 12V supply to the board to program the chip. siliconchip.com.au Fig.2: fit the components as shown here, taking care with the orientation of the electrolytic capacitors, ICs, opto-couplers, regulators and LED1. Several parts are not needed and are shown left off, while CON8 and the two 100W resistors below it are depicted but not required. Don’t forget the short wire link near the middle of the board, shown in red, which bypasses REF5. Australia's electronics magazine May 2023  67 Once the chip has been programmed, you don’t need to open the box to access CON3 to reprogram it. This can be done over the serial port using the XMODEM protocol. Testing Before applying power, check your soldering for unwanted shorts, especially around the Mosfets. Also check to ensure the fillets are all shiny and well-formed, all components are in the correct locations and have the right orientations. If using an adjustable buck converter, verify that you’ve set it for approximately 7V output before connecting it to the main PCB. This is not critical as it can be adjusted later, during testing. The converters used on the prototypes are adjusted by rotating the onboard potentiometer screw anti-clockwise. Nothing happens for much of the rotation, then the voltage reduces over very little travel. Connect the LED to its header, apply power and check that it lights up or flashes. Check the output voltage from the buck module at either end of inductor L1 relative to 0V (eg, one of the two larger plated holes on either side of unused socket CON8). Verify it’s close to the expected voltage (6.57.5V). Also measure the outputs of the two 5V regulators at their tabs and verify they are both close to 5V. If the LED is not flashing, probe pin 3 of the PIC. It should be switching between 5V and 0V. If it is, you might have the LED connected the wrong way around. If the LED flashes at 2Hz, the 10MHz signal is not reaching the PIC at its pin 2. Check for a 10MHz signal between the two pins of CON7. It should also be present at pin 1 of IC7 (directly connected to the output of the oscillator). If all is well, the LED should flash at 1Hz with about 800ms on and 200ms off. This indicates that the PIC is working and using the 10MHz from the oscillator as its clock. You can check the control voltage at the control pin of the OCXO, which is connected to the right-hand end of the resistor immediately between it and REF5. It should be in the range of 2-3V, most likely close to 2.5V. If that’s wrong, it could be due to a problem BS250 Pinout Be aware that there are versions of the BS250 Mosfets with non-standard pinouts (the standard pinout is DGS left-to-right looking at the flat ‘label’ side; see Fig.1). If you end up with those, you might need to rotate it or bend the pins. Usually the non-standard versions have their pinout printed on the face. Fig.3: this shows where to drill holes in the lid/base, for mounting the PCB, and in the sides of the case, for the various chassis-mounting connectors. As noted in the text, you should ideally use the PCB as a template to mark the four holes in the lid/base, although you can use this diagram if you’ve already populated it. Note: the DC socket and GPS antenna socket locations are only guides, and the actual size and location can vary when it is mounted. So it’s best to check them before drilling. 68 Silicon Chip Australia's electronics magazine siliconchip.com.au with Mosfets Q1 and/or Q2 or a faulty oscillator module. GPS module wiring You can now solder the wires from your GPS module to the pads for CON6. Fig.2 shows the wire colours for the suggested Neo-7M module. However, you might decide to use a module with an onboard antenna if you have good signal strength in your lab. It is best to use an active antenna on a lead as the signal quality indoors is usually too marginal. The antenna is ideally placed outdoors with a good view of the sky. Adequate signal may be obtained indoors near openings such as a window. If using a different module, consult its data sheet to determine the connections. Most TTL modules should be suitable. The specified module has a standard 5-pin header, so a short 5-way ribbon cable with DuPont connectors at either end will suffice to connect it to the CON6. In contrast, the VK2828U7G5LF module has an onboard miniature connector and comes with a matching cable with bare ends, so you could solder its wires directly to the board. It also has an enable (EN) wire that needs to connect to the 5V pad. The system can now be powered up with the GPS module attached. There’s a power light on most GPS units; if present, it should light up. If the system LED is now making a double flash at three-second intervals, all is well. That indicates that data is received from the module but isn’t seeing any satellites yet. Next, plug the USB/serial module into CON5; make sure it’s the right way around, with its DTR pin to pin 1 on the left and its GND pin on the right. Connect it to your computer, open a serial terminal on the COM port that appears, power up the board, and you should see one line of text when it detects that it is running with the 10MHz clock. With the GPS module attached, it should pass through the NMEA data to the serial output (this is the default when first powered up, but you can change it later). Place the GPS antenna where it will receive a good signal from the satellites. Turn the system on, and the double flash at three-second intervals should resume. It could take up siliconchip.com.au The finished PCB; note the wire soldered to pin 6 of REF5 to bypass it (on the underside). to 30 minutes or possibly a little longer for the GPS module to pick up all the satellites after a ‘cold start’. When that happens, the LED flash pattern should change. The LED reports the number of satellites seen (in binary) until a fix is obtained. This may take some time, sometimes as long as 15 minutes. If the system stays in the double-flash state, the antenna may not be in a good position, or it isn’t working. Final testing If the GPS module is locating satellites, the system should transition after some time to a flash pattern every four seconds. It starts as five flashes, a single followed by four doubles, and counts down. If there is no flashing, it is most likely that the GPS module has reported a good fix, but the 1PPS signal is not getting to the PIC processor. Do not allow the system to run for more than an hour after this transition. Turn it off, detach the GPS module, and run the system without the GPS for a few hours or overnight. The reason is that most crystal oscillators need time to settle down after unknown handling before being installed. Calibration The GPSDO is self-calibrating. The purpose of the calibration is twofold; it determines the actual sensitivity of the crystal oscillator (the control voltage vs frequency relationship) and a reasonable control voltage to use when the system is started. After the oscillator has been running for a few hours, turn off the system Australia's electronics magazine and reattach the GPS module with its antenna. Let the system run until it delivers one flash every second. This will take more than an hour, and if the GPS signal is marginal, it may be longer (or not achieved – in which case the antenna needs relocating). A single flash per second indicates the GPSDO has completed calibration and has reached 10MHz within 1ppb. A double-flash suggests it may not be within specification. It is normal to see an occasional period of double flashing, for a few minutes every few hours. This is due to the GPS switching satellites and not having a good fix immediately. A well-positioned antenna will reduce or eliminate these deviations. After the GPSDO has been switched off, it will take some time to settle down the next time it is turned on. Usually, it is unusable for up to five minutes and reliable after 15 minutes. For best results, the system should be allowed to run continuously. It improves noticeably for the first week of running. If the antenna is well-­ positioned, the system should then single-flash (indicating a precision better than 1ppb) and rarely, if ever, double-flash. Completion Once you’ve verified that it’s working, all that’s left is to finish mounting it in the case. Mount it on the base by inserting 8-10mm long machine screws from the outside, into 5mm spacers. Drop the PCB on the screw shafts, then use a set of nuts to hold it in place. May 2023  69 Fig.4: we’re recommending a USB/serial module with a micro-USB socket that plugs directly into CON5 (it has an onboard header socket). However, you can use most USB/serial adaptor you want, including the very common type shown here, wired to a 6-way female header to match CON5. Check that the DC socket will line up with the location of the hole shown in Fig.3, then make it. If it’s too low or high, you can adjust either the hole’s location or the size of the spacer between the PCB and the lid. Make the other required holes, too; if your arrangements differ from what we’ve suggested, you might need to adjust some of the hole positions and sizes. If your GPS module has an onboard antenna, you can attach it to the inside of the case using double-sided tape. Otherwise, drill the hole for the antenna connector and mount the GPS module to that hole. You will probably need to use neutral-cure silicone sealant to glue it inside the case as the SMA socket does not have a retaining nut; the threads are only for the SMA plug. Various approaches can be used for the USB interface. On the prototypes, we wired up a low-cost USB/serial adaptor, as shown in Fig.4, then wired it up to a chassis-mounting ‘extension cable’ style USB socket. However, we think we’ve come up with an easier and neater solution for the final version. The USB/serial adaptor specified in the parts list plugs directly onto header CON5 (watch the orientation). You will then have a micro-USB socket facing up from the PCB (as shown in the photos). The parts list also specifies a chassis-mount micro-USB socket with a short cable that plugs right into that socket. That just leaves the output connector. If you haven’t crimped and soldered the output connector wire with the polarised plug at one end and BNC socket at the other, do that now, then mount it on the side of the case where it won’t interfere with the PCB. Plug it into CON7 and check that the connector shell has continuity to the PCB ground. Finally, check that everything is working before ‘buttoning up’ the GPSDO in its case – verify that the LED flashes when power is applied, a ~10MHz signal appears at CON9, and you can establish USB communications via the chassis socket. Make sure the GPS antenna is plugged in and it is ready to use. The HEX file, source code and documentation for the GPSDO can be downloaded from the S ilicon Chip website; or from the author’s GitHub: https://github.com/ajcashin/ budget-gpsdo SC Australia's electronics magazine siliconchip.com.au Parts List – GPS-Disciplined Oscillator 1 double-sided PCB coded 04103231, 100 × 55mm 1 12V DC 500mA+ supply with barrel plug 1 UB3 Jiffy box (optional) 1 PCB-mount DC socket (CON2; 2.1mm or 2.5mm ID, to suit plugpack) 1 5V GPS module with 1PPS output and SMA antenna socket [eg, NEO-6M, NEO-7M or NEO-8M; SC6737] (MOD1) 1 GPS antenna with wired SMA connector [SC6738] 1 CTI OSC5A2B02 oven-conditioned crystal oscillator module (X1) [eBay www.ebay.com.au/itm/332389156868] 1 12V input, 7.5V 1A output three-pin buck converter module (REG1) [SC6739] 1 WeMos style CH340G-based USB/serial module with header socket for serial and micro-USB socket (MOD3) [SC6736; AliExpress siliconchip.au/link/abjn] 1 10cm panel-mount micro-USB socket to micro-USB plug (for MOD3) [SC6736] 1 10×10mm 100μH 1A+ SMD inductor (L1) [ASPI-8040S-101M-T or NR10050T101M] 1 1mH axial RF inductor (L2) 1 5-pin header (CON3; optional, for programming IC4 in circuit) 1 4-pin header (CON4; optional, for non-isolated serial) 1 6-pin header (CON5; for isolated serial) 2 2-pin polarised headers and matching plugs (CON7, CON8) 1 panel-mount BNC socket (CON9) 1 100mm 5-way female-to-female DuPont cable (CON6; NEO GPS module) 2 flag heatsinks for TO-220 devices [eBay 182609295159] 6 M3 × 8-10mm panhead machine screws 4 M3 x 5mm tapped Nylon spacers 2 M3 shakeproof washers 6 M3 hex nuts 2 M2 × 10mm panhead machine screws and hex nuts (to mount USB socket) 1 200mm length of twin-core light-duty figure-8 cable (eg, stripped from ribbon cable) Semiconductors 2 4N25 or 4N35 opto-isolators (OPTO1, OPTO2) 1 UA9639CP dual differential receiver IC (IC3; optional) 1 PIC16F1455-I/P 8-bit microcontroller programmed with 0410323A.HEX, DIP-14 (IC4) 1 74HC04 hex inverter IC, DIP-14 (IC7) 2 LM1085-5.0 low-dropout 5V linear regulators (REG3, REG6) 1 BS250 P-channel Mosfet, TO-92 (Q1) 1 2N7000 N-channel Mosfet, TO-92 (Q2) 1 3mm LED (any colour) Capacitors 1 470μF 10V radial electrolytic 1 220μF 10V radial electrolytic 2 100μF 16V radial electrolytic 3 47μF 50V radial electrolytic 3 10μF 50V radial electrolytic 4 100nF 50V MKT or multi-layer ceramic 1 22pF 50V NP0/C0G ceramic Resistors (all ¼W 1% axial metal film) 3 10kW 2 5.6kW 5 1kW 5 270W 3 100W – two of the 100W resistors are optional (used only when IC3 is installed) 70 Silicon Chip