This is only a preview of the May 2023 issue of Practical Electronics. You can view 0 of the 72 pages in the full issue. Articles in this series:
|
By Charles Kosina
∎ Output Frequency: 100kHz to 75MHz in 1Hz steps
∎ Frequency Accuracy: ±0.1Hz immediately after
calibration against a precise standard
∎ Output Level: 0dBm +0, −0.5dB 100kHz to 55MHz;
+0,−3dB 55-75MHz
∎ Modulation: none, AM or FM
∎ AM: 50Hz-10kHz, 50% modulation
∎ FM: 50Hz-1kHz; 2.5kHz, 5kHz or 10kHz
deviation
∎ 5V, 140mA power supply
∎ Digital frequency readout
∎ low RF leakage
Precision
AM-FM DDS
Signal Generator
This Signal Generator aims to provide very high calibrated accuracy with an
error of just ten parts in a billion (1 in 108), which translates to 0.1Hz at 10MHz.
It also has plenty of features, including amplitude and frequency modulation.
N
umerous cheap signal
generators are available online,
but their accuracy leaves a lot to
be desired. So I decided that if I wanted
to have a maximum error of 0.1Hz at
10MHz, which would be ideal, I would
have to design one.
The first decision I had to make was
what I wanted it to look like. This
would determine the type of enclosure
needed, the display and the controls.
With the current worldwide shortage
of many components, choosing these
parts can be difficult. There is no
escaping the fact that most advanced
components are only available in
surface-
mount packages, some with
very small lead pitch.
Good shielding is essential for a signal generator. You want the signal to
be via the output connector and not
radiated from the device itself. For
this reason, I chose a diecast aluminium box with a minimum number of
apertures that need to be cut. The largest of these is for the display, and by
using a small OLED module, RF leakage is cut down substantially.
Next, I had to decide whether to use
ready-made modules or individual
parts. Let’s take the frequency generating chip, the Analog Devices AD9851.
This is available on a prebuilt module
with its own clock generator and output filtering.
Practical Electronics | May | 2023
Those have several problems, starting with the crystal oscillator module,
which is just a standard cheap 30MHz
unit. The accuracy and temperature
stability is dubious and does not fit
my design criteria.
Yes, you can remove it and add a
wire link to an accurate temperature-
compensated crystal oscillator
(TCXO) on the main board, but it’s
not ideal. Applying amplitude modulation requires access to the RSET
pin on the AD9851 chip, meaning
another wire link to the main board.
The type of output I want to use
requires a wideband transformer from
two pins on the DDS chip. This is now
getting into the ‘too hard’ category and
is the final reason for rejecting the prebuilt module.
The cheapest Arduino modules
mostly use an ATMega328 chip running
at 16MHz. All the I/O pins are brought
out, so there are no changes needed.
But with my design, the number of pins
available from the ATmega328 are inadequate, so a fancy pin-sharing arrangement would be necessary.
Also, much processing is needed to
apply frequency modulation, and the
16MHz clock speed is marginal for
this. So instead, I am using a 44-pin
ATmega644. This gives me more than
enough I/O pins and I can arrange for
it to run at 20MHz for a 25% boost in
processing power.
The display needs to convey lots of
information, but a large screen is ruled
out by the need for a small cutout to
give low RF leakage. That’s why I chose
a 0.96-inch (24mm) diagonal OLED. It
does have rather small characters, but
conveys all the needed information.
By eliminating ready-made modules, the final PCB size (and thus the
enclosure) is much smaller. Diecast
boxes are expensive, so using a smaller
one does make it considerably cheaper.
The final major component needed
is another DDS chip, the AD9833. This
only comes in a tiny 10-pin MSOP
package but it is available on a small,
ready-made module. I was tempted to
use such a module in my design, and
could have fitted it in, but I did not
want yet another oscillator running in
the unit (the module has an onboard
25MHz oscillator).
So I am just using the bare, standalone chip. It gets its 20MHz clock
source from the clock output pin on
the ATmega644 processor.
Component Selection
Given the present severe shortage of
electronic components, I paid particular attention to being able to source parts
from several suppliers. The AD9851
DDS chip is available from several suppliers on AliExpress for about £10-12
27
Fig.1: the Signal Generator circuit is based on three main chips: IC1, the AD9833 DDS that’s used for the AM signal; IC2,
the ATmega644 microcontroller; and IC3, the AD9851 DDS that produces the output signal. IC3 is clocked by the highprecision 30MHz TCXO, while IC1 and IC2 are both clocked by the same 20MHz crystal (X1) driven by IC2’s internal
amplifier. Microcontroller IC2 also monitors user controls EN1, VR1 and VR2.
delivered. The AD9833 DDS chip is also
available for about £2 plus delivery from
numerous AliExpress sellers.
If you want to stick to more reputable – but pricey – suppliers, Digi-Key
and Mouser have the AD9851 for £31
and the AD9833 for £10
The ATmega644 chip is a little
unpredictable and varies enormously
in price, ranging from well under £10
to many multiples of that. Mouser
and Digi-Key are surprisingly inexpensive but currently out of stock.
However, they estimate delivery from
28
May, so they are well worth checking.
Wherever you get it, make sure it’s the
20MHz, 44-pin TQFP variant.
This is quite a sophisticated project
and one that is not aimed at beginners.
I am assuming that if you are interested
in this level of DDS then you know
how to program a processor. The board
includes a 3x2 ICSP header for you to
connect a programmer (AVR ISP) and
load the firmware (CSE21100A.hex)
which is available for download from
the May 2023 page of the PE website:
https://bit.ly/pe-downloads
Make sure you read the included
text file that describes the fuse values,
which need to be set after loading the
HEX file (your programming software
should have a mode to do that).
The 30MHz TCXO is best obtained
from AliExpress, around £13.50 delivered. I have found none suitable at
Mouser, Digi-Key or element14.
The OLED is a 0.96in, 128 x 64 pixel
type with the SSD1306 controller.
There are multiple suppliers for this,
and it comes in different colours. The
one I have has the top quarter yellow
Practical Electronics | May | 2023
Signal Generator
and the rest blue, and this highlights the
set frequency, but you can choose whatever colour combination pleases you.
Likewise, the potentiometers and
the encoder are standard items. Make
sure that they are the same size. The
distance from the PCB to the end of the
shaft should be about 25mm.
That leaves the magnetic components. The output transformer is made
by Coilcraft, with the PWB-16-BL giving the best result.
M3216/1206-size chip inductors are
suitable for the remaining inductors.
These have pretty close tolerances, far
better than trying to wind your own.
At 85MHz, the low-pass filter (LPF) for
the RF output needs three 120nH coils.
These are readily available at element14,
although they can also be sourced from
AliExpress. I paid £2 for 100, with free
postage, and by some miracle, they
arrived from China in two weeks.
The rest of the components are ordinary resistors and capacitors, almost
all in the standard M2012/0805 SMD
size. The toggle switches can be bought
from Jaycar, Altronics and many others, as can the diecast box.
Circuit details
The complete circuit is shown in Fig.1.
The microcontroller (IC2) drives the
two Analog Devices direct digital synthesis (DDS) chips. The AD9851 (IC3)
generates frequencies from 100kHz to
75MHz, while the second DDS chip
(IC1, AD9833) provides the amplitude
modulation (AM) from 50Hz to 10kHz.
The SSD1306 OLED screen (OLED1)
shows the current status.
The reference clock for the AD9851
is a 30MHz TCXO which is multiplied
by the AD9851 to 180MHz.
Practical Electronics | May | 2023
The output frequency is adjusted by
an incremental shaft encoder (EN1)
in steps set by its integral pushbutton
switch. Pressing it cycles through step
sizes from 1Hz to 1MHz.
Potentiometers VR1 and VR2 are connected to two of IC2’s analogue inputs.
One sets the modulating frequency for
both AM and FM. Rather than have
a continuous range of frequencies, I
instead opted for 11 separate frequencies. The other adjusts the FM deviation
and also for calibration. Three-position
toggle switch S2 selects between AM,
CW and FM.
Almost everything that I design
includes a simplified RS232 serial port
using transistors Q2 and Q3. I find this
an invaluable tool for debugging while
developing the code. It could also be
used for controlling the unit from a PC
as part of a future upgrade.
The two DAC outputs from the
AD9851 are connected to centre-
tapped RF transformer T1, which has
a 7th-order Chebyshev low-pass filter
connected to its secondary to reduce
harmonics and spurs.
With a clock frequency of 180MHz,
it is possible to generate frequencies
up to the Nyquist limit of 90MHz, but
the waveform is extremely distorted by
then. I set the limit at 75MHz and, with
the output filter, it does not contain
too many spurs even at that frequency.
The unit draws 140mA from a 5V
DC supply. I find that a mobile phone
charger is ideal for powering it. I must
have at least ten of these; I am sure
most people have lots of spares.
As mentioned earlier, the whole
thing fits in a standard diecast box,
making it quite robust and providing
good shielding.
Tuning
The shaft encoder used to adjust
the output frequency is available
from numerous suppliers on eBay
and AliExpress as well as Digi-Key,
Mouser, element14 and others. They
come in different shaft lengths and
prices; choose one with a 20mm
shaft length.
I have added pull-up resistors on all
the pins. There are weak internal pullups in IC2, but I have found the lower
value external resistors plus capacitors
to ground (for contact bounce filtering)
give far more reliable operation.
You want the frequency to increase
when you wind the knob clockwise
but depending on the shaft encoder, it
can operate either way. To solve this, a
jumper placed between pins 4 and 6 of
the programming header will reverse
the encoder direction.
The firmware detects this by
enabling a pull-up and checking the
level on the MOSI SPI programming
pin (PB5, pin 1 of IC2). With the
jumper on, this pin is low; otherwise,
it is high. The interrupt handler tests
the state of the PB5 and selects the
rotation direction based on this.
With a range of 100kHz to 75MHz,
you don’t want to turn the knob millions of times to set the frequency. This
is where its integral pushbutton switch
comes into use. Pressing it cycles
through step sizes of 1Hz, 100Hz,
1kHz, 10kHz, 100kHz and 1MHz.
AD9851 interface
The AD9851 has a 32-bit Frequency
Tuning Word (FTW) that controls the
output frequency. There is a handy
online tool for calculating the required
value at: https://bit.ly/pe-may23-ad
29
For a 1MHz output, FTW =
23860929, which is 16C16C1 in
hexadecimal. The actual frequency
with this FTW is 999.999982305kHz,
an error of about 0.02Hz. But this
assumes that the TCXO is exactly
30.000000MHz. The ones that I have
bought from AliExpress have been
within about 10Hz.
Is that good enough? It depends
on your application, but with some
of the digital communication techniques used, an error of just a few
hertz can make message decoding
impossible. So I developed a calibration technique that reduces this
error to less than 0.1Hz at 10MHz.
More on this later.
The FTW can be loaded into the
AD9851 using serial or parallel methods. Serial loading takes far too much
time and would make FM virtually
impossible. Hence, I’m using parallel
loading with five bytes transferred: one
control byte plus four for the FTW (4
× 8 = 32 bits).
You can see in the circuit diagram
that I have split this up into four bits
from two separate ports on microcontroller IC2.
I did this because I can’t use all of
Port A as I need two analogue inputs,
and the only available analogue inputs
are on Port A. Port B has the 20MHz
clock output required by the AD9833
(PB1), so that’s ruled out. Port C has
dedicated SDA and SCL pins for the
I2C interface to the OLED, and I want
to use INT0 and INT1 on port D for the
shaft encoder.
Therefore, I couldn’t dedicate all
eight lines of one port for loading the
FTW. So I split up the parallel interface into four bits from Ports C and D.
The extra few lines of code required
to do this don’t slow things down very
much. Once the byte is set up, it is
clocked in by the WCLK pin, and after
all five bytes have been sent, the FQUD
pin is pulsed to update the AD9851’s
internal latch.
Fig.2: the Signal Generator’s output level varies by about 1/4dB between 100kHz
and 55MHz, except for a dip at −1/2dB between about 10MHz and 22MHz. It’s
usable up to 75MHz, although the level drops considerably above 55MHz,
reaching nearly −3dB at 70MHz.
RF output
There are two outputs from the DAC
(digital-to-analogue converter) on the
AD9851. Application note AN-423
from Analog Devices suggests using a
wideband transformer to couple these
two outputs to the external load. This
makes for clean amplitude modulation
(AM), also described in the note.
The transformer in their example
is 1:1 centre tapped, which for a 50Ω
load, reflects 25Ω to the DAC outputs.
I used a Coilcraft transformer with
this ratio and found it to be most unsatisfactory. The 25Ω load on the DAC
outputs is far too low in impedance;
it reduced the output levels, and the
waveform became very noisy. I feel
that specifying such a transformer is
an error.
Experimenting with other Coilcraft
transformers, I found the best results
were with the PWB-16-BL with a 16:1
impedance ratio that reflects 400Ω to
each DAC output; a far more satisfactory value. The transformer −3dB bandwidth is 75kHz to 90MHz, so there is
a slight drop in level at 100kHz and
Fig.3: here’s what the 100kHz output signal looks like with
5kHz AM (yellow). The AM signal output from the AD9833
is shown below (cyan).
30
75MHz. This gave me an output close
to 0dBm over much of the range (Fig.2).
Output Filter
Without a low-pass filter on the output,
there will be many undesirable harmonics and spurs. While it is feasible to use
some of these spurs for frequencies well
above the Nyquist limit, for simplicity, I
decided not to use this approach.
Filter design is so easy these days.
Rather than ploughing through some
complex s-parameter mathematics,
there are online calculators. The one I
used to work out the C and L values for
a 7th-order Chebyshev low-pass filter
with 85MHz cutoff and 0.5dB passband
ripple is at: https://rf-tools.com/lc-filter/
The output of this calculator can
be exact or standard values; the difference in performance between the
two is minimal. The choice of inductors was discussed above in the component selection section.
Amplitude modulation
The ATmega644 processor (IC2) could
generate amplitude modulation, but
Fig.4: as expected, the spectrum of the signal from Fig.3 has
a single prominent peak at 100kHz with two smaller peaks,
5kHz on either side (ie, at 95kHz and 105kHz).
Practical Electronics | May | 2023
why bother with the complicated coding involved when we can use a second
low-cost DDS chip instead? The AD9833
(IC1) can run at clock speeds of up to
25MHz. It is a tiny 10-pin chip with a
three-wire serial control interface.
Rather than having a separate clock
generator, I use the 20MHz clock out
pin on PB1 (pin 41) of IC1. The output of the AD9833 is applied to the
gate of MOSFET Q1 via a 10kΩ trimpot, and this controls the RSET pin on
the AD9851 as per the aforementioned
application note AN-423. Rather than
having a separate knob on the front
panel, I preset the modulation level
to about 50%.
Potentiometer VR1 sets the modulation frequency. The voltage read
using the 10-bit analogue-to-digital
converter (ADC) in IC2 is converted by
software into the tuning word required
by the AD9833.
I could have had a continuous range
but found that setting the frequencies
was very fiddly. I decided instead
on dividing the ADC reading into 11
distinct values: 50Hz, 100Hz, 200Hz,
400Hz, 1kHz, 2kHz, 3kHz, 5kHz, 6kHz,
8kHz and 10kHz.
Fig.3 shows a 100kHz generated signal with 50%, 5kHz amplitude modulation on channel 1, with the sinewave modulation signal on channel 2.
The spectrum of this signal is shown
in Fig.4.
Frequency modulation
Applying FM proved to be the trickiest part of the design. To approximate a sinewave, we have to change
the AD9851 output frequency continuously. This sinewave is divided
into 24 samples, each 15° apart. Taking the sine of that angle and multiplying it by the maximum deviation
gives the instantaneous deviation for
that sample.
For example, if the maximum deviation is 3kHz, sin(30°) = 0.5, so we add a
value to the FTW equivalent to 1.5kHz
(3kHz x 0.5). The numbers become
negative past 180° and subtract from
the frequency. This takes quite a bit of
processor time; so much that the maximum modulation frequency possible
is 1000Hz.
At this frequency, the microcontroller’s timer generates 24,000 interrupts per second, and each triggers
a new FTW value to be calculated
and sent. For other modulation frequencies, the timer interrupt is 24
times the modulation frequency. See
Table 1 for the values that are added
and subtracted to the FTW to give
±2.5kHz deviation.
The available modulation frequencies are 50Hz, 100Hz, 200Hz, 400Hz,
Practical Electronics | May | 2023
500Hz, 600Hz, 700Hz, 800Hz, 900Hz
and 1kHz.
There are ways of getting a higher
modulation frequency. If we can stand
having a rougher sinewave, we could
have samples 30° apart, which would
allow a maximum frequency of 2kHz.
The spectrum of an FM signal is far
more complex; advanced mathematics
is needed to derive it. It has sidebands
that go on forever, but their amplitude
decreases rapidly so that only the first
few are important. For more details
visit: https://w.wiki/4eC$
Display
The OLED module has an SSD1306
controller and a resolution of 128 x
64 pixels.
My original design used an 8 x 8
font which gave eight lines each of 16
characters. This allowed for a fair bit of
information to be displayed but with
rather tiny characters. I changed it to
a 16 x 16 font, which is much easier
to read, but this gives only four lines
of eight characters. So I had to considerably simplify what is displayed.
Screen 1 shows the unit’s normal
display. The top line readout is the frequency in Hz, while the second has the
frequency adjustment step size. Line
3 shows the AM frequency, one of 11
fixed frequencies from 50Hz to 10kHz.
Line 4 shows the FM frequency, which
steps through 11 fixed settings from
50Hz to 1kHz.
With the Function knob fully clockwise, the unit enters calibration mode,
shown in Screen 2. The modulation
frequencies are replaced with line 3
showing ‘Calib’ and line 4 showing
the Frequency Tuning Word (FTW).
The calibration procedure is explained
later in the article.
Power supply
Many readers will have numerous
mobile phone chargers lying around,
left over from generations of phones.
Most of them deliver a nominal 5V at
up to 2A. The maximum current drawn
by the Generator is about 140mA, well
within the capability of all chargers.
I included a schottky diode in the
design for reverse polarity protection.
This drops the supply voltage by about
0.37V. The charger that I used had
an output of 5.2V, dropping to 4.85V
through the diode. It’s a simple matter of cutting off the connector on the
cable and replacing it with a DC barrel plug to suit your DC socket (either
2.1mm or 2.5mm inner pin diameter).
The PCB design includes another
regulator, REG1, so that a higher supply voltage could be used. However,
this is probably not necessary, so it’s
just linked out in the final design.
I have connected another DC socket,
CON6, in parallel with CON5. This is
for powering the companion Attenuator, to be described in a future article.
The OLED requires 3.3V, and this is
supplied by a TO-92 low-dropout linear regulator, which draws from the 5V
supply. The open-drain SDA and SCL
pins for driving the OLED are pulled
up to 3.3V by a pair of 4.7kΩ resistors.
Construction
The Signal Generator is built on a double-sided PCB coded CSE211002 that
measures 100 x 78.5mm and is available from the PE PCB Service. Refer
to the PCB overlay diagram (Fig.5) as
a guide during construction. It shows
which components go where.
Most of the parts on the PCB are
surface-mount types, and two of them
are very fine-pitch ICs. These are the
two DDS chips, and you should start
with these. Soldering them accurately
and without short circuits between the
pins takes some skill.
It helps to spread a little flux paste
on the pads before placing the ICs and
ensure they are aligned with their pads
Table 1 – frequency modulation FTW offsets for ±2.5kHz deviation
angle θ sin(θ)
Δf (Hz) ΔFTW
angle θ sin(θ)
Δf (Hz) ΔFTW
0°
0
0
0
180°
0
0
0
15°
0.259
647
15,437
195°
-0.259
-647
-15,437
30°
0.500
1250
29,825
210°
-0.500
-1250
-29,825
45°
0.707
1767
42,160
225°
-0.707
-1767
-42,160
60°
0.877
2192
52,301
240°
-0.877
-2192
-52,301
75°
0.966
2415
57,622
255°
-0.966
-2415
-57,622
90°
1.000
2500
59,650
270°
-1.000
-2500
-59,650
105°
0.966
2415
57,622
285°
-0.966
-2415
-57,622
120°
0.877
2192
52,301
300°
-0.877
-2192
-52,301
135°
0.707
1767
42,160
315°
-0.707
-1767
-42,160
150°
0.500
1250
29,825
330°
-0.500
-1250
-29,825
165°
0.259
647
15,437
345°
-0.259
-647
-15,437
31
Screen 1: this shows the screen layout
during normal operation. The output
frequency (in Hz) is at the top, the step
size and FM deviation on the second
line and the amplitude and frequency
modulation signal frequencies on the
last two lines.
Screen 2: calibration mode is entered
by rotating the Function knob fully
clockwise; the bottom two lines of
the display change, with the last line
showing the FTW. If you have the
right gear, you can get the output
frequency within 0.1Hz.
Fig.5: use this PCB overlay diagram to help with board assembly. Remember to
link out REG1 and note that Q2, Q3, and associated 15kΩ and 1kΩ resistors are
only needed if you will use the serial debugging interface. Make sure that the
three ICs, D1, REG2, T1, TCXO1 and VR1 are oriented as shown. Note that the
orientation of REG2 is swapped in the prototype, this is because regulator that
was used has a different pinout than the one specified in the parts list.
on both sides after tacking the first pin
and before soldering any others. Also,
be careful to check that their pin 1s
are located correctly before soldering
more than one pin!
32
Rather than trying to solder the pins
without bridges, concentrate on making sure that each pin gets enough solder and that it flows down onto the
corresponding PCB pad. Try to avoid
getting any solder high up on the pins,
where it is harder to fix bridges.
After soldering all the pins, it’s
then just a matter of spreading some
more flux paste over them and carefully using a length of solder wick to
remove any excess solder, including
that which might be bridging adjacent
pins. Clean off the flux residue with
some flux cleaner or alcohol, then
inspect the IC leads to make sure all
the solder joints look good and there
are no remaining bridges.
If you find anything that looks suspect, add a dab of flux paste, heat the
offending pin(s) and use solder wick
if necessary. Repeat this process as
many times as needed until you have
nicely soldered ICs.
Following these, mount the
ATmega644 chip (with wider pin
spacings than the first two, but pins
on four sides), again being careful with
its pin 1 orientation, followed by all
the other SMD components. The orientation of SMD transformer T1 also
matters. Then give the board a good
clean to remove flux residue.
Now fit the through-hole parts from
lowest profile to tallest. Be careful to
orientate diode D1, the TCXO, VR3,
and REG2 as shown. Don’t forget the
wire link across REG1, which can be
made from a component lead off-cut.
You can safely omit Q2, Q3, the two
adjacent resistors and CON3. These are
the simplified RS232 interface and are
used as a debugging aid.
The OLED screen plugs into a fourpin socket strip and is held in place
by two screws and standoffs. Rather
than cutting down an 8-pin strip that
I already had, I just removed four pins.
Depending on the OLED, the mounting holes may be either 2mm or 2.5mm
in diameter. While M2 screws are not
as easy to find as M3, I bought some
from eBay. Some larger online electronics retailers also stock M2 screws
and nuts. Don’t try to drill the holes
out on the OLED to bigger screw sizes!
There are four screw holes provided
but two are adequate.
The potentiometers and encoder
should be installed last, after cleaning off any flux residue on the board.
Preparing the case
The photo (overleaf) shows the diecast
box with the board already mounted in
the base. The positions of the required
holes are shown in the drilling and
cutting template/guide, Fig.6.
The case’s raw aluminium is not
very attractive, so I sprayed it with
three coats of matte black paint. I
used the blank circuit board as a template to accurately drill the mounting
holes and the holes for the control
Practical Electronics | May | 2023
shafts. There are small holes on the
PCB in the centre of the controls for
this purpose.
It takes a bit of care to make the
rectangular cutout. There are various
ways of doing it. If you have a milling machine, that’s great, but very few
readers would possess one. I started
by drilling a circular hole of 25mm
diameter centred on the rectangle with
a step drill. Then I filed it out into the
required 26 x 28mm rectangle. It takes
a bit of time but results in a neat finish.
You will also need to drill two
holes in the side of the base, near the
lid, to accept the barrel sockets. Make
sure they are placed so that they will
not foul the PCB assembly once it’s
dropped in. You might also want to
drill a hole in the side so that you
can access VR3 (the AM depth adjustment trimpot) once the board has been
mounted in the case.
The panel label shown in Fig.7 can
be downloaded from the May 2023
page of the PE website and printed
onto photographic paper – visit:
https://bit.ly/pe-downloads
Make the OLED and shaft cutouts
with a sharp scalpel or hobby knife. I
cut a piece of 1mm-thick clear acrylic
to 112 x 86 mm to protect the label,
again using the blank PCB as a template to drill the holes.
Attach the PCB to the front panel
using 12mm threaded spacers with
countersunk screws on the outside.
Add a washer under each spacer to
slightly increase the distance.
Now it’s time to install the panel-
mount connectors. It turned out to
be too difficult to mount the BNC
connector on the PCB itself. Connect a 50mm length of stiff wire to
the connector and pass this through
the centre hole of the BNC connector location on the PCB. Once the
board is attached to the box, cut off
the excess and solder it. To remove
the board, you will have to desolder
this one wire.
After the PCB has been fitted, connect the DC sockets in parallel, then
wire them to the matching plug for
CON1. Make sure the wires are the
right length to reach CON1. Also,
ensure the polarity is correct. You
can check this by testing for continuity between the barrel socket’s tip and
one end of power switch S1, and also
continuity from the outer barrel (with
a plug inserted) to PCB ground.
Apply power and check that everything works before fitting the lid to
the box with the supplied screws.
You should get a sensible display on
the OLED as soon as it’s switched
on. Check that you can adjust all the
parameters with the knobs.
Practical Electronics | May | 2023
Fig.6: template of the cutouts on the diecast box.
This template can be downloaded from the PE
website and printed at actual size. You can also
use the blank PCB to mark the hole positions.
If you run into any problems,
remove the PCB and have a good look
at it. Check that all the solder joints
look good, especially on the SMDs,
and that everything is where it should
be, referring to Fig.5.
Calibration
Without calibration, the accuracy of
the signal generator is entirely dependent on the TCXO. The best calibration
procedure requires a two-channel oscilloscope, a GPS-disciplined 10MHz reference and a high-precision frequency
counter (which might be built into
some higher-end oscilloscopes).
Set the three-position switch to
‘CW’ and the output frequency to
10000000Hz (10MHz). Rotate the
Function knob fully clockwise and
adjust the tuning knob to get FTW =
23860929. This is the value needed if
the TCXO has an output of precisely
30MHz. If you have no other equipment available, press the tuning button to save that value into EEPROM
and turn the Function knob back a bit.
If you have an accurate frequency
counter, repeat above but adjust
the FTW for exactly 10MHz on the
Fig.7: the front panel label for the Precision DDS Signal Generator.
33
A ‘sneak
peak’ at the
companion
attenuator
PCB that
we will
describe in
an upcoming
issue.
Once the PCB has been mounted in
the case and the wire to the BNC
socket soldered, all you need to do
is wire up and plug in the DC socket.
You only need one, as shown here,
but if you’re thinking of building the
upcoming matching attenuator, add a
second socket in parallel so you can
daisy-chain the power.
frequency counter, and save it into
EEPROM as before.
For best accuracy, first, adjust the
frequency using the counter as above.
Then connect the GPS disciplined reference 10MHz signal to one channel
of a two-channel oscilloscope, and
trigger on that channel to produce a
stationary display. Set the signal generator to 10MHz and connect it to the
other scope channel.
If the frequencies are identical, the
signal generator waveform will be
steady. But this will hardly ever be the
case; it will drift left or right. Set the
Function knob fully clockwise, and
using the tuning knob, adjust the FTW
for minimum drift. Typically, the drift
will take 10 or more seconds across one
complete cycle. The 10 seconds corresponds to an error of 0.1Hz at 10MHz.
Press the frequency button to save the
calibrated FTW value into the EEPROM.
The calibrated frequency may hold
for several hours depending on temperature fluctuations; the TCXO is by
no means perfect. Do the calibration
just before you want to do any seriously accurate work.
There is a multi-turn trimpot accessible through a hole in the left side of
the case. Setting the amplitude modulation level is best done using an
oscilloscope. Still, if you loosely couple the output to an AM receiver, you
can simply adjust the level for a clear
tone. It will overmodulate and create
lots of spurious and harsh harmonics
if you wind it up too much.
A matching attenuator
In the small enclosure I specified it
was impractical to fit an attenuator
34
Parts List – AM-FM DDS Signal Generator
1 PCB coded CSE211002, 100 x 78.5mm available from the PE PCB Service
1 diecast aluminium enclosure, 119 x 93.5 x 34mm [Jaycar HB5067 or
Altronics H0454]
1 0.96in OLED display module with I2C interface and SSD1306 controller (OLED1)
1 mechanical rotary encoder with integrated pushbutton switch and 20mm
total height (RE1) [Bourns PEC11R-4215F-S0024]
2 10kΩ PCB-mount vertical 10mm 20mm-tall linear potentiometers (VR1,
VR2) [Alpine RK09K1130AH1]
1 10kΩ side-adjust multi-turn trimpot (VR3) [Altronics R2361]
1 large knob to suit RE1
2 medium knobs to suit VR1 and VR2
1 20MHz 18pF 30ppm crystal resonator, HC-49 (X1)
1 30MHz 20 x 12mm TCXO module (TCXO1)
[aliexpress.com/item/32719087266.html]
1 Coilcraft PWB-16-BL SMD wideband transformer (T1)
3 Coilcraft 1206CS-121XJEC 120nH chip inductors or equivalent,
M3216/1206 size (L1-L3)
1 3x2 pin header, 2.54mm pitch (ICSP) (optional; for programming IC1)
1 2-pin polarised locking header with matching plug, 2.54mm pitch (CON1)
1 3-pin polarised header with matching plug, 2.54mm pitch (optional; CON3)
1 panel-mount BNC socket (CON4)
2 panel-mount DC barrel sockets (CON5, CON6)
1 4-way female header socket (for OLED1)
1 SPDT panel-mount switch (S1) [Altronics S1310]
1 SPDT panel-mount centre-off switch (S2) [Altronics S1330]
1 tactile pushbutton switch (S3)
4 12mm-long M3 tapped metal spacers
2 10mm untapped spacers
4 M3 x 6mm panhead machine screws
4 M3 x 8mm countersunk head machine screws
2 M2 x 12mm panhead machine screws and nuts
4 M3 flat washers
Semiconductors
1 AD9833 12.5MHz DDS generator, MSOP-10 (IC1)
1 20MHz ATmega644 microcontroller in TQFP-44 (eg, ATMEGA644PA-AN or
ATMEGA644PA-AU) programmed with CSE21100A.hex (IC2)
1 AD9851BRS 180MHz DDS generator, SSOP-28 (IC3)
1 LP2950CZ-3.3 3.3V low-dropout linear voltage regulator, TO-92 (REG2)
3 2N7002 60V 2A N-channel 3.3V drive MOSFETs, SOT-23 (Q1-Q3)
1 1N5819 40V 1A schottky diode (D1)
Capacitors (all SMD M2012/0805 size unless otherwise stated)
1 100μF 6.3V X5R ceramic, M3216/1206 size
3 10μF 6.3V X5R ceramic
1 220nF 50V X7R ceramic
10 100nF 50V X7R ceramic
2 10nF 50V X7R ceramic
2 100pF 50V NP0/C0G ceramic
2 68pF 50V NP0/C0G ceramic
2 22pF 50V NP0/C0G ceramic
Resistors (all SMD M2012/0805 size 1% thick film unless otherwise stated)
6 27kΩ
2 15kΩ
2 4.7kΩ
1 3.9kΩ
1 3.3kΩ
1 1.5kΩ
1 1kΩ
1 51Ω
Practical Electronics | May | 2023
into the same housing. Therefore,
I have designed a separate attenuator in another identical enclosure
with an attenuation range from 1dB
to 110dB in 1dB steps. As the output of the Signal Generator is about
0dBm, this means the lowest signal
level that the pair can generate is
around −110dBm. The photo on the
previous page shows a preview of
the attenuator, to be described in an
upcoming article.
Reproduced by arrangement with
SILICON CHIP magazine 2023.
www.siliconchip.com.au
A 300kHz signal with
10kHz amplitude
modulation applied,
resulting in smaller
peaks 10kHz on either
side of the carrier
wave.
Here frequency
modulation has
been applied. This
results in many
small peaks of all
sorts of multiples of
modulating waves
either side of the
carrier wave, but this
spectrum analyser
doesn’t have the
resolution to separate
them.
Spectral analysis of a
75MHz output signal.
Because of how a DDS
works, you not only
get spurious peaks
at multiples of the
signal frequency but
also at fractions. The
most significant in
this case is at 30MHz,
35dB below the
fundamental.
A 100kHz output
signal modulated
by 1kHz at 10kHz
deviation. This
doesn’t show on my
digital scope, but my
old analogue scope
provides this pattern.
Practical Electronics | May | 2023
www.poscope.com/epe
- USB
- Ethernet
- Web server
- Modbus
- CNC (Mach3/4)
- IO
- PWM
- Encoders
- LCD
- Analog inputs
- Compact PLC
- up to 256
- up to 32
microsteps
microsteps
- 50 V / 6 A
- 30 V / 2.5 A
- USB configuration
- Isolated
PoScope Mega1+
PoScope Mega50
- up to 50MS/s
- resolution up to 12bit
- Lowest power consumption
- Smallest and lightest
- 7 in 1: Oscilloscope, FFT, X/Y,
Recorder, Logic Analyzer, Protocol
decoder, Signal generator
35
|