Silicon ChipCompact 8-Digit Auto-Ranging Frequency Meter - August 2016 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Digital technology is blanketing us with RF hash
  4. Feature: Personal Flight Vehicles by Dr David Maddison
  5. Project: Touchscreen-Controlled Energy Meter, Pt.1 by Jim Rowe & Nicholas Vinen
  6. Project: Compact 8-Digit Auto-Ranging Frequency Meter by John Clarke
  7. Serviceman's Log: The ISP help desk from hell by Dave Thompson
  8. Project: Micromite Plus & The Explore 64 Module by Geoff Graham
  9. PartShop
  10. Project: Add A 7-Inch Touchscreen To Your Raspberry Pi by Greg Swain
  11. Review: Tecsun’s S-2000 Multiband Radio by Ross Tester
  12. Product Showcase
  13. Vintage Radio: Astor Aladdin FG Dual-Band Receiver by Ian Batty
  14. Market Centre
  15. Notes & Errata: Wireless Rain Alarm / Combined Timer, Counter & Frequency Meter
  16. Advertising Index

This is only a preview of the August 2016 issue of Silicon Chip.

You can view 42 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 "Touchscreen-Controlled Energy Meter, Pt.1":
  • Touchscreen Appliance Energy Meter PCB [04116061 RevI] (AUD $15.00)
  • PIC32MX170F256B-50I/SP programmed for the Micromite-based Touchscreen Energy Meter v1.01 [0411606A.hex] (Programmed Microcontroller, AUD $15.00)
  • CP2102-based USB/TTL serial converter with microUSB socket and 6-pin right-angle header (Component, AUD $5.00)
  • CP2102-based USB/TTL serial converter with microUSB socket and 6-pin right-angle header (clone version) (Component, AUD $3.00)
  • DS3231-based Real Time Clock & Calendar module with mounting hardware (Component, AUD $6.00)
  • ACS718 20A isolated current monitor (Component, AUD $15.00)
  • Firmware (HEX) file and BASIC source code for the Micromite-based Touchscreen Appliance Energy Meter [v1.01] (Software, Free)
  • Touchscreen Appliance Energy Meter PCB pettern (PDF download) [04116061 RevG] (PCB Pattern, Free)
  • Touchscreen Appliance Energy Meter lid panel artwork (PDF download) (Free)
Articles in this series:
  • Touchscreen-Controlled Energy Meter, Pt.1 (August 2016)
  • Touchscreen-Controlled Energy Meter, Pt.1 (August 2016)
  • Touchscreen Appliance Energy Meter, Pt.2 (September 2016)
  • Touchscreen Appliance Energy Meter, Pt.2 (September 2016)
  • Touchscreen Appliance Energy Meter, Pt.3 (October 2016)
  • Touchscreen Appliance Energy Meter, Pt.3 (October 2016)
Items relevant to "Compact 8-Digit Auto-Ranging Frequency Meter":
  • Compact 8-Digit Frequency Meter PCB [04105161] (AUD $10.00)
  • PIC16F88-I/P programmed for the Compact 8-Digit Frequency Meter [0410516B.HEX] (Programmed Microcontroller, AUD $15.00)
  • Matte Black UB3 Lid for Compact 8-digit Frequency Meter (PCB, AUD $5.00)
  • Firmware (ASM and HEX) files for the Compact 8-Digit Frequency Meter [0410516B.HEX] (Software, Free)
  • Compact 8-Digit Frequency Meter PCB pattern (PDF download) [04105161] (Free)
  • Compact 8-Digit Frequency Meter lid panel artwork (PDF download) (Free)
Items relevant to "Micromite Plus & The Explore 64 Module":
  • Micromite Plus Explore 64 PCB [07108161] (AUD $5.00)
  • PIC32MX470F512H-120/PT programmed for the Micromite Plus (Programmed Microcontroller, AUD $20.00)
  • Micromite Plus Explore 64 kit (Component, AUD $37.50)
  • Firmware (HEX) file and documents for the Micromite Mk.2 and Micromite Plus (Software, Free)
  • Micromite Plus Explore 64 PCB pattern (PDF download) [07108161] (Free)
Articles in this series:
  • Micromite Plus & The Explore 64 Module (August 2016)
  • Micromite Plus & The Explore 64 Module (August 2016)

Purchase a printed copy of this issue for $10.00.

