This is only a preview of the October 2024 issue of Practical Electronics. You can view 0 of the 80 pages in the full issue. Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
|
Constructional Project
Project by Andrew Woodfield, ZL2PD
2m VHF FM Test
Signal Generator
This Test Oscillator uses
an AD9834 DDS chip in a
somewhat unusual way,
producing signals in the
2m band (144-148MHz)
even though that is well
above its 80MHz oscillator
frequency. It can produce a
CW signal at three different
levels and optionally add
frequency modulation.
T
he Analog Devices AD9834 direct
digital synthesis (DDS) chip is a
common feature of audio function
generators and HF oscillators. This
unusual variation delivers programmable FM digitally generated signals
on channels across the 2m amateur
radio band. It can even run from a
single AA-size cell.
The 2m amateur radio band covers
144-146MHz across the UK and
Europe, or 144-148MHz in North
America, Australia and New Zealand.
Designs using the inexpensive
AD9834 have been published for
over 20 years. Yet, looking closely,
almost all designs mimic the circuits
from AD application notes, with the
differences primarily being the choice
of microcontroller, display and PCB
layout.
Several years ago, I made a simple
test board with an ATtiny45 microcontroller and a couple of pushbuttons. I tested the AD9834’s overclocking potential and several DDS output
filter designs and quickly established
that the AD9834-BRUZ chips could be
overclocked at up to 85MHz, a useful
margin over the 50MHz specification
from the data sheet.
The slightly more expensive -CRUZ
devices are rated at 75MHz but are
reported to handle 100MHz clocks.
That was the limit of my interest
in the AD9834. I had no immedi-
Features & Specifications
▬ 144 to 148MHz output in 500kHz steps
▬ Four additional user-programmable memory frequencies in the 2m band
▬ -45dBm, -75dBm and -105dBm output levels
▬ Carrier-only (no modulation) or FM
▬ ±3kHz FM deviation (1kHz tone)
▬ CTCSS and external modulation audio inputs
▬ Simple to align output filter; everything else is digital
58
ate use for it and put it on my shelf.
So I expected few surprises when a
friend recently asked me to confirm
the results he was measuring on his
AD9834 signal generator design.
Phase modulation
As I worked on these tests, the
claimed frequency modulation (FM)
and phase modulation (PM) features
headlined in the data sheet caught
my eye. In my previous DDS designs
with the AD9850 and AD9851 chips,
their limited phase registers made
them unsuitable for FM.
The AD9834 variable-frequency oscillator (VFO) designs I’d seen only
used the DDS chip as a variable RF
oscillator or audio function generator. I’d never seen any mention of
AD9834 phase modulation anywhere
before. Looking more closely, I realised that the AD9834 has far more capable 12-bit phase registers than the
AD9850/9851. That made me curious.
Within an hour, I had phase modulation ‘working’ in a limited fashion.
However, it wasn’t clear from the data
sheet how to get a specific modulation level. An extensive search of
Analog Devices application information showed they were also largely
silent on the topic.
As I continued to explore phase
modulation, the calculations, and the
other features of the chip, I realised
it could achieve something quite different to the usual AD9834 design.
This novel 2m CW/FM test oscillator is the result.
DDS and alias frequencies
The AD9834 is a DDS oscillator
chip typical of many made by Analog
Devices. The block diagram (Fig.1)
shows the internal arrangement. It
contains a pair of programmable
Frequency Registers and a pair of
Phase Registers to allow the selection of one of two combinations of
frequency and phase.
These registers control a powerful numerically controlled oscillator
(NCO) using the chip’s 28-bit Phase
Accumulator. The output of the NCO
drives a lookup table and 10-bit DAC
that converts the NCO output to a
sinewave.
The output frequency, fout, can be
calculated as fout = Nreg × fclk ÷ 228,
where fclk is the external clock frequency, and Nreg is the 28-bit digital value loaded into one of the two
Practical Electronics | October | 2024
2m VHF FM Test Signal Generator
selectable frequency registers. The
associated Phase Registers allow the
output signal phase to be shifted by
a programmable phase angle.
With an external crystal clock and
a suitable low pass filter (LPF), the
AD9834’s output is a reasonably clean,
low-noise sinewave that can reach up
to about 30MHz. It’s possible to generate frequencies with a resolution of
0.3Hz. The output frequency’s accuracy depends on the crystal oscillator’s precision and stability.
Actually, the output produced by
the DDS is significantly more complex
than this. In the absence of the output
LPF, the DDS process also generates
an extended series of signals along
with the main output signal. These can
reach well beyond 300MHz, as shown
in Fig.2 (also from the data sheet,
again with a bit of colour added).
The primary output signal (f out )
is typically filtered by an LPF that
heavily attenuates these other unwanted signals. The output may be
programmed to any frequency up to
half the external DDS clock frequency, eg, 40MHz if the DDS uses a clock
frequency of 80MHz.
Those unwanted products generated by the AD9834 are called ‘alias’
or ‘image’ signals. The first is on a frequency of fclk − fout. When the DDS
clock is 80MHz, if fout is changed in
steps from 1Hz to, say, 30MHz by
changing the value programmed into
the AD9834’s Frequency Register, this
first ‘alias’ signal (labelled fc − fout in
Fig.2) is generated.
It begins at 80MHz and reduces in
frequency with each step, down to
50MHz (50MHz = 80MHz – 30MHz).
These are shown in more detail in
Fig.3.
If the ‘wanted’ f out signal moves
towards 40MHz (half the DDS clock
frequency), this first alias output
product becomes increasingly annoying. It also approaches 40MHz from
above and must somehow be filtered
out. That becomes more and more difficult as the desired fout signal rises
above 30MHz and approaches 40MHz.
This demands the use of a low pass
filter with a very steep cutoff for most
applications. Such filters usually
start attenuating just above 30MHz,
with the rejection increasing sharply to reach at least 60dB by 40MHz.
Most designs use a complex 5th- or
7th-order output low-pass filter for
this reason.
Practical Electronics | October | 2024
Fig.1: the AD9834 block diagram, reproduced from the data sheet (with some
added colour). It is a typical DDS oscillator with a 28-bit phase accumulator
that can generate accurate RF sinewaves up to 30MHz from an 80MHz external
clock.
Fig.2: without any added filters, the AD9834’s output signals extend well beyond
300MHz.
Fig.3: the AD9834 output spectrum with an 80MHz DDS clock and the frequency
register set to 14MHz. The arrows show the direction the unfiltered alias
carriers travel as the frequency of the 14MHz fundamental increases. The
green dashed line shows the typical high-order low-pass filter normally used to
remove these other products from the output signal.
59
Constructional Project
You can also see from Fig.3 that
the DDS output level is not the same
across the spectrum. The output level
falls following a sin(x) ÷ x response.
With an 80MHz clock, for example,
the output at 30MHz is 2dB less than
at 1MHz.
The 50MHz ‘alias’ output generated when the main output is 30MHz
is 6.5dB below the 1MHz level, and
only 4.5dB below the 30MHz wanted
output. So, without a good LPF, the
AD9834 output at 30MHz would have
severe distortion due to the desired
signal mixing with the nearby unwanted 50MHz alias output product.
Operating the AD9834 in the
2m band (144-148MHz)
Fig.3 shows the other alias signals
generated above the desired and first
alias outputs. If the desired output is
14MHz and the first alias is 66MHz,
the next alias output is 94MHz. More
alias outputs are generated at 146MHz,
174MHz, 226MHz and beyond.
The AD9834 output also contains
a residual clock output at 80MHz.
Since it is a square wave clock, it
has a strong unwanted product at the
third clock harmonic, 240MHz in this
case. Fig.3 also shows the direction
the aliases move as the main carrier
increases in frequency.
Alias outputs can appear in the
2m band, for example, if the AD9834
output is set in turn to 16MHz, 15MHz,
14MHz, 13MHz and 12MHz with an
80MHz DDS clock, the third-image
alias output (‘super-Nyquist’ product)
will be generated at 144MHz, 145MHz,
146MHz, 147MHz and 148MHz respectively, albeit at much lower levels.
If a relatively narrow bandwidth
LC bandpass filter is added to the
AD9834 output and tuned to the 2m
band, passing just these 2m-band signals is possible. An example of the
response of such a filter for use with
the AD9834 is shown in Fig.4.
This output filter must also be designed to match the 200W output impedance of the AD9834 and allow
for a 50W output load impedance, to
match the expected loads in typical
RF applications.
Modulation
With this filter selecting the 2m
band signals from the AD9834 output,
the next step was to see if it was possible to achieve frequency modulation with the chip. As noted earlier,
the AD9834 data sheet highlights
the possibility of phase (and thus
frequency) modulation but gives no
further detail.
Analog Devices’ application notes
did not provide any further details
about how the AD9834 phase modulation registers might be used to achieve
this. Also, despite a thorough search,
I could not find any DDS design in
which this feature was actually used.
That led me to dig further into
phase modulation. I analysed and
tested the AD9834 Phase Registers to
understand their impact on the DDS
output signal.
When FM was emerging on the 2m
VHF amateur radio band from 1970
to 1980, phase modulation (PM) was
Fig.4: a bandpass filter using discrete inductors and
capacitors can give this response, which allows the 144148MHz alias output product to be selected while other
alias, clock and fundamental signals are rejected.
60
generally considered the preferred approach. There were claims of “better
quality” modulation and “more natural sounding” voices. However, there
was little to suggest any evidence
supporting these claims.
Practical issues, and the arrival
of cheap varicap diodes, led to PM
being quickly overwhelmed by FM.
Varicaps were easy to use in oscillators and often reduced the component
count, unfortunately sometimes at
the expense of modulation linearity.
PM quickly fell out of favour, and
that may have led to the minimal information about phase modulation in
the technical magazines, handbooks
and reference textbooks of the period.
One useful source from those days
was William Orr’s classic “Radio
Handbook”. The 1981 edition briefly
described the method and provided
a few examples; see my summary
in Fig.5.
First, the transmitter’s frequency
deviation (ie, modulation) is directly proportional to the amplitude of
the input audio signal level for both
phase modulation and frequency
modulation.
With FM, the frequency deviation
remains constant regardless of the
input signal’s frequency. However,
with PM, the deviation increases with
increasing frequency.
Since phase-modulated transmitters were initially more popular, the
characteristic PM frequency response,
later referred to as ‘pre-emphasis’, also
required the reverse audio frequency
characteristic to be implemented in
Fig.5: the frequency deviation of a phase- or frequencymodulated transmitter depends on the modulation level,
but phase-modulated transmitter deviation also depends
on the input modulation frequency. (Adapted from Bill
Orr’s “Radio Handbook”, 1981)
Practical Electronics | October | 2024
2m VHF FM Test Signal Generator
the receiver, ie, ‘de-emphasis’. This
is usually achieved by a simple RC
circuit located immediately after the
FM receiver’s discriminator (detector) stage.
FM transmitters required the addition of this pre-emphasis characteristic to work correctly with those
FM receivers. A similar RC circuit
was usually added just ahead of the
FM modulator to mimic phase modulation. Since the effect of noise increases with audio frequency, adding
pre-e mphasis to FM (or just using
phase modulation with its integral
pre-emphasis characteristic) improves
noise performance.
AD9834 phase modulation
With that background, let’s return
to the AD9834. Phase modulation in
the AD9834 is produced by making
periodic changes to the value stored
in the Phase Register (PHASE0/1 REG;
see Fig.1). The Phase Register’s value
results in a precise phase shift of the
current DDS output signal.
The DDS output frequency is determined by the value in the AD9834’s
Frequency Register. The AD9834’s
Phase Register value shifts the phase
of the fout carrier by 2π ÷ 4096 multiplied by the value contained in the
Phase Register. The Analog Devices
data sheet doesn’t explicitly state this,
but that’s what it does.
As to the lack of any application of
this information, any example, or further supporting detail, AD9834 users
are left to fathom the usefulness of
this relationship for themselves. As
it turns out, by periodically storing a
value proportional to the amplitude
of an incoming audio signal in the
AD9834’s 12-bit Phase Register, it is
possible to produce the desired PM
(and thus FM) signal.
There should, by rights, be a fanfare
of trumpets at this point in the story,
but there’s another crucial detail. The
phase shift that produces phase modulation in the AD9834 is the same at
the fundamental output frequency
as for all the other aliased carriers
(see Fig.3).
That is entirely different from the
traditional phase modulators and
transmitters described in reference
books, those early FM broadcast transmitters, and the really old, sorry,
‘legacy’ 2m VHF ham transmitters.
These traditional transmitters used
a series of frequency multiplier stages
Practical Electronics | October | 2024
AD9834 phase modulation details
As phase deviation is proportional to both the frequency and amplitude of the
modulating signal, the following equation can be used:
Frequency deviation (in kHz) = phase shift (in radians) × modulation frequency (in kHz)
For example, if the modulating signal’s frequency is 1kHz and we have a
carrier phase shift of +½ radian, the resulting output signal’s frequency deviation is +500Hz (note that 2π radians = 360°).
A standard signal generator setup for testing a 2m amateur radio VHF FM
receiver (25kHz channel spacing) uses a 1kHz test tone and a carrier frequency deviation of ±3kHz. Therefore, we require a maximum phase shift on
the AD9834 output carrier of 3kHz ÷ 1kHz = 3 radians.
The 12-bit Phase Register in the AD9834 generates a phase shift (on the
DDS output carrier) of π radians when PHASEREG = 2048. Therefore, to achieve
3 radians of phase deviation, the Phase Register must be loaded with a peak
value of 3 ÷ π × 2048 = 1956.
The 1kHz internal oscillator delivers a 3.7V peak-to-peak sinewave to the
micro’s ADC0 analog input. This gives a peak ADC value in the 10-bit ADC register in the ATtiny45 of about 750. The ADC reference voltage is 5V, so 5V at
the ADC input would result in a maximum reading of 1023.
The software scales this 750 input value to give a peak Phase Register value
of about 2250. That is a little higher than the calculated value of 1956 due to
rounding errors in the simple integer calculation routine used. Tests with a
professional-grade modulation meter confirmed this value produced ±3kHz
deviation in the AD9834 output signal.
If you use the external modulation input in this design, the maximum frequency deviation that can be achieved is about ±4.5kHz. This is due to the
ADC measurement limit of 1023 (because of the 10-bit ADC in the ATtiny45)
with a 5V peak-to-peak audio input. That input level must not be exceeded, or
the ATtiny45 could be damaged.
to generate the required VHF carrier
(before the arrival of phase-locked
loops [PLLs]). A typical early 2m VHF
ham transmitter might have a 12MHz
crystal oscillator followed by a series
of multiplier stages.
They usually used a frequency tripler stage followed by two frequency
doublers to multiply the oscillator frequency by 12, giving a final output at
144MHz. Consequently, the frequency
deviation measured at 144MHz was
twelve times that at 12MHz.
That was very useful because these
legacy phase and frequency modulators could not be phase-shifted (or
frequency-shifted) very much. But,
since the transmitter’s multiplier
stages also multiplied the phase and
frequency modulation deviation, the
final output readily achieved the desired modulation deviation.
It’s a different situation with a DDS.
If AD9834 output (fout) is set to 14MHz,
changing the Phase Register values
appropriately in the AD9834 will
produce a 1kHz tone with a 3kHz frequency deviation on that output. The
146MHz alias product will have an
identical 3kHz frequency deviation
due to the aliasing process in the DDS.
There is no ‘multiplication effect’
like that in those traditional PM and
FM transmitters. The alias outputs
are all directly generated equally
and simultaneously by the DDS NCO
process.
Furthermore, the AD9834’s phase
modulator is a 100% digital process
carried out in the NCO. The maximum frequency deviation is limited
by the Phase Register length and the
NCO process.
The accompanying panel titled
“AD9834 phase modulation details”
describes how the Phase Register
values generate the desired PM (and
FM) deviation.
Circuit details
Fig.6 shows the circuit of this compact 2m FM Test Generator.
The AD9834 is controlled by an
Atmel/Microchip 8-pin ATtiny45 microcontroller using a three-wire SPI
serial bus. The ATtiny45 has a hardware SPI interface, simplifying the
software and increasing data transfer
speed. This SPI interface only uses
two (USCK and DO) of the usual three
SPI lines because no data needs to be
read from the AD9834.
61
Constructional Project
and off. As described in the panel,
this produces a frequency deviation
of ±3kHz.
A modified interrupt routine could
support a rotary encoder for multichannel frequency tuning, memory
selection and other features. However, without a suitable display – there
are just not enough pins – the design
was intentionally kept ultra-simple
and inexpensive.
The ATtiny45 is clocked at 16MHz
using its internal RC oscillator and
PLL. That releases all six I/O pins for
this design (the other two are the 5V
power supply).
Practically all of the firmware operates using a series of software interrupt routines. Three pushbuttons (S1S3) control the generator’s frequency
and modulation. These all connect to
pin 2 of the ATtiny45. Pressing any
button triggers a software interrupt
routine that measures the voltage at
that pin to determine which button
was pressed.
The Frequency button (S2) allows
the selection of one of eight fixed channels at 500kHz intervals from 144 to
148MHz. The Memory button (S3) selects one of four user-programmable
channels in the 144-148MHz range.
Finally, the Modulation button (S1)
turns the 1kHz modulation tone on
Generating a test tone
The internally-generated 1kHz modulation test tone is produced by ‘bitbanging’ digital output pin 5 (PB0).
Usually, one of the ATtiny’s internal timers would be used to do this.
However, that wasn’t possible here
because the timer-related pins were
already handling the AD9834 SPI
control bus.
The bit-banging process produces an
REG1
+5V
+5V
10nF
1
2
6.8k
14
COMP
5
4
DVDD
AVDD
IOUT
REFOUT
100nF
VIN
8
6
GND
7
IOUTB
FSADJ
VDD
80MHz
8
XTAL OUT
OSC (XO1)
IC2
AD9834
MCLK
SBOUT
SCLK
10
SDATA
FSEL
SLEEP
PSEL
RESET
DGND
AGND
7
18
CON3
GND
1F
S7
+
IN
BAT1 or
8-16V
DC INPUT
10F
–
146MHz BANDPASS FILTER (10MHz BW)
20
19
–40dBm
17
220
VC1
6-20pF
L1
200nH
VC2
6-20pF
120pF
47pF
L2
200nH
47pF
16
RF OUT
CON1
FSYNC
CAP
100nF
9
OUT
REG1: 7805 for 8-16V DC
100nF
input or refer to the Parts List
and text (Power Supply section)
100nF
3
unusual low-harmonic PWM output.
It is designed to null the 5th and 7th
harmonics. As a result, it only requires
a very modest 10kW/22nF RC filter to
give a remarkably clean and accurate
1kHz sine wave. The sinewave measures around 3.7V peak-to-peak (with
Vcc at 5V) when it arrives at the ATtiny45’s ADC0 input on pin 1.
The 1kHz PWM tone is generated
continuously at pin 5. However, it
is only sampled (after the RC filter)
at pin 1 with the ATtiny’s analog-to-
digital converter (ADC) when modulation is required. The sinewave’s amplitude is sampled 8000 times each
second (8ksps). These samples are
used to update the Phase Register in
the AD9834.
The relationship between the audio
tone’s amplitude and frequency and
the DDS-generated frequency deviation is explained in the panel above.
15
14
13
12
S5a
11
51
820
S5b
S6a
51
51
820
S6b
51
+5V
–30dB ATTENUATOR
CON2
S4
CON4
100nF
CTCSS
IN
10k
INT
8
1
MOD
2
S1
VCC
ADC0/PB5/RESET
PB1
IC1
ATtiny45
PB2
PB3
3.9k
3
FREQ
S2
22nF
6
DO
7
USCK
SC 2-METRE FM TEST GENERATOR
2023
5
GND
10k
S3
PB0
PB4
1.8k
MEM
62
–30dB ATTENUATOR
EXT
FM EXT
AUDIO
IN
4
SS
Fig.6: two small chips and a handful of passive
components are all that’s required in this high
stability digitally modulated 2m FM Test Generator.
Alignment just involves adjustment of the bandpass
filter for maximum output.
Practical Electronics | October | 2024
2m VHF FM Test Signal Generator
The ±3kHz deviation for FM gives
the usual 60%-of-peak-modulation
level used for testing 25kHz VHF FM
channels.
By making this modulation process external to the ATtiny45, external modulation sources can also be
used. If external modulation is selected with S4, the maximum input
level of 5V peak-to-peak will produce
at most ±4.5kHz deviation.
For those using 12.5kHz FM channels, an external audio level of 3V
peak-to-peak will give ±2.5kHz deviation with the Test Generator (peak
deviation), and 2V peak-to-peak will
give ±1.75kHz deviation (60% of peak
deviation). Those figures all assume
Vcc is close to 5V.
The 8kHz sampling rate used in
this design limits the modulating frequency to less than 4kHz (the Nyquist
limit). However, the lack of any antialiasing filter in the software practically limits external modulation frequencies to less than 3kHz.
Output signal generation
An 80MHz external crystal oscillator
clocks the AD9834. This frequency is
close to optimal for this application
because it eases the RF filtering task
slightly, and suitable crystal oscillators are readily available at low cost.
As described earlier, a low-loss,
highly selective bandpass filter is required to extract the wanted superNyquist 2m-band RF signal. A pair of
high-Q air-wound inductors are used.
These are essential to produce the desired result. The filter is designed to
give about 40dB of attenuation at the
nearest alias bands close to 100MHz
and 200MHz while introducing no
more than 4dB passband loss.
Happily, these inductors are quick
and easy to make at minimal cost.
Despite the wide variation in output
levels generated by the DDS process,
the resulting 2m band output levels
(post-filter) are about -40dBm ±2dBm.
The directly generated carrier, the
residual clock and the other aliases
are attenuated by 25dB or more, and
spurious products are at least 30dB
below the output level.
A pair of switched attenuators provide three output levels suitable for
receiver tests. The highest output
level, -45dBm ±2dBm, places an FM
receiver well into limiting without
overloading, producing a 1kHz demodulated audio tone with a very
Practical Electronics | October | 2024
good signal-to-noise ratio.
Enabling one attenuator (either)
gives a signal level of about -75dBm.
This is close to the typical ‘corner’ of
FM receiver performance where limiting begins to improve the receiver’s
signal-to-noise usefully. Adding the
second attenuator gives a test signal
of about -105dBm. This is close to that
used in typical 12dB SINAD receiver
sensitivity and squelch gating tests.
The absolute accuracy of these
levels depends in part on the output
filter alignment and the construction
method. The prototype was housed
in a 3D-printed enclosure, which provides limited shielding. That limits
the absolute accuracy of the signal
level and the absolute accuracy of
some measurements, so if you’re after
precision, you will need a metal case
for shielding.
Power supply
My initial plan was to derive the 5V
supply for the ATtiny45 and AD9834
using a 7805 linear regulator.
While the AD9834 data sheet states
it is a “low current DDS device” (20mA
at 5V), it needs an external clock generator, in this case at 80MHz. These
typically consume 30-70mA, although
a few will operate with as little as
10mA. Hence, a 78L05 might not
be sufficient when operating from a
9-12V DC supply.
An alternative is to use a switchmode regulator module like the one
shown in Photo 1. This can be mounted in place of the 7805 linear regulator on the PCB. The input voltage
can be from 6V to 15V DC, and the
5V output can deliver up to 500mA.
It improves efficiency and remains
cool during operation.
The prototype is powered by a single
1.5V AA alkaline cell. This is only
suitable for intermittent use due to
the limited capacity of the cell but
allows a compact 3D-printed PLA enclosure to be used. A boost regulator
module steps the cell voltage up to
5V (shown in Photo 2).
Finally, powering the Generator
from a single Li-ion or LiPo cell is
also possible. They have a nominal
fully charged output voltage of 4.2V
and an operating end-point voltage
of 3.5V. I tested the Generator with
supply voltages from 3-5V. The output
level remained constant within 0.2dB
across that voltage range!
If using a Li-ion or LiPo cell, there
is also the option to integrate a small
USB charger PCB (see Photo 3). Some
versions include an automatic battery disconnect feature to ensure the
battery does not operate below 3.5V,
which could damage it.
Construction
The Test Generator is built on a small
50 × 70mm PCB, coded 06107231, that
hosts a mix of SMD and through-hole
parts. The board has a near-continuous
top-side ground plane with all the
SMD parts mounted on the underside.
This arrangement keeps the unit compact while allowing for easier testing
and modification during development. It also produced improved RF
performance over other approaches.
The layout is shown in Fig.7. Start
by fitting the 23 SMD components on
the underside. It is easiest to start
with the AD9834. Position it over its
pads, tack one lead, then double-check
that its pin 1 orientation is correct
and all pins are correctly centred on
their pads before soldering the rest.
Adding a little bit of flux paste to the
pads and on the leads will make soldering it much easier.
If you accidentally bridge any of
its pins (which is easy to do), add
Photo 1: a DD4012SA small
switching buck regulator (top and
bottom shown) can deliver 5V DC
to run the chips efficiently.
Photo 2: this tiny
5V boost regulator
module is used to
step up the cell voltage.
Photo 3: this
TP4056 module
charges a Li-ion
or LiPo cell and automatically
disconnects the load if the
terminal voltage falls too low.
63
Constructional Project
While keeping each coil on the drill
bit, scrape the enamel from the wire
ends to allow for the soldered PCB
connections.
Flip the board over and continue
construction by adding the ATtiny45’s
socket (watching its orientation), the
two trimmer capacitors, the two inductors and the two electrolytic capacitors on the top side of the PCB.
Now mount the crystal oscillator
module. The PCB allows for either
full or half-sized oscillator modules to
be used. Next, install the three pushbuttons, the two slide switches, the
toggle switch, and finally, the regulator
(a 7805 or one of the other options).
cies. These may be on any frequency
from 144MHz to 148MHz. Enter your
choice of frequencies in the blue cells.
It’s best not to touch anything else!
After entering the four memory channel frequencies into the spreadsheet
provided (left side of Screen 1). Scroll
down to the bottom of the worksheet
and click on the green Write EEP File
button (Screen 2). The spreadsheet
then generates and saves the 2mTestGenFreq.EEP file in the same directory
as the spreadsheet file.
If you don’t have Excel, you can open
the file in a free package like LibreOffice, and everything will work except
for the final file-saving step; pressing
the green button will do nothing. Instead, after updating the frequencies,
check the text just to the right of that
button. You will see three lines that
start with colons.
Click your mouse on the left side of
the first line that starts with a colon
(just to the right of the colon), then
drag it down to the third line and release the button. Press CTRL+C (or
the equivalent command to copy to
the clipboard), then create a new text
file, open it and press CTRL+V (to
paste those lines into it). Save that file
and then rename it from a .txt extension to .eep.
That gives the same result as Excel
does when pressing the button.
Either way, rename the resulting
EEP file so you know what it’s for.
Otherwise, the next time you use the
spreadsheet, it will overwrite your
previous file.
Generating the EEPROM file
Programming the ATtiny45
I have created a spreadsheet to allow
the easy entry and programming of
the four user-selected 2m frequen-
The HEX file for the Test Generator is
available for download from the Practical Electronics website, along with
Fig.7: the Test Generator is built on a compact 50 × 70mm double-sided PCB
with SMDs on the underside and the through-hole components on the top.
a bit of flux paste to the bridge and
apply some clean solder wick with
your soldering iron. Once it gets hot
enough and the flux starts to smoke,
the excess solder will be pulled into
the wick, leaving clean solder joints
without a bridge. Repeat as necessary
until all the solder joints look good
under magnification.
The remaining SMDs can then be
fitted. All can be soldered in place
by hand with a fine-tipped soldering
iron. Fit the edge-mount SMA coaxial
connector after that.
Make the two inductors using 0.4mm
diameter (26SWG) enamelled copper
wire wound on a 5mm diameter drill
bit shaft. Close-wind 10 turns for each,
then stretch each coil slightly until
each measures 13mm long. Allow
10mm of extra wire at each end of
each coil for the connections.
Fuse settings for the ATtiny45
1. Memory Frequency Tables – ENTER YOUR FREQUENCIES HERE
2m TG Frequency Data
Ch 01
144,285,000
Ch 02
145,775,000
Ch 03
146,900,000
Ch 04
147,250,000
HEX
EFCAB8
D90E68
C7E3E0
C28CB0
Enter your four memory
frequencies in the BLUE cells
Calculated
HEX value
B8
68
E0
B0
EEPROM Data
CA
EF
0E
D9
E3
C7
8C
C2
00
00
00
00
INSERT MEMORY
FREQUENCIES HERE
Screen 1: a shot of the spreadsheet which is used to generate the data required
to program the user-selected 2m frequencies.
Write EEP File
Screen 2: clicking on the green button automatically generates the ATtiny45 EEP
file, which contains your four desired frequencies.
64
Value
Lock
byte
0xFF
Notes
Extended 0xFF
byte
Four bytes of data per frequency
to be stored in the EEPROM
Click on this button AFTER you have entered all
four frequencies into the cells in Section 2 above
Byte
High
byte
0x57
RSTDISBL = 0
(set), EESAVE =
0 (set)
Low byte 0xE1
CKSEL = 0001
for 16MHz
internal RC
oscillator,
CKDIV8 = 1
(disabled)
Practical Electronics | October | 2024
2m VHF FM Test Signal Generator
the BASCOM source code. You can
load the EEP file with the four user-
defined frequencies into the chip at
the same time.
Program your ATtiny45 with the
HEX and EEP files using a suitable
programmer (USBasp etc). After that,
program the configuration fuses. Table
1 (“Fuse settings for the ATtiny45”)
shows the required fuse settings.
My article on the Shirt Pocket DDS
Oscillator in the September 2021 issue
included a small programming adaptor
that can be used to program an ATtiny
chip out of the circuit in conjunction
with a suitable serial programmer.
You could also use our May & June
2013 PIC/AVR Programming Adaptor,
or build an adaptor on a breadboard
or small piece of protoboard.
Reprogramming the ATtiny45
If you want to change the memory
channel frequencies, you can’t just put
the chip back into a regular programming adaptor since the RESET pin is
disabled. The ATtiny45 must first be
erased using a special HV programmer.
I have designed a simple chip eraser
and fuse restorer (“CEFR”) to do this.
You can read about how to build it
on my website at www.zl2pd.com/
CEFR_Fuse_Reset_Tool.html – it requires no special parts and can be
powered from a USB socket or external 5V USB power supply. Another
well-known DIY fuse resetting tool
is the Fuse Doctor (see https://github.
com/SukkoPera/avr-fusebit-doctor).
Final assembly
Depending on the enclosure and
power supply option you select, add
the power switch and power wiring to
suit. In the prototype, the AA cell is located in the lower part of a 3D-printed
Parts List – VHF / FM Test Signal Generator
1 double-sided PCB coded 06107231, 50 × 70mm
1 3D-printed case & front panel label
1 set of AA cell contacts
1 AA alkaline cell
1 80MHz crystal oscillator, full or half-size DIP type (X01)
[AliExpress pemag.au/link/abmb]
3 PCB-mount 4.3mm momentary tactile pushbutton switches (S1-S3)
4 solder tag miniature DPDT slide switches (S4-S7)
[Altronics S2010, Jaycar SS0852]
1 8-pin DIL IC socket (for IC1)
1 SMA edge connector (CON1)
3 2-pin headers, 2.54mm pitch (optional) (CON2-CON4)
1 3-pin right-angle header, 2.54mm pitch (if REG1 has none)
2 No.4 × 5mm self-tapping screws
2 M3 x 8mm panhead machine screws
2 M3 x 8mm countersunk head machine screws
2 10mm-long M3-tapped Nylon spacers
1 400mm length of 0.4mm diameter/26SWG enamelled copper wire
(for L1 & L2)
various lengths of light-duty hookup wire
Semiconductors
1 ATtiny45-20PU 8-bit microcontroller programmed with
0610723A.HEX, DIP-8 (IC1)
1 AD9834-BRUZ or -CRUZ DDS signal generator IC, TSSOP-20 (IC2)
[AliExpress pemag.au/link/abmc]
1 3-pin 5V output boost module (REG1) (for AA cell operation)
[AliExpress pemag.au/link/abmd] OR
1 3-pin 5V output buck module (REG1) (for 6.5-40V DC operation)
[AliExpress pemag.au/link/abme] OR
1 7805 5V 1A linear regulator, TO-220 (for 8-16V DC operation)
Capacitors (all SMD M2012/0805 50V ceramic unless noted)
1 10μF 50V/63V radial electrolytic
1 1μF 50V/63V radial electrolytic
5 100nF X7R
1 22nF X7R
1 10nF X7R
1 120pF NP0/C0G
2 47pF NP0/C0G
2 6-20pF PCB-mount trimmer capacitors (VC1, VC2)
Resistors (all 1% SMD M2012/0805 size)
2 10kW
1 6.8kW
1 3.9kW
1 1.8kW
2 820W
4 51W
1 220W
Photo 4: my simple Chip
Eraser and Fuse Restorer
(CEFR) resets ATtiny25/45/85
fuses back to the factory
default settings so that you
can change the memory
channel frequencies.
Practical Electronics | October | 2024
65
Constructional Project
Photo 5: the PCB fits in a
3D-printed enclosure and
is powered by a single 1.5V
AA cell. The boost regulator
module is to the left of the
power switch, while
the output filter is
above and alongside
the regulator. The
AD9834 and other
SMD parts are on the
underside of the PCB,
but their locations
are marked on the
component side.
case designed for the board. STL files
for the enclosure are available for
download along with the software;
see pemag.au/Shop/6/266
The ‘battery shrapnel’ (those metal
tabs at each end of the battery compartment) slide into the slots designed
for them, and the power switch likewise slots into place in the case.
The PCB can then be mounted.
Two 5mm-long, 3mm diameter selftapping screws pass from the underside into two 6mm-long Nylon spacers
to hold the PCB in place. Four more
screws hold the front panel in place
from the front.
Testing and operation
Insert the programmed ATtiny45
into the socket, ensuring its pin 1 end
is at the notched end of the socket;
if in doubt, check Fig.7. Switch both
attenuator switches on the Test Generator to the left-most positions (minimum attenuation).
Place a 2m VHF FM handheld
within about 500mm of the assembled PCB and set it to receive on
146.000MHz. Unmute the receiver
so you can hear channel noise and
adjust the volume to a suitable level.
Connect and turn on the power to
the Test Generator. The handheld’s
receiver should immediately go quiet,
66
and the handheld’s signal strength
meter (if there is one) should indicate
a very high level (S9 or better, typically). If this does not occur, turn off
the power and carefully check your
construction.
Assuming your Test Generator
passed this test, briefly press and
release the Modulation button. You
should hear a clean 1kHz tone in the
FM handheld’s speaker audio.
While monitoring the audio and
observing the handheld’s signal level
meter, adjust the two trimmer capacitors on the Test Generator to achieve
the maximum signal level. You might
need to move the handheld several
metres away (or more) so you begin
to hear a little noise on the received
signal.
A slight improvement in tuning
can sometimes be achieved by very
slightly compressing or stretching
one or both of the coils, but this is
seldom necessary.
The generator starts with the output
set to 146.0MHz without modulation.
Each press of the Frequency button
increments the frequency by 500kHz.
If the current frequency is 148.0MHz,
the next press will change the output
to 144.0MHz, and the 500kHz frequency steps resume again through
the 2m band.
Briefly press the Frequency button
once to change the Test Generator to
146.5MHz. Retune the handheld’s receiver frequency to 146.5MHz; the
modulated signal should be audible
on this channel.
Press the Modulation button briefly
to verify that the modulation can be
turned on and off as desired. Ensure
modulation is on again before proceeding to the next test.
If the Memory button is pressed,
the generator will deliver one of four
What about phase modulation?
You might have noticed I wrote about phase modulation, but the design only
supports CW or FM. So what’s going on?
Phase and frequency modulation are two sides of the same ‘angle modulation’ coin. If a modulator is a true phase modulator, the input audio signal
is integrated before modulation to produce FM. Likewise, differentiating the
input signal to a genuine frequency modulator results in phase modulation.
Hams (amateur radio operators) all talk of “FM”, regardless of how it’s generated in their radios. When using analog angle modulation (“FM”), it was also
always easier to measure frequency deviation when setting up transmitters
and everything associated with them. Nobody ever measured phase shift. So
everyone talks about FM and frequency deviation when talking about analog
angle modulation.
More importantly for the 2m Test Generator is that, for a single tone, FM
and PM are indistinguishable.
Curiously then, but logically in context, we only talk about (and measure)
specific instantaneous phase shifts when it comes to data angle modulation.
Hence PSK, QPSK and 8PSK, where we see a digital application of relatively
large phase step modulation.
You might recall that I mentioned the possibility of AM. Not many folk use
AM on 2m, but interestingly, combining AM and PM makes it possible to generate 16-QAM with a modest amount of extra effort. But that is an idea for
another day.
Practical Electronics | October | 2024
2m VHF FM Test Signal Generator
programmed frequencies starting with
the first memory channel. Pressing
the Frequency button will return the
oscillator output to the currently selected 500kHz frequency increment.
Change the handheld receiver frequency to the frequency you programmed as Memory Channel 1 by
pressing the Memory button briefly.
The modulated signal should now
appear on this channel.
You can continue to press the Frequency or Memory buttons to select
and test the other Generator frequencies.
Important notes
Signals generated on some frequencies can produce spurious in-band
and out-of-band products. This is to
be expected from such a simple DDS
generator. Analog Devices warn about
this in the data sheet, too.
These additional signals on the
output can be generated by the DDS
clock, its harmonics and the mixing
of one or more aliases. They are typically at least 25dB (aliases) or 30dB
(spurious) below the desired output.
That’s similar to a few legacy commercial RF signal generators.
Given the absence of anti-aliasing
audio filtering, avoid the temptation to feed microphone audio into
the external audio input or to add a
low-power RF amplifier to the Test
Generator. It is not suitable for use
as a 2m FM transmitter. While usable
for basic testing, it will not meet
any regulatory test standards for FM
transmitters.
External modulation
You can use an external audio
source, such as an audio oscillator,
to modulate the Test Generator. This
can be applied to the CON2 input on
the PCB. Ensure the level is between
0V and the supply voltage (ie, 5V
maximum with a 5V DC supply). That
means the signal must have a ~2.5V
DC bias. Signals beyond that limit can
cause damage. Monitor the output on
a nearby 2m handheld transceiver or
receiver to confirm that the modulating tone can be heard.
If you want to add a socket to feed
in an external modulation signal, we
suggest you couple the signal from
that socket to CON2 via a 100nF capacitor and connect 100kW resistors
from the CON2 signal pin to 5V and
GND points on the PCB to get the
correct biasing.
CTCSS operation
A suitable CTCSS encoder can also
be connected to the CON4 CTCSS
input on the PCB. This may be used,
for example, to test an FM receiver’s
CTCSS decoder.
To do this, set the handheld to a
suitable channel and set the handheld CTCSS decoder to an appropriate CTCSS frequency, eg, 123.0Hz.
Ensure the CTCSS encoder’s maxi-
Fig.8: the front panel graphics can be
printed and laminated, then glued to
the front of the case.
mum output level is no more than
about 0.5V peak-to-peak.
Select internal modulation as the
source on the Test Generator, and
push S1 briefly to turn on the FM
modulation. When the external CTCSS
encoder is operating, the receiver’s
CTCSS decoder should detect the
CTCSS tone, unmute the receiver,
and the Test Generator’s 1kHz tone
should be heard.
Turning the external CTCSS encoder off or reducing its level below
about 0.1V peak-to-peak should cause
the receiver’s CTCSS decoder to mute
the receiver audio.
However, CTCSS decoders can
be very sensitive and may continue
to detect a valid tone with CTCSS
tone input levels of even 5mV peakto-peak!
Final comments
Photo 6: the underside of the PCB with all the SMDs fitted. The bridged pins
(9 & 10) on the AD9834 chip are both joined to GND, so I left it like that.
Practical Electronics | October | 2024
The difficulty I encountered in
finding basic information and application examples on DDS phase
modulation surprised me, given that
the data sheets heavily promote this
feature. However, achieving precise
phase (and frequency) modulation
levels with the AD9834 ultimately
turned out to be relatively simple.
I hope you find the details and
design interesting. This compact FM
Test Signal Generator is fun to use
and a great conversation piece. PE
67
![]() ![]() |