Silicon ChipGPS-Disciplined Oscillator - May 2024 SILICON CHIP
  1. Contents
  2. Subscriptions
  3. Back Issues
  4. Publisher's Letter: Welcome to May!
  5. Feature: Techno Talk - One step closer to a dystopian abyss? by Max the Magnificent
  6. Feature: Net Work by Alan Winstanley
  7. Feature: The Fox Report by Barry Fox
  8. Project: GPS-Disciplined Oscillator by Alan Cashin
  9. Project: Dual RF Amplifier for Signal generators by Charles Kosina
  10. Feature: UVM-30A Module Ultraviolet Light Sensor by Jim Rowe
  11. Project: Songbird by Andrew Woodfifield
  12. Feature: Teach-In 2024 by Mike Tooley
  13. Feature: Max’s Cool Beans by Max the Magnificent
  14. Feature: Audio Out by Jake Rothman
  15. Feature: Circuit Surgery by Ian Bell
  16. PartShop
  17. Market Centre
  18. Back Issues: Peak Test Instruments

This is only a preview of the May 2024 issue of Practical Electronics.

You can view 0 of the 72 pages in the full issue.

Articles in this series:
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
Articles in this series:
  • Win a Microchip Explorer 8 Development Kit (April 2024)
  • Net Work (May 2024)
  • Net Work (June 2024)
  • Net Work (July 2024)
  • Net Work (August 2024)
  • Net Work (September 2024)
  • Net Work (October 2024)
  • Net Work (November 2024)
  • Net Work (December 2024)
  • Net Work (January 2025)
  • Net Work (February 2025)
  • Net Work (March 2025)
  • Net Work (April 2025)
Articles in this series:
  • Teach-In 2024 (April 2024)
  • Teach-In 2024 (May 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (June 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (July 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (August 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (September 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (October 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (November 2024)
Articles in this series:
  • Max’s Cool Beans (April 2024)
  • Max’s Cool Beans (May 2024)
  • Max’s Cool Beans (June 2024)
  • Max’s Cool Beans (July 2024)
  • Max’s Cool Beans (August 2024)
  • Max’s Cool Beans (September 2024)
  • Max’s Cool Beans (October 2024)
  • Max’s Cool Beans (November 2024)
  • Max’s Cool Beans (December 2024)
Articles in this series:
  • Audio Out (January 2024)
  • Audio Out (February 2024)
  • AUDIO OUT (April 2024)
  • Audio Out (May 2024)
  • Audio Out (June 2024)
  • Audio Out (July 2024)
  • Audio Out (August 2024)
  • Audio Out (September 2024)
  • Audio Out (October 2024)
  • Audio Out (March 2025)
  • Audio Out (April 2025)
  • Audio Out (May 2025)
  • Audio Out (June 2025)
Articles in this series:
  • Circuit Surgery (April 2024)
  • STEWART OF READING (April 2024)
  • Circuit Surgery (May 2024)
  • Circuit Surgery (June 2024)
  • Circuit Surgery (July 2024)
  • Circuit Surgery (August 2024)
  • Circuit Surgery (September 2024)
  • Circuit Surgery (October 2024)
  • Circuit Surgery (November 2024)
  • Circuit Surgery (December 2024)
  • Circuit Surgery (January 2025)
  • Circuit Surgery (February 2025)
  • Circuit Surgery (March 2025)
  • Circuit Surgery (April 2025)
  • Circuit Surgery (May 2025)
  • Circuit Surgery (June 2025)
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). 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. 16 This project describes a GPS-Disciplined Oscillator (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). 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. 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. Designing a GPSDO I first became interested in GPSDOs after reading the GPS-Based Frequency Reference by Jim Rowe (see PE (EPE) April-May 2009). In theory, a microcontroller could replace most of the discrete 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 and November 2019), which has an accuracy of ±100ppb. How it works The GPSDO is designed to use a 1PPS signal and NMEA (National 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 Practical Electronics | May | 2024 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 offers both 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. 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 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 Practical Electronics | May | 2024 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. The jitter effectively 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 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-­analogue 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. 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 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] and so on). 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 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. Photo 1: the preferred position for mounting the PCB on a UB3 enclosure. 17 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. 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 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 18 by IC4 emanates from pin 7 and is fed to the gates of P-channel and 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. 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. 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. Practical Electronics | May | 2024 Budget GPS-disciplined Oscillator The output of this set of inverters is AC-coupled to output connectors CON7 and 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 for each direction (in/out) – OPTO1 and OPTO2. Turning now to the circuit’s 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 and REG6. Practical Electronics | May | 2024 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. 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. 19 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. 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 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.57.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. Construction The project’s control PCB is coded 04103231, measures 100 × 55mm and is available frmo the PE PCB Service. 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 20 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 and OPTO2) plus hex inverter IC7. These components 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 directly to the board as there is 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 because any updates can be made via the UI on the serial port. Next, install the linear regulators (REG3 and REG6) plus the buck regulator module (REG1), making sure they are oriented 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 socket 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. Programming the micro Next, yo need to program your microcontroller. The procedure is The LM2596 module is inexpensive and adjustable, but mounting it can be messy. Practical Electronics | May | 2024 straightforward, just fit CON3 and then 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. 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 you decided to use 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.5-7.5V). Also measure the outputs of the two 5V regulators at their tabs and verify that 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 Practical Electronics | May | 2024 of 2-3V, most likely close to 2.5V. If that’s wrong, it could be due to a problem 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 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. 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. 21 The finished PCB; note the wire soldered to pin 6 of REF5 to bypass it (on the underside). 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 is now ready to 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 BS250 Pinout Be aware that there are versions of the BS250 MOSFETs with nonstandard 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. 22 Practical Electronics | May | 2024 module but it is not detecting 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 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 for this is that most crystal oscillators need some 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 and reattach the GPS module with its antenna. Let the system run until it delivers one flash every second. Practical Electronics | May | 2024 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) (A good, inexpensive variable voltage output device is www.aliexpress.com/item/1005002168374063.html) 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) 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. This will take more than an hour, and if the GPS signal is marginal, it may be longer (or not achieved – in which case you will need to relocate the antenna). 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. 23 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. 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 Your best bet since 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 microUSB 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 from the May 2024 page of the PE website: https://bit.ly/pe-downloads or from the author’s GitHub: https://github.com/ajcashin/budget-gpsdo Reproduced by arrangement with SILICON CHIP magazine 2024. www.siliconchip.com.au MAPLIN Chock-a-Block with Stock Visit: www.cricklewoodelectronics.com Or phone our friendly knowledgeable staff on 020 8452 0161 Components • Audio • Video • Connectors • Cables Arduino • Test Equipment etc, etc JTAG Connector Plugs Directly into PCB!! No Header! No Brainer! Our patented range of Plug-of-Nails™ spring-pin cables plug directly into a tiny footprint of pads and locating holes in your PCB, eliminating the need for a mating header. Save Cost & Space on Every PCB!! Visit our Shop, Call or Buy online at: www.cricklewoodelectronics.com 020 8452 0161 24 Visit our shop at: 40-42 Cricklewood Broadway London NW2 3ET Solutions for: PIC . dsPIC . ARM . MSP430 . Atmel . Generic JTAG . Altera Xilinx . BDM . C2000 . SPY-BI-WIRE . SPI / IIC . Altium Mini-HDMI . & More www.PlugOfNails.com Tag-Connector footprints as small as 0.02 sq. inch (0.13 sq cm) Practical Electronics | May | 2024