This is only a preview of the October 2023 issue of Silicon Chip. You can view 37 of the 112 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. Articles in this series:
Items relevant to "1kW+ Class-D Amplifier, Pt1":
Items relevant to "2m Test Signal Generator":
Items relevant to "TQFP Programming Adaptors":
Items relevant to "30V 2A Bench Supply, Mk2 - Pt2":
Items relevant to "1.3in Monochrome OLED Display":
Purchase a printed copy of this issue for $12.50. |
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-148MHz in Australia, New
Zealand and North America, or 144146MHz across Europe.
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 immediate use for it and put it on my shelf.
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
44
Silicon Chip
Australia's electronics magazine
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
selectable frequency registers. The
siliconchip.com.au
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 (fout) 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’ fout 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.
siliconchip.com.au
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.
Australia's electronics magazine
October 2023 45
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.
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.
Operating the AD9834 in the
2m band (144-148MHz)
Modulation
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,
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
generally considered the preferred
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.
46
Silicon Chip
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
the receiver, ie, ‘de-emphasis’. This
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)
Australia's electronics magazine
siliconchip.com.au
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-
emphasis 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
to generate the required VHF carrier
siliconchip.com.au
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.
(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.
Australia's electronics magazine
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.
October 2023 47
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 (S1-S3)
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
and off. As described in the panel,
this produces a frequency deviation
of ±3kHz.
A modified interrupt routine
could support a rotary encoder for
multi-channel 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.
Generating a test tone
The internally-generated 1kHz
modulation test tone is produced by
‘bit-banging’ 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
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.
The ±3kHz deviation for FM gives
the usual 60%-of-peak-modulation
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.
48
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
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 anti-aliasing 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
super-Nyquist 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
good signal-to-noise ratio.
siliconchip.com.au
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
Australia's electronics magazine
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 a bit of
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.
October 2023 49
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).
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 frequencies.
These may be on any frequency from
The HEX file for the Test Generator is available for download from
the Silicon Chip website, along with
the BASCOM source code. You can
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.
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.
While keeping each coil on the drill
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
Byte
Value
Lock
byte
0xFF
Extended 0xFF
byte
Four bytes of data per frequency
to be stored in the EEPROM
Screen 1: a shot of the spreadsheet which is used to generate the data required
to program the user-selected 2m frequencies.
High
byte
0x57
Low byte 0xE1
Click on this button AFTER you have entered all
four frequencies into the cells in Section 2 above
Write EEP File
Screen 2: clicking on the green button automatically generates the ATtiny45 EEP
file, which contains your four desired frequencies.
50
Silicon Chip
Notes
Australia's electronics magazine
RSTDISBL = 0
(set), EESAVE =
0 (set)
CKSEL = 0001
for 16MHz
internal RC
oscillator,
CKDIV8 = 1
(disabled)
siliconchip.com.au
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 2020 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 (see
p47; siliconchip.au/Article/14563).
The PCB is still available from the Silicon Chip Online Shop; see siliconchip.
au/Shop/8/5642
You could also use our May & June
2012 PIC/AVR Programming Adaptor
(siliconchip.au/Series/24) 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
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 siliconchip.au/link/abmb]
3 PCB-mount momentary tactile pushbutton switches (S1-S3)
[Altronics S1126A, Jaycar SP0609]
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) [Altronics W0404, Jaycar WW4014]
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 siliconchip.au/link/abmc]
1 3-pin 5V output boost module (REG1) (for AA cell operation)
[Silicon Chip SC6780, AliExpress siliconchip.au/link/abmd] OR
1 3-pin 5V output buck module (REG1) (for 6.5-40V DC operation)
[Silicon Chip SC6781, AliExpress siliconchip.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 [Altronics R5065, Jaycar RE6075]
1 1μF 50V/63V radial electrolytic [Altronics R5018, Jaycar RE6032]
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) [Altronics R4005]
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.
Parts availability
We don’t have a kit for this project but we can supply the PCB,
programmed microcontroller
and buck or boost module. The
remaining parts can be found at
your usual suppliers or from the
sources listed above.
October 2023 51
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.
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 case designed for the
board. STL files for the enclosure are
available for download along with
the software, see siliconchip.com.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 self-tapping
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
52
Silicon Chip
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,
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
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.
Australia's electronics magazine
siliconchip.com.au
modulation is on again before proceeding to the next test.
If the Memory button is pressed,
the generator will deliver one of four
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
Fig.8: the front panel graphics can be
printed and laminated, then glued to
the front of the case.
CTCSS frequency, eg, 123.0Hz. Ensure
the CTCSS encoder’s maximum 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 peak-to-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.
siliconchip.com.au
Australia's electronics magazine
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 to be of interest. This compact
FM Test Signal Generator is fun to use
and a great conversation piece.
SC
October 2023 53
|