Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
29 views11 pages

Counter

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 11

VHF COMMUNICATIONS 3/2007

Matjaz Vidmar, S53MV

A simple RF/Microwave
frequency counter
I decided to design a simple, easily gate timing.
reproducible counter around a PIC
16F876A. The basic counter range is Both the microwave and RF inputs
extended to at least 180MHz using two have an additional feature, usually not
74Fxx devices. A divide-by-64 found in frequency counters: a simple
prescaler is used for higher signal level detector driving a bar
frequencies up to at least 4.5GHz. All indicator on the LCD display. This is
results of the measurement are shown very useful to check for the correct
on an inexpensive, 2x16 alphanumeric input signal level as well as an
LCD module with large characters. A indicator for circuit tuning or
block diagram of the counter is shown absorption wave meter dip display.
in Fig 1.
The counter has three front ends: a 1.
microwave (prescaled) input, an RF
input and a TTL input. The The counter
microwave and RF inputs are AC
coupled and terminated at low
impedance (around 50Ω). The TTL
input is DC coupled and has high input The whole counter design is based on a
impedance. A progress bar indicator is 16F876A PIC microcontroller. This
provided on the LCD display for the includes several peripherals but just a

Fig 1: Block diagram of the frequency counter.

130
VHF COMMUNICATIONS 3/2007

few of them are used in this project. The /K input of the 74F50109 is inverted, two
most important in this project are two port pins (RA2 and RA3) of the PIC are
internal hardware counter/timers called required to drive the J and /K inputs with
TMR0 and TMR1. The TMR0 timer minimal skew.
generates very precise interrupts every
100 microseconds (10kHz) from the On the other end, the counter needs to be
20MHz clock/reference. All required extended beyond the 4 bits of the 74Fxxx
timings for the counter timebase are logic and 16 bits of the TMR1 are used
simply integer multiples of this basic adding up to 20 bits of resolution. To
period. avoid disrupting the operation of the
main 100μs timer, the TMR1 is not
The TMR1 is used as a 16bit (binary) allowed to generate interrupts. The
input signal counter. It’s maximum TMR1 overflow (interrupt) flag is
counting frequency is just around checked during every 100μs (TMR0)
16.7MHz. Therefore, the first four flip- interrupt. The overflows are counted in
flops of the input signal counter chain are two additional 8 bit registers. The overall
added externally as 74Fxxx logic counter resolution is therefore 36 bits.
devices. The first two stages use one of
the fastest 74Fxxx series devices, the These 36 bits are truncated to 32 bits, the
74F50109 dual J/K flip-flop. The upper 4 bits are not used. 32 bits allow
74F50109 is also specified as metastable counting beyond 400MHz with a
immune and is therefore the ideal resolution of 0.1Hz (gate time 10s). None
component for the counter gate. The of these counters is ever reset! The
circuit diagram of the counter is shown in counter value at the beginning of the
Fig 2. measurement is stored and subtracted
from the end value. Finally, the 32 bit
A more conventional 74F74 dual D flip- binary result is converted to a 10 digit
flop is used in the third and fourth stages. decimal number and the latter is
The TTL flip-flops require pull-up displayed with the leading zeros blanked,
resistors to drive the PIC ports RC0, decimal point and units (MHz or kHz).
RC1, RC2 and RC3. RC0 is used as a
clock input to the TMR1 at the same The basic counter software allows three
time. Replacing the 74F74 with a resolutions (selected with RC4 and RC5):
74ACT74 could save some current and 10Hz, 1Hz and 0.1Hz in direct counting
two pull-up resistors. The 74F50109 has mode (no prescaler), corresponding to
the same pin-out and logical function as gate times of 100ms, 1s and 10s. When
the 74F109, but the latter has a lower used with a divide-by-64 prescaler, the
frequency limit and is not specified three available resolutions become 1kHz,
metastable free. 100Hz and 10Hz, corresponding to gate
times of 64ms, 640ms and 6.4s. All these
The typical frequency limit of the gate times are obtained by counting the
74F50109 is specified as 150MHz. 100μs (10kHz TMR0) interrupts.
Driving the 74F50109 with a fast
switching transistor 2N3960 (f t = The PIC 16F876A drives a standard LCD
1.6GHz) and a schottky diode 1N5712 to module with a HD44780 controller and a
prevent saturation, reliable counting can resolution of two rows of 16 characters
be achieved up to 190 - 200MHz! Unlike each. The HD44780 requires 8 data lines
conventional AND or OR gates, the J/K (port B of the 16F876A) and three
gate minimises the jitter of the counting control signals: Register Select (RC6),
result (wandering of the last digit) Read/Write (GND) and Enable (RC7).
regardless of the input signal. Since the Since the data presented on the 8-bit-

