Silicon Chip0.01Hz - 6+GHz touchscreen frequency meter, Part 1 - October 2017 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Let’s be realistic about an Australian space industry
  4. Mailbag
  5. Feature: WRESAT: Australia’s first satellite – 50 years ago! by Dr David Maddison
  6. Feature: Three of our miniature satellites have gone missing... by Ross Tester
  7. Project: 0.01Hz - 6+GHz touchscreen frequency meter, Part 1 by Nicholas Vinen
  8. Feature: El Cheapo Modules Part 10: GPS receivers by Jim Rowe
  9. Project: One hour project: Kelvin – the very clever cricket by John Clarke
  10. Serviceman's Log: Old-fashioned appliance repairs are still worthwhile by Dave Thompson
  11. Project: 3-way Active Crossover for speakers, Part 2 by John Clarke
  12. Project: Deluxe eFuse, Part 3: using it! by Nicholas Vinen
  13. Feature: Adjust your hot-water thermostat and save $$$$ by Leo Simpson
  14. Subscriptions
  15. Vintage Radio: HMV 1955 Portable Model 12-11 by Associate Professor Graham Parslow
  16. PartShop
  17. Market Centre
  18. Notes & Errata: Automatic NBN/ADSL Router Rebooter / Power Supply for Battery-Operated Valve Radios / Vintage Radio (DKE38)
  19. Advertising Index
  20. Outer Back Cover: Microchip Low-power LCD

This is only a preview of the October 2017 issue of Silicon Chip.

You can view 34 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 "0.01Hz - 6+GHz touchscreen frequency meter, Part 1":
  • 6GHz+ Touchscreen Frequency Counter PCB [04110171] (AUD $10.00)
  • Short Form Kit for the Micromite Plus Explore 100 (Component, AUD $75.00)
  • Case pieces for the 6GHz+ Frequency Counter (PCB, AUD $15.00)
  • Software for the 6GHz+ Touchscreen Frequency Counter (v1.01) (Free)
Articles in this series:
  • 0.01Hz - 6+GHz touchscreen frequency meter, Part 1 (October 2017)
  • Touch-screen 6GHz+ Frequency Counter, part II (November 2017)
  • Part 3: Finishing our new 6GHz+ Digital Frequency Meter (December 2017)