• Auto-ranging • Typically measures to 55MHz+ • Provision for external 1000:1 prescaler Compact 8-Digit Frequency Meter Fully auto-ranging, this compact 8-digit frequency meter is ideal for hobbyists and technicians, for general servicing and for laboratory use. It will even cover the 6-metre amateur band. Accurate calibration can be done without any specialised equipment. F requency meters are used in virtually all areas of (to provide increased sensitivity). In other respects, this Mk3 version is quite similar to electronics and are invaluable for testing, servicing and diagnostics. Among other tasks, they are ideal the previous design in that it is auto-ranging and displays for checking the frequency of oscillators, counters, trans- the frequency in Hz, kHz or MHz with 8-digit resolution on a 2-line 16-character Liquid Crystal Display (LCD). It mitters and signal generators. It is true that frequency measurements are available on automatically selects the correct range and decimal place many multimeters these days. However, they do not have for any frequency reading. There is provision for use with an external prescaler. If high sensitivity nor the necessary number of digits for decent resolution at frequencies above 1kHz and most do not you want to measure frequencies above 55MHz you will need an external prescaler that divides the input frequency measure in the MHz region. This new design is an upgrade over previous versions so that it is less than 50MHz. We described a UHF 1000:1 Prescaler in the October that used the old ECL (Emitter Coupled Logic) MC10116 2006 issue. See www.siliconchip.com. differential amplifier in the front end. au/Issue/2006/October/UHF+Prescaler Instead, we are using three 600MHz By JOHN CLARKE +For+Frequency+Counters high speed op amps to do the same job 38  Silicon Chip siliconchip.com.au Features When set to use to such a 1000:1 prescaler, the LCD shows GHz instead of MHz, MHz instead of kHz and • Compact size (130 x 67 x 44mm) kHz instead of Hz. • 8-digit reading (LCD) However, this prescaler will not let you read fre• Automatic Hz, kHz or MHz units quencies to 55GHz+ since it has its own limitation of • kHz, MHz and GHz units for 1000:1 external prescaler about 2.8GHz. • Three resolution modes including 10kHz rounding up We have included a useful feature for radio control • 1MΩ input impedance modellers, allowing the Frequency Meter to display • 0.1Hz resolution up to 100Hz the reading in multiples of 10kHz steps for frequen• 1Hz resolution up to 16.777216MHz cies above 36MHz, ie, the resolution is set to 10kHz. • 10H z resolution above 16.777216MHz When a standard frequency meter is used to meas• Display back-light with dimming ure crystal-locked PPM (pulse position modulation) radio control transmitters, the modulation will result • DC plugpack or USB supply in incorrect readings. Setting the resolution to 10kHz • Calibration without requiring a prec ision frequency reference eliminates these errors. The design is easy to build with all parts mounted on one PCB, so there is no fiddly wiring. a high-resolution mode for greater precision when required There are just five ICs, one being the PIC microcontroller and the already-mentioned 10kHz rounding up feature. and four surface mount ICs that are quite straightforward In low resolution mode, the resolution is 1Hz for frequento solder to the PCB. Apart from the ICs, there’s an LCD cies from 1-999Hz and 10Hz for frequencies above this. The module, three transistors, a 3-terminal low-dropout regu- corresponding display update times are one second from lator and a few resistors and capacitors. 1-999Hz and 200ms from 1kHz-50MHz. High resolution mode provides 0.1Hz resolution for readFrequency limit ings up to 100Hz and 1Hz resolution for frequencies from Typical examples of this Frequency Meter should be OK 100Hz-16.77721MHz. Above this, the resolution reverts to for signals up to 55MHz or more. In fact, our prototype 10Hz. The display update time is one second but is somemeter is good for 60MHz but with falling sensitivity above what longer for frequencies below 10Hz. 50MHz. See the graph of Fig.1. 0.1Hz resolution makes the unit ideal for testing loudspeakers, where the resonant frequency needs to be accuCalibration rately measured. Calibration of this Frequency Meter does not require Accuracy is 20ppm (0.002%) without calibration but it specialised equipment. can be trimmed for even better precision. We have devised a calibration procedure that just reThe three resolution modes are selected by pressing the quires the accurate clock in a computer (synchronised via Resolution switch. When pressed, the meter displays “Low a network time server), mobile phone or any other clock or Resolution”, “High Resolution” or “Rounding <at>>36MHz” timepiece that has proven accuracy over time. The details to indicate which mode is currently selected. When the are in a panel at the end of this article. switch is released, the high or low resolution indication is not displayed. In the rounding mode, the 10kHz roundingResolution modes up only occurs above 36MHz. Below this, the standard 10Hz Three resolution modes are provided: low-resolution resolution frequency reading is displayed. Whenever the mode with fast updates (suitable for most measurements), display is showing frequency rounding, the second line of 8-DIGIT FREQUENCY METER – SENSITIVITY 60 50 40 Signal (mV) 30 20 10 0 1 10 100 1k 10k Frequency (Hz) 100k 1M 10M 100M Fig.1: here’s the performance of the prototype. While sensitivity is reduced above ~55MHz, we found it usable to 60MHz. siliconchip.com.au August 2016  39 Fig.2a: block diagram of the Frequency Meter for “normal” measurements. The incoming signal is first amplified, then fed through a gating circuit to clocking stage IC4a. This then drives a divide-by-256 prescaler inside PIC microcontroller IC5 (ie, at the RA4 input). Fig.2b: this is the alternative configuration for making high-resolution (ie, to 0.1Hz) measurements below 100Hz. In this case, the input signal is applied to the RA4 input as before. However, the prescaler is no longer clocked by the RA4 input but by an internal 1MHz clock. the display indicates this with “10kHz Rounding”. The selected resolution is stored in flash memory and is automatically restored if the frequency meter is switched off and on again. In low resolution mode, the display will show 0Hz if the frequency is below 1Hz. By contrast, in the high resolution mode, the display will initially show an “Await Signal” indication if there is no signal. If there is no signal for more than 16.6s, the display will then show “No Signal” The 0.1Hz resolution mode for frequencies below 100Hz operates in a different manner to those measurements made at 1Hz and 10Hz resolution. Obtaining 0.1Hz resolution in a conventional frequency meter normally means measuring the test frequency over a 10s period. And that means that the update time is slightly longer than 10s. This is too long time to wait if you are adjusting a signal generator to a precise frequency. In this frequency meter, the display update period is one second. So for normal audio frequencies, the display will update at one second intervals. We shall explain just how this is achieved shortly. Prescaler selection When selected, the words “Low R Prescaler” or “High R Prescaler” are shown while ever the Resolution button is held down and “Units for 1000:1” are shown on the second line of the LCD once the switch is released. 10kHz rounding is not available when using the prescaler feature. Front and rear views of the completed PCB, ready for testing and attaching to the front panel. 40  Silicon Chip siliconchip.com.au Block diagrams siliconchip.com.au New IDAS series Arriving late 2016 ICOM5009 Fig.2a shows the general circuit arrangement of the frequency meter. It’s based mainly on the microcontroller, IC5. In operation, the input signal is buffered and amplified by Q1 & IC1-IC3 and passed through gating and clocking gates (IC4) before being applied to input RA4 of IC5. The clocking gate (IC4a) allows pulses from RA2 to toggle input RA4, to inject extra pulses while the gating stage (IC4b) is switched off. The reason that this is necessary is explained below. Note that since IC4a & IC4b have Schmitttrigger inputs, they also serve to square up the waveform. The RA4 input of IC5 drives an internal divide-by-256 prescaler and its output then clocks timer TMR0 which counts up to 256 before clocking 8-bit Register A, that also counts up to 256 before returning to zero. Combining all three counters (the prescaler, TMR0 and register A) allows the circuit to count up to 24 bits, or a total of 16,777,216. By counting over a one second period, the counters can make readings up to 16.777216MHz. However, if the frequency is counted over a 100ms period, the maximum frequency count amounts to just over 167.77721MHz. This limit is somewhat restricted by the frequency limit of the internal prescaler of around 55-60MHz. The input signal from IC3 is fed to gating stage IC4b and drives clocking stage IC4a which is controlled by IC5’s RA2 output. Normally, IC4a and IC4b allow the signal to pass through to the prescaler at IC5’s RA4 input. Depending on how long IC5’s RB0 output is high, the signal will pass for either a 100ms period or a one second period. During the selected period, the signal frequency is counted using the prescaler, timer TMR0 and register A, as noted above. Initially, the prescaler, the timer and register A are all cleared to zero and the RB0 output is then set high, to allow the input signal to pass through to the prescaler for the gating period. During this period, the prescaler counts the incoming signal applied to RA4. Each time its count overflows from 255 to 0, it automatically clocks timer TMR0 by one count. Similarly, whenever the timer output overflows from 255 to 0, it sets a Timer Overflow Interrupt Flag (TOIF) which in turn clocks Register A. At the end of the gating period, IC5’s RB0 output is brought low, stopping any further signal from passing through to the prescaler. The value of the count in TMR0 is now transferred to Register B. The count in the prescaler cannot be directly read by IC5 and so we need to derive the value. This is done by first presetting register C with a count of 255 and the RA2 output is taken low to clock the prescaler. TMR0 is checked to see if its count has changed. If TMR0 hasn’t changed, the prescaler is clocked again with RA2. During this process, register C is decreased by one each time the prescaler is clocked. The process continues, with RA2 clocking the prescaler until timer TMR0 changes by one count. When this happens, it indicates that the prescaler has reached its maximum count. The value in Register C will now be the value that was in the prescaler at the end of the counting period. The processing section within IC5 then reads the values in registers A, B and C and this is the frequency reading of the incoming signal. Based on this information, it then decides where to place the decimal point and what units to display on the LCD. If the input signal frequency is greater than 16MHz and the The new generation IDAS series boasts a modern design and an impressive range of functions. These advancements and an exceptional attention to detail bring you a solution that not only looks smart but works smart too. Refinements and enhancements to design, usability and features combined with the electrical and industrial hardware improvements further increase the quality and reliability of the new IDAS series. To find out more about Icom’s products email sales<at>icom.net.au WWW.ICOM.NET.AU August 2016  41 +5V 10nF 10F 100nF 100nF 10F 100nF 100nF 100nF 22pF CON1 INPUT 470nF D 100k G 910k A D1 10nF 10nF S K Q1 2N5485 47F K 4,5 470 10k * CON2 – CON3 USB POWER SC 2016 + * – 4,5 10k * REG1 LM2940CT–5.0 7 3 OUT 1 FB 4,5 10k 220 OUT 6 OUT 1 FB 220 51 Vcc/2 +5V IN 8 IC3 2 51 V+ * 100F + 6 IC2 2 1 FB 47F 8 Vcc/2 D3 1N4004 S1 7 3 OUT 51 D1, D2: BAW62 DC IN 9V 47F 6 220 IC1, IC2 & IC3: ADA4899-1YRDZ POWER 8 IC1 2 D2 A 7 3 10nF +5V OFFSET ADJUST VR1 1k GND 100F * NOT REQUIRED FOR USB OPTION – SEE TEXT C CW B Q3 BC337 E 100F 220 TP1 470F LOW ESR 10nF TPGND 8–DIGIT FREQUENCY METER gating period is one second, register A will initially have overflowed. In this case, the gating period is automatically changed to 100ms and the frequency is re-read. Alternative configuration If the high resolution mode is selected and the frequency is below 100Hz, IC5 changes its configuration to that shown in Fig.2b. The input signal is applied to the RA4 input as before but the prescaler is no longer clocked by the RA4 input but by an internal 1MHz clock instead. RA2 and RB0 are both taken high to allow the signal to pass through to RA4. The RA4 input is now monitored for a change in state from low to high, indicating a signal at the input. When this happens, the prescaler, TMR0 and Register A are cleared and counting the 1MHz internal clock signal begins. The overflow outputs from the prescaler and timer TMR0 are carried to register A as before. Counting continues until the input signal goes low and then high again. That’s a full cycle of the incoming waveform. At this point counting stops. 42  Silicon Chip If the counting causes register A to overflow, then the display will show “No Signal” (this will happen after 16.7s if the signal does not go low and high again). Conversely, if the counting is within range, the prescaler value is determined by clocking IC4a using the RA2 output as before. The values in Register A, B and C are now used to calculate the frequency. So if the input frequency is 1Hz, it has a one-second period and so the value in the A, B and C registers will contain a value of 1,000,000. That’s because the prescaler is clocked at 1MHz over the one second period. Similarly, the count will be 100,000 for a 10Hz signal and 10,000 for a 100Hz input signal. Finally, the value in the registers is divided into 10,000,000 and the decimal point placed immediately before the last digit. This gives a readout in Hz with 0.1Hz resolution on the LCD. This technique cannot be used for measuring very high frequencies because the value in the counter becomes smaller as the frequency increases and so we begin to lose accuracy. For example, at 500Hz, the counted value would be 2000 and at 500.1Hz it would be 1999. The result of the division of 1999 into 10,000,000 would be 500.2 instead of the 500.1 required. The 0.1Hz resolution has therefore been restricted to readings below 100Hz to ensure 0.1Hz accuracy. Circuit details Now refer to Fig.3 for the full circuit details. The input signal is AC-coupled from CON1, the BNC connector, via a 470nF capacitor to block any DC com- The view of the assembled PCB mounted on the front panel, from the input socket/DC supply/power switch side. siliconchip.com.au +5V +5V 100nF MKT or ceramic 100nF 100F V+ *390 0.5W 10k 14 IC4: SN74LVC2G132 IC4b 5 6 Vdd IC4a 8 3 2 4 7 3 1 4 2 1 6 15 RA1 RA5/MCLR RA2 RB0 IC5 PIC16F88 PIC16F88 –I/P 13 RB6 16 VC1 10–60pF D7 D6 D5 D4 D3 D2 D1 D0 GND R/W 1 5 14 13 12 11 10 9 8 7 VR2 10k BLK 16 C 1k 9 B 8 RB2 RB1 33pF CONTRAST 10 RB4 OSC1 CW 11 RB3 X1 4MHz 3 EN 12 RB5 OSC2 BLA RS CONTRAST 6 RB7 RA3 4 17 RA0 RA4 18 2 Vdd *100 0.5W FOR USB SUPPLY 15 Q2 BC337 E 7 RESOLUTION SELECT BRIGHTNESS SELECT Vss S2 S3 2N5485 BC337 LM2940 S B 5 GND 1N4004 BAW62 K A K A G IN D E C GND OUT Fig.3: the input signal is fed to a JFET which provides a high input impedance (1MΩ) and then it is amplified by three cascaded wide-bandwidth op amps. The signal is then gated and “squared up” by the NAND Schmitt triggers. The PIC microprocessor then does all the counting and housekeeping and drives the LCD module. ponent. This signal is then clipped to about 0.6V peak-to-peak by diodes D1 & D2 and any shunt current is limited by the 100kΩ series resistor. The 22pF capacitor across the 100kΩ resistor compensates for the capacitive loading of the diodes. From there, the signal is fed to the gate of Q1, a 2N5485 JFET. This provides a high input impedance. Q1 is self-biased using a 910kΩ resistor from its gate to ground and its 470Ω source resistor. The output at its source is about 70% of the signal level at the gate (ie, the normal signal loss in a source follower configuration). The signal is then AC-coupled to pin 3 of amplifier stage IC1 via a 47µF electrolytic capacitor and a parallel 10nF capacitor. The 47µF capacitor is sufficiently large to allow for a low frequency response to less than one Hertz. However, this capacitor loses its effectiveness at higher frequencies due to its high internal inductance and the signal is coupled via the 10nF capacitor instead. High frequency amplifiers IC1, IC2 & IC3 are AD4899 high frequency op amps with a unity gain bandwidth (-3dB) of 600MHz. Each is connected as a non-inverting amplifier with a gain of 5.3, using 220Ω and 51Ω feedback resistors. The op amps have two outputs: one labelled FB (feedback) at pin 1 and the other at pin 6. Both provide the same connection inside the op amp package, with the FB pin included to allow an optimum PCB layout for the feedback resistor. And this view is from the opposite side – note the switch mounting method. siliconchip.com.au The three op amps are cascaded with AC-coupling via parallel 47µF and 10nF capacitors that terminate to a 10kΩ input load resistor. Each 10kΩ resistor and the 51Ω feedback resistor connect to a Vcc/2 supply that biases each of the op amp outputs to around half supply. Half supply rail This half supply is required for two reasons: firstly to have the op amp outputs operate within their specified output range and secondly, so that IC3’s output level will match the input voltage levels required for the following Schmitt trigger NAND gate, IC4b. An adjustment is provided with the half supply circuitry to set the output voltage level to match best with IC4b’s high and low trigger thresholds. The half supply is made up using trimpot VR1 and transistor Q3 which is connected as an emitter follower. The voltage at VR1’s wiper is used to bias transistor Q3 and the emitter is about 0.7V lower than its base, as set by VR1. Q3’s emitter is bypassed with a 470µF and 10nF capacitor to reduce the voltage ripple on the half supply, due to AC currents through August 2016  43 the low-value feedback resistors used with the op amps. Signal gating Gating and clocking of the signal from IC3 is performed by IC4 which is a dual 2-input Schmitt NAND gate package. IC4b inverts the signal applied to its pin 5 input whenever its pin 6 is held at +5V by IC5’s RB0 output. When RB0 is at 0V, IC4b’s pin 3 output remains high and the input signal is blocked. Essentially, the signal is allowed through to IC4a at pin 2 when RB0 is high and is blocked when RB0 is low. IC4a’s pin 1 input is normally held high by IC5’s RA2 output, so that the signal from IC4b is again inverted at pin 7. When RB0 is brought low, pin 3 of IC4b remains high and so pin 2 of IC4a is also high. RA2 can clock the RA4 input using IC4a, as when RA2 is taken high and low, this produces a low and high signal at RA4. Driving the LCD Microcontroller IC5’s RA0 and RA1 outputs drive the control inputs (Enable and Register select) of the LCD. The data lines of the LCD module (DB4, DB5, DB6 and DB7) are driven by the RB4, RB5, RB6 and RB7 outputs of IC5. VR2 is included to adjust the contrast of the display. Back-lighting Figs 4-5: at the top (Fig.4a) is the component overlay for a 9V supply version, while the 5V (USB) supply version is shown in Fig.4b – note the links replacing components. The underside of the PCB (Fig.5) is common to both versions. 44  Silicon Chip Back-lighting on the LCD module is provided by two LEDs in series that connect between pin 15 and 16 of the module, with an overall voltage drop of about 3.6V. A 390Ω resistor from the raw 9V supply connects to the backlighting LED anode and a transistor (Q2) switches the cathode side. This sets the current to about 20mA when Q2 is switched on. If the circuit is to be powered by a USB (5V) supply, this resistor should be reduced to 100Ω 0.5W, to achieve a similar back-lighting current. Transistor Q2 is driven via the PWM (pulse width modulation) output from pin 9 of IC5. This allows the brightness to be varied from full brightness to no backlight. Switch S2 is held down to set the brightness of the back-lighting. When the switch is not pressed, input RB1 is pulled high via internal pullup current in IC5. Similarly S3 is used to select the resolution and it too has an internal pullup. A 4MHz crystal connected between pins 15 & 16 of IC5 provides the clock siliconchip.com.au signals for the frequency metering. The recommended crystal has low drift but a standard 4MHz crystal could be used, if accuracy is not critical. The capacitors at pins 15 & 16 provide the necessary loading for the crystal, while variable capacitor VC1 allows the clock frequency to be adjusted slightly to provide calibration. Power supply Power for the circuit can be from a 9V DC plugpack or a 5V USB supply. Diode D3 protects the circuit against reverse polarity when using a plugpack supply, while the low-dropout LM2940CT-5.0 regulator REG1 provides a +5V supply rail to power the circuit. The 9V variant is shown in the component overlay diagram of Fig.4a. If you are using the USB supply option, REG1, D3, CON2 and one of the 100µF capacitors are not used. These are replaced by links, where appropriate, as shown in the component overlay of Fig.4b. Construction All components for the Frequency Meter (except the LCD module) are mounted on a double-sided PCB coded 04105161 and measuring 121 x 58.5mm. The PCB fits in standard plastic Jiffy box measuring 130 x 68 x 44mm. A precision pre-cut Acrylic front panel is available from the SILICON CHIP On-line Shop that includes the holes required for the front panel switches and LCD module. Alternatively, you could use the lid supplied with the Jiffy box and cut your own holes but this is at best a little messy! If you intend running this meter from a USB supply (either a 5V plugpack or a computer USB socket), a USB socket is installed underneath the PCB, as shown in our photos (instead of the 9V supply components, as mentioned above). However, if you intend purchasing the PCB from the SILICON CHIP on-line shop, note that after our initial stock of PCBs are sold, the replacement stock will come with pads for a micro/mini USB socket so that standard USB phone charging leads (you’ve probably got a few!) can be used to power the frequency meter. Surface-mount ICs Begin by installing the four surface mount ICs. You will need a pair of siliconchip.com.au PARTS LIST – 8-DIGIT FREQUENCY METER 1 double-sided PCB, code 04105161, 121 x 58.5mm 1 UB3 plastic case, 130 x 68 x 44mm 1 pre-drilled front panel 130 x 68mm 1 front panel label 130 x 68mm or screen printed panel 1 LCD module (Altronics Z 7013, Jaycar QP5512) 1 PCB-mount SPDT toggle switch (S1) (Altronics S 1421) 2 momentary contact pushbutton switches (S2,S3) (Altronics S 1099, Jaycar SP0723) 1 PCB mount BNC socket (CON1) (Altronics P 0527) 1 low-drift 20ppm 4MHz crystal HC49S (X1) (eg, element14 1666951) 1 18-pin DIL IC socket (for IC5) 1 16-pin DIL IC socket, cut into two 8-pin SIL IC sockets (for the LCD) 1 16-way SIL pin header (to connect to the LCD) 2 M3 tapped spacers x 9mm (LCD mounting) 4 M3 tapped spacers x 6.3mm (PCB to lid) 4 M3 tapped spacers x 12mm (PCB to lid) 2 M3 Nylon washers (LCD mounting) 4 M3 x 6mm screws (LCD mounting) 4 M3 x 12mm screws (PCB to lid) 4 M3 x 10mm countersunk screws (PCB to lid) 10 PC stakes (for S2,S3,TP1 and GND) 8 PC stake wiring sockets (Jaycar HP1260) 4 No.4 x 15mm self tapping screws (when using Acrylic front panel) Semiconductors 3 ADA4899-1YRDZ high speed op amps (IC1-IC3; element14 1274191) 1 SN74LVC2G132DCUT dual 2-input Schmitt NAND gates (IC4; element14 1236369) 1 PIC16F88-I/P microcontroller programmed with 0410516A.hex (IC5) 1 2N5485 N-channel VHF JFET (Q1) 2 BC337 NPN transistors (Q2,Q3) 2 BAW62 diodes (D1,D2) Capacitors 1 470µF 10V low ESR PC electrolytic 3 100µF 16V PC electrolytic 3 47µF 16V PC electrolytic 2 10µF 16V PC electrolytic 1 470nF MKT polyester 1 100nF ceramic or MKT polyester 6 100nF ceramic 5 10nF ceramic 1 33pF NP0 ceramic 1 22pF NP0 ceramic 1 10-60pF trimmer capacitor (VC1) Resistors (1%, 0.25W) 1 910kΩ 1 100kΩ 4 10kΩ 1 1kΩ 1 470Ω 4 220Ω 3 51Ω 1 1kΩ multi-turn top adjust trimpot (VR1) 1 10kΩ miniature horizontal mount trimpot (VR2) Power supply options 9V DC plugpack input 1 PC mount DC socket with 2.1 or 2.5mm connector pin (CON2) 1 M3 x 6mm screw and M3 nut for REG1 1 LM2940CT-5 low dropout regulator (REG1) 1 1N4004 1A diode (D3) 1 100µF 16V PC electrolytic capacitor 1 390Ω ½W 5% resistor USB supply 1 PCB-mount USB socket (Jaycar PS0916 or element14 2112367/ 2293752; see text) 1 100Ω ½W 5% resistor August 2016  45 This view of the completed prototype PCB, without the LCD module in place, shows not only how the module mounts but also the components which fit underneath it. Some of these need to be laid over to accommodate the LCD module, as explained in the text. tweezers, a fine tipped soldering iron, 0.71mm diameter solder, solder wick, flux paste plus a magnifier and bright light. Start with IC1, IC2 and IC3. Orient each IC with pin 1 positioned as shown on Fig.4. First, tack solder a corner pin to the PCB pad. Check that the IC is aligned correctly onto the PCB pads before soldering the remaining pins. Any solder bridges between the IC pins can be removed with solder wick. IC4 is a much smaller package but the process is the same. The IC is first tack-soldered at a corner pin and carefully aligned by remelting the solder, if required. Then solder the remaining corner pins. Pins 2 connects to pin 3 so these can be soldered as a pair but make sure there are no solder bridges between any other pins. The resistors can be installed next. Check their value against the resistor colour code table opposite (and preferably confirm with a digital multimeter) before you install each one. Next, fit the diodes. Make sure they have correct polarity with the striped end (cathode, k) oriented as shown in the overlay diagram. D1 and D2 are BAW62 diodes and D3 can be either a 1N4004 or 1N5819. We recommend using an IC socket for IC5. Take care with orientation when installing the socket and when inserting the IC. There are 10 PC stakes to install. These are for TP1, GND (optional) and four each for S1 and S2. The latter are so that the switches can be raised off the PCB using PCB pin sockets. Capacitors can be installed next. The electrolytic types must be fitted with the polarity shown, with the positive (longer) lead toward the right of the PCB. There are 10µF and 47µF capacitors in the region where the LCD module will sit – these two capacitors will need to tilt over so they are not any higher than 9mm above the PCB. The 100nF capacitor just to the right of S2 and the 470nF capacitor are both MKT The LCD module, shown here, has a 16-way header socket soldered to the underside, which mates with a 16-way header pin on the top of the PCB. 46  Silicon Chip polyester types. The remaining are ceramic – these and the polyester types are not polarised. VC1 is mounted on the underside to allow access for adjustment. Next, fit the 2N5485 JFET (Q1) and the two BC337 transistors (Q2 and Q3) – make sure you don’t mix them up because they look almost identical. REG1, if required (for a 9V supply) can now be installed. This mounts horizontally on the PCB with the leads bent at 90° to insert into the holes. The metal tab is secured to the PCB using an M3 x 6mm screw and M3 nut. Secure this tab before soldering the leads. Trimpots VR1 and VR2 are next. VR1 is a 1kΩ multi-turn vertical type and may be marked as 102. This is placed with the adjusting screw towards the middle of the PCB. VR2 is 10kΩ and may be marked as 103. Crystal X1 is mounted as shown. The recommended 3.5mm-high HC49S type will sit flush on the PCB but if you are using the standard 13.5mm crystal package (HC49U) instead, it will need to be placed horizontally on the PCB (ie, with the leads bent down 90°) so the LCD module will fit without fouling the crystal. The LCD module mounts on the PCB via an in-line 16-way header. The socket, which is soldered to the LCD, can be cut from a dual-in-line 16-pin (DIL16) socket to give two 8-pin socket strips, which are mounted end-to-end on the underside of the LCD module (see photos). Install the BNC socket, power switch S1 and CON2 or CON3 depending on the supply option you are using. Switches Switches S2 and S3 need to be mounted above the PCB so they just poke through the front panel. They are installed by firstly inserting the PC stake sockets fully onto the PC stakes. Then the switches are placed over these sockets and the switch pins soldered to the socket ends. The switches should sit with about 26mm from the top face of the switch to the top of the PCB. Final PCB preparation involves attaching M3 tapped standoffs to the top of the PCB to mount the LCD module and the front panel/lid. The LCD module mounts on two 9mm standoffs with a 1mm thick Nylon washer (or use 10mm standoffs). It is secured with M3 x 6mm screws. For siliconchip.com.au TWO METHODS FOR CALIBRATING THE FREQUENCY METER Strictly speaking, there is no need to calibrate this frequency meter if you use the specified 20ppm crystal. At 50MHz, the error should be within ±10kHz. So your reading could be anywhere between 49.99MHz and 50.01MHz. There will also be changes in the frequency reading with temperature. If you want better accuracy, then the Frequency Meter will need calibration. Two methods are available: one that requires a fixed frequency reference (the quickest method) or using an accurate clock. The first method involves applying an accurate frequency reference signal (typically 10MHz) to the unit and adjusting VC1 (via a hole drilled in the back of the case) to get the right frequency reading. Typical frequency references have a frequency output derived from a GPS timebase or a temperature-controlled crystal oscillator. If you want to build your own GPS-based frequency reference, we have a suitable design. See the March-May 2007 and September 2011 issues. Previews are available at: • www.siliconchip.com.au/Issue/2007/March/GPS-Based+Frequency+Reference%3B+Pt.1 • www.siliconchip.com.au/Issue/2007/April/GPS-Based+Frequency+Reference%3B+Pt.2 • www.siliconchip.com.au/Issue/2007/May/GPS-Based+Frequency+Reference%3A+Circuit+Modifications • www.siliconchip.com.au/Issue/2011/September/Improving+The+GPS-Based+Frequency+Reference Note that the reference reference frequency should be between 1MHz and 16.77MHz, allowing the meter to operate with 1Hz resolution for best precision. Software calibration Another method of adjustment is to use a calibration feature incorporated in the frequency meter software. This is accessed by holding the Brightness switch down as power is applied, then releasing the switch. The display will show frequency in Hz on the top line and a calibration value in parts per million (ppm) on the second line. The calibration value is initially 0ppm and can range between -50 and +50ppm. Use the Select switch to decrease the value and the Brightness switch to increase the value. Note that you may have to press and hold a switch for up to one second before the value changes. The switch must be released and repressed to increment or decrement the value again. The one second period wait is because the frequency reading section as shown on the top line takes one second to update. The frequency displayed is in Hz rather than the kHz and MHz units when the frequency meter is used normally. So 10MHz will be shown as 10,000,000Hz without the comma breaks. Adjust the ppm value so the frequency reading matches the reference frequency. Positive adjustments will have the effect of lowering the frequency reading and negative values will increase it. Once set, the ppm value is stored in flash memory and will be used every time the frequency meter is switched on. Normal frequency meter operation is restored by cycling power to the unit. Calibration with a clock This method also involves software calibration, as described above. In theory, you could adjust VC1 when calibrating against a clock but it’s too hard to make the right adjustment. Our Frequency Meter software incorporates a real time clock function that can be set to the same time as an accurate clock. The drift in time over an extended period will allow the parts per million error to be calculated. This ppm value is then entered to correct the clock in the frequency meter. The clock function is accessed by pressing and holding the Select switch as power is applied to the Frequency Meter. The top line on the LCD will show the time in 24 hour format, initially 00:00:00. The lower line shows “^h” and “^m” to indicate that the hours and minutes are adjustable using the Brightness and Select switches respectively. The seconds are cleared on each minutes change. First set the hour, then the minutes and finally, press the Select switch as the reference clock rolls over to the next minute. Note that if using the clock in a computer, it should be synchronised with the same on-line time server both before setting the Frequency Meter clock and when comparing the frequency meter clock drift. Make sure there isn’t a leap second within this period. Any other clock or watch can be used but it must be known to be accurate and have a seconds display. A clock that uses the 50Hz (or 60Hz) mains frequency as its reference is not suitable since short term accuracy is not guaranteed. Typically, the clock in a smart-phone is very accurate if set to automatically synchronise with network time. Alternatively, the time may be synced to GPS signals. A counter on the second line of the LCD shows the number of seconds that the clock has been running. This should roll over to a reading of 100,000 after about 28 hours. This is the minimum period that you should leave it running before calculating the calibration adjustment; longer is better. You cannot make frequency measurements during this time. Now compare the clock on the Meter to your reference clock (after syncing it, if necessary) and calculate the number of seconds difference. Multiply this by 1,000,000 and divide by the number of seconds on the second line of the LCD. This is the required ppm adjustment. If the clock on the Meter is slow compared to the reference clock, the required ppm adjustment will be positive whereas if the Meter clock is fast, it will be negative. The minimum time period required to get 1ppm accuracy is 11 days and 12 hours (11.5 days). You can check the clock at this time, when the seconds reading rolls over to 1,000,000, to make the calculation simpler, ie, the required ppm correction value is simply the number of seconds difference between the Meter clock and the reference clock. Once you’ve calculated the required ppm adjustment, enter it by switching the Meter off and switching it back on while holding the Brightness switch. The adjustment procedure is described above. Then cycle the power to return the Meter to its normal measurement mode. siliconchip.com.au August 2016  47 the lid, the mountings comprise 6.3mm and 12mm standoffs stacked together. Each 6.3mm standoff and 12mm standoff are secured with an M3 x 12mm screw to the PCB. The front panel is secured with M3 x 6mm countersunk or cheese head screws. The front panel/lid should not be attached until the PCB is installed first in the box. Before mounting the PCB in the box, apply power and check that the display shows valid characters. Adjust VR2 for best contrast. Check that the brightness switch works and varies the back-lighting with switch pressing. Holding the brightness switch will cause the back-light to either continue dimming or increase in brightness. The maximum or minimum setting can be achieved by holding the switch pressed for five seconds. Each time the brightness switch is released and then pressed again, the dimming direction will change. Similarly, each press of the Resolution switch should change the display resolution to the next selection in a cyclic fashion and this includes the prescaler selections. Offset adjustment VR1 is adjusted so that the IC3 output swing corresponds to the input thresholds of Schmitt trigger IC4. TPGND and TP1 are provided to enable a basic setting. Adjust VR1 so TP1 is at 2.5V. Final adjustment can be made to set the signal sensitivity by applying a signal at say 100kHz and reduce the signal level until the Frequency Meter just starts to become erratic in readings. This is the sensitivity threshold. Readjust VR1 and check if the sensitivity can be improved winding both clockwise and then anticlockwise to find the setting that gives best sensitivity. You may need to reduce the signal level as the sensitivity improves with Finally, here’s how it mounts in the jiffy box, obviously without the lid/front panel in place. Front panel art can be downloaded from siliconchip.com.au VR1 adjustment to maintain the sensitivity threshold. If you find that the frequency meter shows erratic values above 40MHz, a small adjustment of VR1 either clockwise to increase the offset or anticlockwise should fix this. For our prototype, a 2.69V setting at TP1 proved ideal. Mounting the PCB in the box If you are using the pre-drilled front panel, then the only holes to drill are in the base of the box. A drilling template, which can be downloaded from www.siliconchip.com.au, shows the position of each hole on the box. Note that this does not include a hole in the base to access VC1 for trimming. This may be required; see the panel on calibration overleaf for details. The positioning for the front panel holes and cut outs are also provided if you are doing this yourself. If you are not using the USB connector, there is no need to cut this hole out. Resistor Colour Codes         No. Value 4-Band Code (1%) 1 910kΩ white brown yellow brown 1 100kΩ brown black yellow brown 4 10kΩ brown black orange brown 1 1kΩ brown black red brown 1 470Ω yellow violet brown brown 1 390Ω* orange white brown brown 4 220Ω red red brown brown 3 51Ω green brown brown brown 5-Band Code (1%) white brown black orange brown red red black orange brown brown black black red brown brown black black brown brown yellow violet black black brown orange white black black brown red red black black brown green brown black black brown (* or 100Ω for USB supply – brown black brown brown / brown black black black brown) 48  Silicon Chip The front panel artwork (as seen in the lead photo) can also be downloaded and printed. To produce a rugged front panel label, print onto clear overhead projector film (using film suitable for your type of printer) as a mirror image, so the ink will be on the back of the film when it is attached. You can use white or off-white silicone sealant to do this. Final assembly Place the completed (and tested) PCB into the box with the spring washer already on the BNC shaft. With the PCB angled inward, the switch and BNC parts are passed through into their holes in the side of the box and the PCB is then lowered into the box and held using the BNC nut, securing this to the side panel. Once the PCB is in the box, the front panel can be attached to the PCB using M3 x 6mm screws into the tapped spacers and then to the box, via the four outer holes. Note that when using the Acrylic front panel instead of the original box lid, the screws supplied with the box may be too short. If so, use No.4 x 15mm self tapping screws as detailed in the parts list. SC Capacitor Codes 470nF 0.47µF 100nF 0.1µF 10nF 0.01µF 33pF NA 22pF NA 470n 100n 10n 33p 22p 474 104 103 33 22 siliconchip.com.au