131
VHF COMMUNICATIONS 3/2007

Fig 2: Circuit diagram of the frequency counter.

wide output port RB0-7 is only written to two 10Ω current limiting resistors.
the HD44780, the R/W input is
hardwired to ground (/Write). The LCD The input signal level is fed to the only
back light LEDs are supplied through

Fig 3: PCB layout for the frequency Fig 4: Picture of the component side
counter. of the counter PCB.

132
VHF COMMUNICATIONS 3/2007

Fig 5: Picture of the track side of the counter PCB with SMD compoenets
fitted, note the 0R links.
remaining PIC peripheral used in this IC sockets are used for the PIC 16F876A
project, the A/D converter. The latter has and as connectors. The PCB layout is
a resolution of 10 bits, but only the most shown in Fig 3 and the component layout
significant 7 bits are used. These drive a in Figs 4 and 5.
bar indicator on the LCD module with 36
segments, corresponding to an input Most of the components are in SMD
voltage between zero and 1.4V (full packages and are installed on the bottom
scale) on the analogue inputs RA0 (MW (solder) side of the printed circuit board.
mode) or RA1 (RF mode). The operating Due to the single sided circuit, many
mode is selected with switches driving jumpers are required. The PCB is
the digital inputs RA4 and RA5. designed for 0805 jumpers shown as 0R
on the picture of the completed board Fig
The main counter module is built on a 5.
single sided printed circuit board
measuring 60mm x 60mm. Good quality A 20MHz crystal is used both as a clock
133
VHF COMMUNICATIONS 3/2007

Fig 6: Circuit diagram of the microwave prescaler.

source for the PIC and as a frequency


reference for the frequency counter. 2.
20MHz crystals are usually designed
either for 20pF - 32pF parallel resonance Front ends
or series resonance. Since the internal
oscillator inside the PIC 16F876A is not
able to oscillate on the correct frequency
with large capacitors, a series inductor is The counter is equipped with three
required to bring the crystal on the exact different front ends. The front ends are
frequency. The recommended 2.2μH built as separate modules to allow an
inductor is suitable for 32pF parallel easy interchange as better components
resonance crystals. (prescalers) become available or new
Of course, the PIC 16F876A is also able requirements show up.
to operate with an external clock source.
This has to be connected to pin 9 while 2.1 Microwave prescaler
pin 10 is left open. If a high quality The microwave prescaler front end is
frequency reference for 5MHz, 10MHz designed around the NEC μPB1505 chip,
o r 1 0 0 MH z is a v a ila b le , it is the circuit diagram is shown in Fig 6.
recommended to multiply or divide its This counts up to 4.9GHz and unlike the
output to obtain the required 20MHz products from some other manufacturers
clock. it is very reliable. An ERA-2 MMIC is
Other clock frequencies than 20MHz can used to boost the input sensitivity and
be accepted by modifying the software to provide some protection for the
obtain the 10kHz TMR0 interrupt. The μPB1505. The ERA-2 can accept input
TMR0 time constant allows changing the signal levels up to +15dBm (30mW). A
clock in 80kHz frequency steps (4 clock 6dB attenuator behind the ERA-2
cycles per instruction and divide-by-2 prevents saturating the μPB1505.
prescaler for the TMR0). Smaller clock
steps of 40kHz can be obtained by
inserting NOP instructions in the TMR0 A 33kΩ resistor can be used to kill the
interrupt routine, for example using a self oscillation of the μPB1505 around
high quality (telecom SDH) TCXO for 2.6GHz, but this resistor also adversely
19.44MHz. affects the sensitivity and the maximum

134
VHF COMMUNICATIONS 3/2007

(as offered in many counters) is actually


a disadvantage for RF measurements, last
but not least corrupting the
measurements due to low frequency
(50Hz mains or switching powers
supply) interference. The RF front end
includes a simple RF amplifier with a
BFP196 transistor, an input protection
with a 33Ω resistor and a LL4148 diode
Fig 7: PCB layout for the microwave and a signal level detector using a
prescaler. BAT62-03W zero bias schottky diode.

frequency of the prescaler. A BAT62- The RF front end is built on a single