Items relevant to "El Cheapo Modules Part 10: GPS receivers":
  • VK2828U7G5LF TTL GPS/GLONASS/GALILEO module with antenna and cable (Component, AUD $25.00)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 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 4 (February 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 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 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 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 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: 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, Part 2 (June 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: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
Items relevant to "One hour project: Kelvin – the very clever cricket":
  • Kelvin the Cricket PCB [08109171] (AUD $7.50)
  • PIC12F675-I/P programmed for Kelvin the Cricket [0810917B.HEX] (Programmed Microcontroller, AUD $10.00)
  • Firmware (HEX and ASM) file for Kelvin, the Very Clever Cricket [0810917B.HEX] (Software, Free)
  • Kelvin the Clever Cricket PCB pattern (PDF download) [08109171] (Free)
Items relevant to "3-way Active Crossover for speakers, Part 2":
  • 3-Way Adjustable Stereo Active Crossover PCB [01108171 RevD] (AUD $12.50)
  • 3-Way Adjustable Stereo Active Crossover prototype PCB [01108171 RevC] (AUD $5.00)
  • 3-Way Adjustable Stereo Active Crossover PCB [01108171 RevE] (AUD $20.00)
  • Set of four 8-gang potentiometers with knobs for the 2/3-Way Active Crossover (Component, AUD $55.00)
  • SMD parts for the 3-way Adjustable Active Stereo Crossover (Component, AUD $30.00)
  • 3-Way Adjustable Stereo Active Crossover simulation file (Software, Free)
  • 3-Way Adjustable Stereo Active Crossover PCB pattern (PDF download) [01108171] (Free)
  • 3-Way Adjustable Stereo Active Crossover front & rear panel artwork (PDF download) (Free)
Articles in this series:
  • Fully adjustable, 3-way active loudspeaker crossover Pt.1 (September 2017)
  • 3-way Active Crossover for speakers, Part 2 (October 2017)
Items relevant to "Deluxe eFuse, Part 3: using it!":
  • Deluxe Touchscreen eFuse PCB [18106171] (AUD $12.50)
  • PIC32MX170F256B-50I/SP programmed for the Deluxe Touchscreen eFuse [1810617A.HEX] (Programmed Microcontroller, AUD $15.00)
  • 2.8-inch TFT Touchscreen LCD module with SD card socket (Component, AUD $25.00)
  • IPP80P03P4L-07 high-current P-channel Mosfet (Component, AUD $2.50)
  • LT1490ACN8 dual "Over-the-Top" rail-to-rail op amp (Component, AUD $10.00)
  • IPP80N06S4L-07 high-current N-channel Mosfet (TO-220) (Component, AUD $2.00)
  • Matte Black UB1 Lid for the Deluxe Touchscreen eFuse (PCB, AUD $7.50)
  • Software for the Deluxe Touchscreen eFuse (Free)
  • Deluxe Touchscreen eFuse PCB pattern (PDF download) [18106171] (Free)
Articles in this series:
  • Deluxe Touchscreen eFuse, Part 1 (July 2017)
  • Deluxe Touchscreen eFuse, Part 2 (August 2017)
  • Deluxe eFuse, Part 3: using it! (October 2017)

Purchase a printed copy of this issue for $10.00.

World-first build-it-yourself design with 5-inch screen! 6GHz + by Nicholas Vinen TOUCHSCREEN FREQUENCY & PERIOD COUNTER We are POSITIVE you won’t find a better 6GHz+ frequency counter design . . . The “naked” counter (ie, not yet fitted into its laser-cut Acrylic case) is shown here larger-than-life-size for clarity – the actual display size is 120mm wide x 77mm high. 26 Silicon Chip ANYWHERE IN THE WORLD or at ANYTHING LIKE THE VALUE! Celebrating 30 Years siliconchip.com.au Check out the features and specifications below and tell us if we’re wrong! We haven’t seen the equal of this all-new 6GHz (actually 6GHz+) design anywhere – built up or build-it-yourself. It’s based on the famous Micromite Plus Explore 100 module to give you a superbly easy-to-read display along with TOUCHSCREEN CONTROL – and even has an optional GPS module to give you even more amazing accuracy! This is one design that we are obviously very proud of – just as you will be when you build it! T his new design completely supersedes the 2.5GHz, 12-digit Frequency Counter we described in the December 2012 and January 2013 issues (www. siliconchip.com.au/Series/21). That was a great performer for its time and has been very popular, with many built. But this new counter is not just better – it’s dramatically better! It has greatly improved performance – for a start, it has more than twice the maximum frequency of the earlier design and a much lower minimum frequency. And instead of a row of LED displays, we also made the jump to using a large, touchscreen LCD. It not only shows the frequency/period display but all the user controls are now ON SCREEN – no more searching for the right pushbuttons! The touchscreen functions are provided by a Micromite Plus Explore 100 module, designed by Geoff Graham and Graeme Rixon and described in the September and October 2016 issues (www.siliconchip.com.au/Series/304). Parts were getting hard to find, too We realised the time to update the old design had come, not just because some of the parts used are becoming difficult to source – and it’s a bit of a monster, needing a large instrument case and spread across two large PCBs including 26 ICs. The December 2012 Frequency Counter had selectable gating periods of one, 10, 100 or 1000 seconds. These correspond to its update rate with the longer periods giving greater resolution. It was a bit tedious waiting for 1000 seconds (about 17 minutes) to get a reading but that’s necessary if you want 1Hz resolution at frequencies over 1GHz. This new design can provide similar resolution at around 10 digits, however, because more of the actual frequency counting is done in software (on the more powerful PIC32 processor), it will give much faster display updates. Incidentally, we didn’t think there was much point going to 12 digits because you would need a time source accurate to within one part per trillion to have any confidence in the result and even with GPS disciplining, that’s unrealistic. This new design can also handle much lower frequencies/longer periods than its predecessor, down to around 0.01Hz (10mHz) compared to 10Hz. It’s also more sensitive, able to operate with signals down to just millivolts, over much of its frequency range. The display will show the applied frequency almost immediately, with an indication of the reading precision, and the reading will then be progressively refined, reflected in a slowly improving precision figures over a few minutes. So you don’t need to wait for 17 minutes to get a reading; you just need to wait until the indicated precision is good enough for your situation and then make a note of the reading. If you don’t need extreme precision, you can choose a faster update rate, with the reading changing several times per second. High precision is great but you also need good accuracy in this sort of instrument; briefly, precision indicates the repeatability of a measurement while accuracy indicates how closely it relates to reality. Temperature-compensated crystal oscillator plus GPS option! We’re using a temperature-compensated crystal oscillator (TCXO) frequency reference to provide good accuracy Outstanding Features and Specifications . . . Display: 800 x 480 pixel, 24-bit colour LCD with adjustable backlight brightness Frequency ranges: 10mHz-50MHz (low frequency input), 6MHz-6GHz+ (high frequency input); typically counts up to 7GHz Sensitivity: typically <10mV RMS below 3.5GHz and <125mV RMS, 3.5-7GHz Resolution: normally seven digits, increasing to 10 after 10 minutes with long-term averaging enabled Accuracy: ±2.5ppm initial tolerance (±0.00025% or ~5.5 digits) +1ppm/year; better with GPS unit after automatic calibration Input impedance: selectable, 75Ω Ω or 1MΩ Ω (low-frequency input), fixed, 50Ω Ω (high-frequency input) Update rate: selectable, 1-5Hz Modes: frequency or period with either constant updates or long-term averaging TTL reference output: selectable, 1Hz/1kHz reference frequencies or measured frequency divided by 1000 Power: 6V DC 1A plugpack OR can operate from 5V DC (eg USB) supply or computer output for use in field siliconchip.com.au Celebrating 30 Years October 2017  27 Fig.1: block diagram of the Micromitebased Touchscreen Frequency Meter (power supply not shown). The signal at the low-frequency input is buffered and then squared up by a high-speed comparator before being fed to the Explore 100 module. The signal at the high-frequency input is divided down by a factor of between 10 and 1280 before also being squared up and fed to the Explore 100. The TCXO and GPS reference signals can be used to gate either signal and provide an accurate frequency measurement.    “out-of-the-box”, with the option of GPS-disciplining to give even better long-term results. Overall operating concept This new frequency counter features the 6GHz+ Prescaler that we published in the May 2017 issue (www.siliconchip. com.au/Article/10632). This provides the high frequency input and it has a separate input to handle the lower frequencies. The Frequency Counter block diagram is shown in Fig.1 and gives the basic layout, showing how it is able to accurately measure the frequency of either of the inputs, shown at left. The low-frequency input can handle signals of 0.01Hz50MHz with a sensitivity of around 1mV RMS and a switchable load impedance of either 1MΩ or 75Ω, switched by the reed relay and transistor, as shown in Fig.1. The highfrequency input can handle signals of around 20MHz6GHz, with a sensitivity of a few millivolts and a load impedance of 50Ω. The low-frequency signal is buffered by high-speed op amp IC9 and then amplified and squared up by high-speed comparator IC6. The output of IC6 is then fed to the timer 1 clock input pin on the Explore 100 module. The PIC32 has five internal 16-bit timers, with timers 2/3 and 4/5 able to be paired up to form 32-bit timers. We’re using timer 1 in this case because it’s asynchronous (ie, operates independently from the PIC32’s own oscillator) and so can handle signals up to about 50MHz. The other times can only operate up to about 18MHz (according to the data sheet). Note that the Micromite also has an output pin which can enable or disable the output of IC6; this will become important later. 28 Silicon Chip The high-frequency input is fed to two wide-band monolithic microwave amplifier ICs (MMICs), IC1 and IC2, connected in series for extra gain. The amplified signal then passes to a high-frequency divide-by-five stage (IC3) and into a programmable divider with a division ratio of between 2 and 256 before also being squared up and fed to the timer 4/5 clock input pin of the Explore 100. The combination of the two dividers gives an overall division ratio of 10-1280, controlled by eight digital outputs from the Explore 100 module. Thus, the Explore 100 can set the division ratio fairly high for high-frequency signals, eg, 6GHz÷512, or 11.718MHz , while using a lower division ratio for lower frequency signals, to give better resolution and/or faster updates. As with IC6, the output of IC5 can be enabled or disabled by the Explore 100 via one of its digital outputs. So the Explore 100 can measure the pulses resulting from either input but it needs a precise measurement interval in order to accurately calculate and display the frequency. Its internal 100MHz clock runs off a PLL (phase-locked loop) which is driven by a 20MHz crystal and internal oscillator amplifier. But this won’t be exactly 20MHz and will change with temperature and over time. Reference frequencies To solve this, we are using a more accurate 16.368MHz TCXO (Temperature-Controlled Crystal Oscillator), IC7, as the frequency reference. Unfortunately, because the Explore 100 is a pre-built module, we can’t use this to drive the main clock, at least, not without butchering the board. Instead, we square up the output of this oscillator (it’s a sinewave) using IC8 and feed this to the clock input for Celebrating 30 Years siliconchip.com.au This “upside-down” photo shows how the frequency counter PCBs assemble one on top of the other. The I/O connectors are on the opposite side of the Explore 100 board than the touchscreen . . . . . . as shown in this photo of the completed unit, with the LCD display module mounted on stand-offs. Because of this arrangement, the input and output connectors are along the top of the module. timer 4/5. Not only does this give us an accurate time reference but we can use two of the PIC32’s “output compare” units (OC1 and OC2) to automatically gate the outputs of IC5 and IC6 for a precise number of pulses from IC8. For example, if we reset timers 1-3 and then set the output compare unit to drive the enable pin low (on) for 1,638,400 pulses of timer 4/5, we can measure exactly 100ms worth of pulses from both inputs. The TCXO is quite stable and precise, with an initial tolerance of ±2.0ppm and only ±0.5ppm variation from -10°C to +70°C and ±1.0ppm drift per year. This translates to an initial accuracy of around ±0.00025% and a long-term accuracy of around ±0.001%. Say you are measuring a signal of exactly 2.4GHz. That means you should get an initial measurement of between 2,399,994,000Hz and 2,400,006,000Hz. If you have a very precise reference frequency to calibrate the unit (essentially, allowing you to measure the actual frequency of the TCXO and then compensate for it), you could probably get it to within a few hertz. That’s pretty good but what if you don’t have a precise reference frequency and what about temperature variations and drift over time? Well, with the addition of a low-cost GPS module, the TCXO can be automatically calibrated (disciplined). Its 1PPS input is connected to the Input Capture 4 pin, which automatically stores a copy of the contents of the timer 2/3 counter each time it goes high. We can then extend this to a 64-bit value in software and keep, say, 3600 values, or one hour’s worth of GPS 1PPS timestamps. The individual intervals between GPS 1PPS pulses are not necessarily precise but averaged over the long term, they should give us a very good reference. So if we calculate the difference between the TCXO counter value one hour ago versus the most recent pulses and divide the result by 3600, that gives us the exact TCXO frequency, averaged over the last hour, to within one or two hertz. So the upshot is that if you fit the counter with a GPS module, provided it is getting enough signal from the satellites to get a good lock, you should get very accurate readings without needing to do any calibration. The software can save the calibration value into flash memory so that even if you only power up the counter for a short time (eg, to make a measurement), it can be reasonably accurate. You just need to leave it powered up for a while every now and then to let it adjust its own calibration. By connecting up the GPS unit’s serial console to commu- nication port 1 on the Explore 100, we can check whether it has a proper satellite lock before using the 1PPS signal and we can also display information on the LCD, such as the number of satellites in view, UTC time/date and the current location (latitude/longitude/altitude). siliconchip.com.au Frequency display But of course the job of the Frequency Counter is to display the frequency of the currently selected input and you can use the touchscreen to select the input you want to measure and the measurement period. The software then sets up the timers appropriately and continuously measures, computes and displays the result in large letters on the LCD. It can even format the result it into a nice, human readable value like “2.38754GHz” or “434.56MHz”. The Explore 100 can tell whether you have a GPS unit attached by monitoring the serial port. If you do, it will automatically perform long-term TCXO calibration and use the calibrated value when measuring the input frequencies. Otherwise, it will either use the default TCXO frequency (16.368MHz) as the reference, or a calibrated value, if you program one in. It can also show the frequency reading as a period value instead. That is most useful for lower frequencies. It’s just a matter of inverting the calculations. Circuit description Fig.2 shows the complete circuit, minus the Explore 100 itself, which plugs in via 40-pin DIL connector CON3. The Frequency Meter plugs into the top side of the Explore 100 PCB, with the input, output and power connectors accessible via the top edge while the 5-inch LCD touchscreen is mounted on the opposite side of the Explore 100. Most of this circuit corresponds to the block diagram of Fig.1, except for the power supply, which was not shown. Starting with the low-frequency (50MHz) input, this is fed in via BNC connector CON2. When set for a 75Ω input impedance, this is simply achieved by reed relay RLY1 connecting a 75Ω termination resistor across the socket. The signal is AC-coupled with a 10µF ceramic capacitor and biased to 2.5V using a 1MΩ resistor. Thus, with RLY1 de-energised, the input impedance is around 1MΩ although there is no DC path to ground. A dual series schottky diode, D12, clamps the signal so that it is between -0.2V and +5.2V. It is then fed to the pin 3 non-inverting input of buffer op amp IC9. This is a Linear Technology LTC6268HS8 which has a -3dB bandwidth of 350MHz when set for unity gain (as it Celebrating 30 Years October 2017  29 is here). So it will have negligible attenuation of signals below 50MHz. It has a very low input bias current of typically 3fA (yes, femtoamps – that’s 0.000000000000003A!) at room temperature, which is the primary reason why we’re using it here, as a buffer for IC6. Basically, the input bias current of comparator IC6 is so high that it would cause several volts to appear across the 1MΩ bias resistor if it was connected directly to IC6’s input. If we lowered the value of this 1MΩ resistor to solve the 30 Silicon Chip bias current issue, that would both load up the signal source and also increase the minimum frequency which could be measured. The easiest solution is to buffer the signal. As well as having a very low input bias current, IC9 also needs a low input offset voltage as this would reduce the sensitivity of the frequency meter by causing a mismatch between the quiescent voltage at pins 2 and 3 of IC6, which normally should both be sitting very close to 2.5V, thus only a small signal from CON2 is needed to cause the out- Celebrating 30 Years siliconchip.com.au Fig.2: complete circuit for the Frequency Meter, with the Explore 100 “black box” at right. The low-frequency (up to 50MHz) input signal path is shown at lower left while higher frequency signals are fed into the configurable prescaler shown at centre left. The linear power supply is at upper left and provides 5V, 3.4V and 2.5V rails and there is also a 1.4V (3.4V - 2V) rail for ECL logic termination. put of IC6 to toggle. IC9 also has a low noise of 4.3nV÷√Hz, which equates to about 80µV over the quoted 350MHz unity gain bandwidth. Too much noise could cause inaccurate frequency readings because it would be superimposed on the signal and so could cause extra “zero crossings”. Noise at this input of IC6 is rejected by providing a small amount of hysteresis, due to the 10MΩ resistor between the pin 7 non-inverted output and pin 2 non-inverted input, siliconchip.com.au combined with the 390Ω resistor from output pin 6 of IC9. Given that the output swing of IC6 is 5V, that gives a hysteresis of around 200µV (5V x 390Ω ÷ 10MΩ). As this is higher than the noise from IC9, it should result in a zero reading with no signal applied but will hardly affect the sensitivity. The reason for the 390Ω series resistor between IC9 and IC6 is to match the source impedance for the two inputs (pins 2 and 3) so that the bias current flowing into these Celebrating 30 Years October 2017  31 The underside of the Frequency Counter PCB (the top board in the photo at left). The only “components” on this board are the 2 x 20-pin female header which mates with the plug on the lower board and the 6-pin ICSP pass-through header. This gives a better view of the components on the Frequency Counter PCB. inputs will cause a similar shift across both resistors, so the error will mostly cancel out. The output from pin 7 of IC6 is fed to pin 22 of CON3 (input RC14 [pin 74] of the PIC32) via a 1kΩ resistor with a parallel 100pF capacitor. The 1kΩ resistor is there to limit current when the output of IC6 is high since it will go up to +5V while the PIC32 only has a 3.3V supply rail. The 100pF capacitor ensures that high-frequency signals will not be significantly attenuated by the input capacitance of the PIC32 pin. High-frequency signal path Higher frequency signals are fed into CON1, an SMA socket. As noted above, most of the following circuitry is based on that of the 6GHz+ Prescaler from the May 2017 issue. Its circuit diagram was shown on pages 32 and 33 of that issue. The signal is clamped to around 1V peak-to-peak by schottky diodes D1 and D2 and then AC-coupled to the input of MMIC IC1, which provides about 11-16dB gain, depending on frequency. Its input and output impedances are both matched to 50Ω. Power supply for IC1 is fed into its pin 3 output via RF choke L1, with a snubber/Zobel network from pin 3 to ground to improve its stability and provide better sensitivity between about 4-4.5GHz. The output signal is then fed to another, identical amplification stage based on IC2/L2, giving a total gain of around 22-32dB. The amplified signal is then AC-coupled again, via a 10nF capacitor, to the inverting input pin 3 of IC3, a 6GHz divide-by-five counter which uses high electron mobility transistor (HEMT) technology. Its non-inverting input is tied to ground with another 10nF capacitor as we are using it with a non-differential signal. The differential output signal, at one-fifth of the input frequency, appear at output pins 6 & 7 and these signals are then AC-coupled to the differential inputs of IC4 using 100nF capacitors. IC4 is an ECL 1.2GHz programmable counter. Its inputs are terminated to a supply rail 2V below its VCC pin via 51Ω resistors, as suggested in the data sheet. Setting the division ratios IC4 contains an internal 8-bit counter. Every time it exceeds 255 (11111111 in binary) to zero, the counter value is reset to the value provided externally on the P0-P7 in32 Silicon Chip puts. If this pre-load value is, say, 254 then the counter will roll over on every second input pulse (254, 255, 254, 255, …) and thus it essentially acts as a divide-by-two device. Or you could pre-load 252 and it would act as a divideby-four, and so on. Each of the P0-P7 inputs has an internal pull-down resistor so the PIC32 microcontroller determines the division ratio by pulling up those inputs which need to be set to one (high). This is done in each case via a BAV99 dual series diode, which drops the 3.3V high level from the PIC32 outputs to around 2.3V, a suitable high level for an ECL device. The MC100EP016A data sheet says that with a 3.3V supply, a high level is defined as between 2.075V and 2.42V. This arrangement may seem a bit crude but it works well. IC4 has three outputs, COUT (pin 10), COUT (pin 11) and TC (pin 12). All three are terminated to the VCC-2V (1.4V) rail via 51Ω resistors. We found the TC output gave the cleanest waveform so we’re feeding this to high-speed comparator IC5. It compares it to the reference voltage from pin 24 (VBB), which is halfway between the ECL high and low thresholds. The result is a 5V square wave at output pin 7 which can then be fed to the PIC32, again with a 1kΩ series current-limiting resistor paralleled with a 100pF capacitor. Reference oscillator The temperature-compensated crystal oscillator (TXCO) IC7, runs from a dedicated 2.5V rail since this is what it requires and providing it with a regulated rail will minimise any frequency shift due to supply variation. It has a 10nF bypass capacitor and its sinewave output at pin 3 (around 0.8V peak-to-peak) is AC-coupled to the non-inverting input pin 2 of comparator IC8, via another 10nF capacitor. This signal is DC-biased to 2.5V via a 2.2kΩ resistor and the same 2.5V bias is applied to inverting pin 3 so that the square wave from pin 7 will have a duty cycle close to 50%. The clock signal is then fed to the T2CK/RD2 pin of the PIC32 in the Explore 100, via another paralleled 1kΩ resistor and 100pF capacitor pair. The enable pin (pin 5) of IC8 is driven from the RB0 output but in practice, it’s enabled pretty much all the time. Power supply Power normally comes from a 6V DC regulated plugpack Celebrating 30 Years siliconchip.com.au and the current drain is normally close to 1A. This is regulated to 5V by 1A low-dropout regulator, REG2, which has a 1µF input bypass capacitor and 100µF output filter capacitor for stability. We’re using an LDO (low dropout) regulator to reduce dissipation, since it means we can have a 6V DC regulated input and still draw at least 1A without it dropping out. It does need a small heatsink though, as it will dissipate 1W continuously, and more if the incoming supply is much above 6V. Its output passes through ferrite bead FB1, so that any high-frequency noise produced by the circuit does not get radiated out of the plugpack leads. The 5V rail powers the Explore 100 module including the LCD touchscreen backlight, as well as high-frequency divider IC3, op amp IC9 and the reed relay, RLY1. It can also be used to power the GPS module, if required. This 5V rail is also fed to LDO adjustable regulators REG1 and REG3. These identical devices have different programming resistors so that they produce 3.4V DC and 2.5V DC regulated rails. The 2.5V rail is for the TCXO (IC7) and is also used in a few places as a 5V half-supply reference for DC biasing the inputs of high-speed comparators IC6 & IC8. The 3.4V rail powers amplifiers IC1 and IC2, ECL divider IC4 and can also be used to power the optional GPS module. As explained earlier, REF1 derives the 1.4V rail (3.4V–2V) which is used to terminate IC4’s clock inputs and its outputs. Finally, output connector CON7 can provide a 3.3V square wave output which is fed from the RB3/OC4 pin of the PIC32 on the Explore 100 module. This can be driven by its Output Compare module, producing a PWM waveform derived from one of the timers. As such, it can be set to produce a frequency which is a fraction of one of the input frequencies, for use as a trigger or reference frequency. Or it can provide a fixed reference frequency derived from the TCXO or a 1PPS or 1kHz reference derived from the GPS module. This is selected using the touchscreen. Software basics We won’t go into a lot of detail here but it’s helpful to understand how the software is able to perform frequency measurements using the circuit presented. In essence, we have eliminated all the house-keeping logic circuitry used the previous 12-digit frequency counter and these functions are now performed by the software. As stated, the squared-up signal from the low-frequency input is applied to the clock input for asynchronous timer 1 (T1CK), while the 16.368MHz reference oscillator signal is applied to the timer 2/3 clock input (T2CK) and the frequency-divided signal from the high-frequency input goes to the timer 4/5 clock input (T4CK). Since timer 1 is a 16-bit timer, with the maximum specified input frequency of 50MHz, it could roll over every 1.3ms (216÷50MHz, or 65536÷50,000,000). That isn’t too fast, and fortunately the Micromite BASIC firmware exposes the timer 1 interrupt to CFUNCTIONS. So we can set up an interrupt handler for this roll-over in C and use that to increment another 16-bit register, to form a 32-bit timer. It handles a maximum of 763 interrupts per second. We also need to set up timer pairs 2/3 and 4/5 in a CFUNCTION. The fact that we’re using all five timers in this manners means that we can’t use any of MMBasic’s siliconchip.com.au Parts list – 6GHz+ Touchscreen Frequency Counter 1 Micromite Explore 100 module or kit (SILICON CHIP online shop Cat SC3834) 1 6V DC 1A+ regulated plugpack 1 double-sided PCB, coded 04110171, 134 x 51.5mm 1 set of laser-cut acrylic case pieces (SILICON CHIP online shop Cat SC4444) 2 ADCH-80A+ RF inductors (L1,L2) 2 47µH 1A 6x6mm SMD inductors (L3,L4) 1 5V DIL reed relay (RLY1; Jaycar SY4030) 1 low-resistance SMD ferrite bead, 3216/1206 (FB1) 1 6031-type flag heatsink (for REG2) 1 M3 x 8mm machine screw and nut (for REG2) 1 PCB-mount right-angle SMA connector, 6GHz+ (CON1) 2 PCB-mount right-angle BNC connectors (CON2,CON7) 1 20x2 female header, 2.54mm pitch (CON3) 1 PCB-mount DC barrel socket, pin diameter to suit plugpack (CON5, recommended) OR 1 micro USB SMD socket with locating pins (CON4) 1 6-pin female header with long pins, 2.54mm pitch (CON6, for ICSP pass-through) 1 6-pin polarised header and matching plug, 2.54mm pitch (CON8) 1 3-pin header, 2.54mm pitch, with shorting block (LK1) 1 GPS module (eg, VK2828U7G5LF) (optional but recommended) 2 25mm long M3 tapped spacers 2 12mm long M3 tapped spacers 2 M3 x 32mm machine screws 6 M3 x 10mm machine screws 4 M3 x 6mm machine screws 8 M3 Nylon hex nuts 4 3mm ID, 6mm OD, 1mm thick Nylon washers Semiconductors 2 ERA-2SM+ SMD MMICs (IC1,IC2) 1 HMC438MS8GE, MSOP-8-PP (IC3) 1 MC100EP016A programmable ECL counter, TQFP-32 (IC4) 3 TL3016I high speed comparators, SOIC-8 (IC5,IC6,IC8) 1 NT2016SA-16.36800 SMD TCXO (IC7) 1 LTC6268HS8 500MHz op amp, SOIC-8 (IC9) 1 AZ431LAN voltage reference, SOT-23 (REF1) 2 TPS73701 adjustable LDO regulators, SOT-23-5 (REG1,REG3) 1 LM2940-CT5 LDO 5V regulator, TO-220 (REG2) 1 BC846 NPN transistor, SOT-23 (Q1) 2 1PS70SB82 UHF diodes, SOT-323 (D1,D2) 1 SSA34 3A schottky diode in DO-214AC/SMA package (or equivalent), (D3) 9 BAV99 dual series diodes, SOT-23 (D4-D11,D13) 1 BAT54S dual series schottky diode, SOT-23 (D12) Capacitors (all SMD 3216/1206 6.3V X5R/X7R) 1 100µF 16V through-hole electrolytic 4 10µF 9 1µF 3 100nF 9 10nF 0805 5 100pF C0G/NP0 0805 Resistors (all SMD 2012/0805 1% unless noted) 1 10MΩ 1 1MΩ 1 100kΩ 1 10kΩ 1 2.2kΩ 1 1.8kΩ 2 1.1kΩ 7 1kΩ 3 390Ω 1 300Ω 1 150Ω 5 51Ω 2 33Ω 1 75Ω 1W 6432/2512 1% Celebrating 30 Years October 2017  33 Here’s what the new counter will look like next month, when we put it into its purposedesigned laser-cut Acrylic case. A front cut-out gives access to the 5” touchscreen display. It’s not just a sensational performer, it looks sensational too! The case will be available from the SILICON CHIP Online Store – you’ll find all the details in Part II in your November SILICON CHIP. timing functions (DELAY, TICK, etc) as they will no longer work properly, but we can provide our own timing functions written in C. While we’ve found the synchronous timers (ie, timers 2-5) will operate OK for signals up to about 24MHz, the PIC32’s specifications indicate a minimum period of 55ns which equates to 18.18MHz. The signal driving timer 4/5, from the programmable divider, can be kept under this frequency limit by briefly measuring the input frequency using the maximum divider value of 1280, which gives a maximum frequency of under 5MHz with a 6GHz input, then computing the lowest possible divider value for that frequency to give the best resolution without exceeding the timer’s limit. For example, if the input frequency is 2.4GHz, the unit will measure 1.875MHz (2.4GHz÷1280) and it can then set the division ratio as low as 132, which gives 18.18MHz (2.4GHz÷132), just on the device’s limit. In practice, a slightly higher division ratio would be used to account for measurement errors and so on. Now, if the unit is set to measure the frequency at the 0.01Hz-50MHz input, pin 11 (RD1) will initially be set high, disabling the output pulses from IC6, while timer 1 is zeroed. RD1 will then be configured as OC2, controlled by the second Output Control unit. This compares the value of timer 2/3 to a fixed value and drives OC2 low while the timer value is below the specified value. This allows us to set the “window” period during which timer 1 runs to a fixed period based on the frequency of the TCXO. So if we set the comparison value to 1,638,600 then timer 1 will be active for 100ms and we can determine its frequency with just some simple calculations. Similarly, when measuring the frequency from the input with the prescaler, we can gate the output using OC1 (RB14), which also has its output state determined by the value of timer 2/3. We do have to be careful with this one though, because we’re gating the output of the prescaler, not the input. That could lead to errors in the frequency measurement, so ideally, we should measure the time between OC1 going low and the first pulse from the prescaler, and also bring OC1 low manually once counting is finished and measure the time until the next pulse. These figures can then let us “fine tune” the measurement, to get a more accurate figure for the input frequency. The software uses the fact that RD1 (OC2) is connected to general purpose I/O pin RB15 while RB14 (OC1) is also 34 Silicon Chip connected to GPIO RB10. So we can set up pin change interrupts on RB14 and RB10, so that an interrupt routine is triggered when the OC1/OC2 outputs change state. GPS-based automatic calibration All the other tasks (updating the screen, switching the relay, etc) are handled in the BASIC code. That just leaves the unit’s use of the GPS 1PPS signal to provide more accurate measurements. We have the 1PPS output of the GPS unit connected to the RD3 I/O pin which is configured for the Input Capture function (IC4). This automatically stores the 32-bit value in timers 2 and 3 on the rising edge of each GPS unit output pulse. The software can periodically check the input capture interrupt flag and if set, it can then retrieve this “timestamp” value and store it in a large memory array. It’s then just a matter of “crunching” the numbers in this memory array, which gives the number of TCXO pulses at one-second intervals over a long period, to calculate the actual TCXO frequency and apply this correction to frequency measurements made using its timebase. By using longterm measurements, we eliminate GPS signal jitter errors. By the way, we mentioned earlier that we have to do our own timing in the code and we have a couple of options for doing this. The Micromite code doesn’t give us access to an interrupt for timer 2, unfortunately, so we can’t generate a periodic interrupt based on its value. But we certainly can “busy wait” (or poll) based on its value to delay the code for an approximate time period. We can also set up either timer 1 (when using timers 4/5 for measurement) or timers 4/5 (when using timer 1 for measurement) to run off the system clock and then delay based on these values. But in practice, our code can afford to block the main loop when it needs a delay so simply polling the contents of timers 2 and 3 is good enough. Next month That’s enough to absorb for one month! Next month, we will go through the PCB assembly process, putting it together with the Explore 100 and getting the software up and running. We’ll also go over testing and calibration procedures and describe fitting it into a custom-made acrylic case. And last but not least, we’ll tell you where we obtained the more esoteric components used in the counter. SC Celebrating 30 Years siliconchip.com.au