03W zero bias schottky diode is used as a sided printed circuit board measuring
signal level detector. The gain of the 20mm x 60mm. The PCB layout is
ERA-2 sets the full scale on the bar shown in Fig 10 and the component
indicator to about 0dBm. layout in Fig 11
The microwave prescaler front end is The input cable is soldered directly to the
built on a single sided printed circuit PCB. Since the RF front end does not
board measuring 30mm x 60mm. The include any hysteresis, it is not able to
PCB layout is shown in Fig 7 and the operate with sine wave signals at very
component layout in Fig 8. The 50Ω low frequencies.
lines are built as coplanar waveguides on
a 1.6mm thick FR4 substrate. The input 2.3 TTL front end
cable is soldered directly to the PCB. To
avoid parasitic resonances between the The TTL front end is a high impedance
PCB and metal ground plane, two input. DC coupling is necessary to
additional 39Ω damping resistors are measure pulses with arbitrary duty
installed in series with two mounting cycles. The circuit diagram is shown in
screws. Fig 12 Further it includes hysteresis for
reliable low frequency measurements,
2.2 RF front end regardless of the waveform. The circuit
includes a BF998 MOSFET source
The RF front end is designed for a high follower and a 74F04 schmitt trigger.
input sensitivity and low (close to 50Ω) The output of the schmitt trigger is again
input impedance. The circuit diagram is DC coupled to the 2N3960 in the main
shown in Fig 9. A high input impedance counter module.

Fig 8: Component
layout for the
microwave
prescaler.

135
VHF COMMUNICATIONS 3/2007

Fig 9: Circuit diagram of the RF front end.

3.
Assembly

Fig 10: PCB layout for the RF front All counter modules require a +5V
end. power supply. A 7805 regulator is a
simple and efficient solution. Some
additional components are required for
The TTL front end is built on a single interference and switching transient
sided printed circuit board measuring suppression. The circuit diagram of the
20mm x 60mm. The PCB layout is power supply is shown in Fig 15 The
shown in Fig 13 and the component 7805 regulator is bolted directly to the
layout in Fig 14. The input cable is rear panel for heat sinking.
soldered directly to the PCB. Input
protection is provided by the 470Ω Two DPDT switches are used for front
resistor and the zenner diodes inside the end selection. An additional switch is
BF998 (breakdown voltage between 8V used to select the gate time.
and 12V). Further protection could be
obtained by additional zenner diodes, All four printed circuit boards are single
however the latter may include a large sided, etched on 1.6mm thick FR4
capacitive loading (more than 100pF). laminate (image resolution is 150dpi).

Fig 11: Component


layout for the RF
front end.

136
VHF COMMUNICATIONS 3/2007

Fig 12: Circuit diagram of the TTL front end.

4.
Operation

Fig 13: PCB layout for the TTL front Immediately after power up, the counter
end. displays the software version/date for
about one second.
The counter is installed in a box made of
aluminium sheet shown in Fig 16. The During normal operation, the leftmost
bottom is made from 1mm thick characters of both rows are used as a
aluminium sheet, the cover is made from vertical bar display of the gate progress
0.6mm thick aluminium sheet and the with 10 horizontal segments. The
LCD is protected by a small piece of remaining 15 characters in the top row of
plexiglass. The internal width is 200mm, the display show the measured
depth 100mm and height 45mm. frequency. Three characters in the bottom
row show the operating mode ("MW",
The RF connectors, switches and LCD "RF" or "TTL") and the remaining 12
module are installed on the front panel. characters are used as a horizontal bar
The power supply connector is installed display of the signal strength with 36
on the rear panel. vertical segments.

In the microwave mode both prototypes


Fig 14: Component
layout for the TTL
front end.

137
VHF COMMUNICATIONS 3/2007

Fig 15: PSU circuit


diagram for the
frequency counter.

operated reliably up to 4.9GHz with an 10MHz. The RF signal-level meter


input signal level of 0dBm (self follows a similar increase in its
oscillating μPB1505 without 33kΩ sensitivity. This increase at lower
resistor). Below 3GHz the sensitivity frequencies matches the performance of
improves to -30dBm. The 33kΩ the described loop probes!
unbalancing resistor to stop self
oscillations degrades this sensitivity by Unfortunately, the 74F50109,
more than 10dB! Below 500MHz the manufactured by Signetics (Philips) is
sensitivity degrades again: the counter not easily available. A 74F109 from the
may count odd harmonics with too low same manufacturer only operated up to
signal levels. The minimum usable about 140MHz. A combination of
frequency was found around 12MHz. Fig 74AC109 and 74AC74 (both from
17 shows the counter in the microwave National Semiconductor) counted up to
mode with a gate time of 640ms about 170MHz. The 74ACxxx logic
corresponding to a resolution of 100Hz. circuits require a different input DC bias:
replace the 2.2kΩ resistor between the
input and the collector of the 2N3960
In the RF mode the 74F50109 allows with a 47kΩ resistor. All four pull-up
counting up to about 220MHz. Reliable resistors can be omitted with 74ACxxx
operation is possible up to 190-200MHz, logic. Finally, the 2N3960 itself does not
depending on the internal wiring to the have many valid replacements. A
switches, with an input-signal level of 2N2369 will decrease the 74F50109
0dBm. The sensitivity improves from - counting rate down to just 165MHz while
20dBm at 180MHz down to -50dBm at RF and microwave transistors provide
Fig 16: A picture
of the completed
frequency counter.

138
VHF COMMUNICATIONS 3/2007

Fig 17: The counter in the microwave mode with a gate time of 640ms
corresponding to a resolution of 100Hz.
even worse results! to a frequency counter.
In the TTL mode the prototypes operated Last but not least, all detailed
reliably beyond 100MHz. This frequency information like PCB files or software
limit is however reduced by the coaxial source code are available on Matjaz
cable feeding TTL signals and even more Vidmar's web site [2].
when using oscilloscope probes. The
input signal level is not indicated in the
TTL mode. The built in hysteresis allows
reliable counting of very low frequencies,
like the 50Hz mains. 5.
The current software version does not Probes
detect the mode switching before the end
of the gate period. Therefore one may
have to wait up to 10 seconds for the gate
period to expire and another 10 seconds A very common problem of many
to get some meaningful reading. The frequency counters is that these are
current software also does not make any supplied to the end user without (any)
use of the measured signal level. s u i t a b l e p r o b e s ! I n f a c t , mo s t
Therefore it will display the self RF/microwave sources cannot be
oscillating frequency of the prescaler connected directly to a counter input. The
with no signal input in the microwave conventional oscilloscope probe is not a
mode or any other invalid data due to low good solution for most RF/microwave
signal levels in the RF or microwave measurements either. Worst of all, most
modes. counters are not even designed to be used
The software is designed using the same with some useful probe types.
rules as the whole counter: keep this
project useful, simple and Any serious RF/microwave engineer has
straightforward. A simple prescaler is his/her own set of suitable attenuators,
therefore used in place of a considerably circulators, loads and directional couplers
more complex direct microwave counter. to connect spectrum analysers, power
Some simple 74Fxxx logic ensures meters, counters and other instruments to
enough overlap between the prescaled the circuit under test. A complete set of
microwave frequency range and the transitions between different RF
direct RF frequency range. A TTL input connectors is also required. Finally, a
with hysteresis is an efficient solution for number of pigtailed connectors to be
low frequencies and extreme duty cycles. soldered directly to the circuit under test
Finally, an input signal level indicator is is always of great help.
an inexpensive but very useful addition

139
VHF COMMUNICATIONS 3/2007

test is not very efficient, it is rather


unlikely to damage the counter with large
RF signal levels.

A standard oscilloscope probe is a


practical solution to measure low
frequencies, pulsed signals and in some
cases even RF signals. In order to use an
oscilloscope probe efficiently, the
internal operation of the probe has to be
understood (Fig 19). Most probes are
equipped with a X1/X10 switch. Further
Fig 18: Loop probes. there is a series damping resistor (around
500Ω) to avoid cable resonances that
could both corrupt the oscilloscope
display and severely disturb the circuit
A very useful probe to be used with under test. Finally, one should
RF/microwave counters is a simple understand that although the TTL input
inductive pickup or in other words a of the counter operates in excess of
5mm diameter loop at the end of a short 100MHz, the oscilloscope probe may
length of 50Ω coaxial cable. According reduce the upper frequency limit to
to my own experience it does not make 50MHz or even less!
sense to make this loop much smaller or
larger than 5mm. The same loop can be
used from a few MHz up to several GHz.
A small resistor (around 50Ω) can be
installed in series with the loop to 6.
suppress any cable resonances.
References
The loop is simply approached to
inductors or resonators in the circuit
under test (Fig 18). The undesired [1] 13GHz prescaler, Zeljko Bozic, VHF
loading of the circuit can be minimised Communications Magazine, 2/2006, pp
by keeping the loop at the maximum 89 – 94
distance that still provides a stable
reading on the counter. Finally, the loop [2] Matjaz Vidmar web site for
probe is never affected by low frequency frequency counter
(50Hz mains or similar) interference. http://lea.hamradio.si/~s53mv/counter/his
Since the coupling to the circuit under tory.html

Fig 19: Circuit diagram of a standard oscilloscope probe.

140

You might also like