XR-2206 Function Generator
XR-2206 Function Generator
After making a couple of waveform generators based on Direct Digital Synthesizer (DDS) chips ( AD9850 Waveform Generator & AD9833 Waveform
Generator ) I wanted to build something which uses an older 'analogue' function generator IC. There are two main contenders - the Intersil ICL8038 and
the Exar XR-2206. Although neither chip is in current production, both are still widely available - either as old stock or, perhaps, as 'clones'.
Although I've seen circuits and even commercial project kits claiming several MHz frequency range, in practice I think somewhere around 400kHz or
500kHz maximum frequency is more realistic for these ICs while still maintaining a reasonably low-distortion sine waveform. For this project, I was
more interested in producing a clean undistorted sinewave rather than pushing it to the limits in terms of frequency.
After breadboarding both the XR-2206 and the ICL8038, I decided to build a decent function generator using the XR-2206.
Although this is an analogue IC, this project just made it into the Arduino section of my website because it uses an ATmega328 as a frequency counter
and to drive an 8-digit 0.36" LED SPI module (although only 6 digits are used).
www.vwlowen.co.uk/arduino/xr2206/XR2206-function-generator.htm 1/3
01.08.2019 Arduino - XR-2206 Function Generator
The circuit around the XR-2206 is based on the ExarTAN-005 XR-2206 Application Note which describes a "High quality 1Hz to 100kHz function
generator." After playing with some of the component values and adding a couple of OpAmps, I think the sine wave quality is acceptable up to 550kHz
although the triangle wave starts to get rounded peaks at around 300 kHz.
Frequency control
The frequency range is controlled with the timing capacitor (connected between pins 5 and 6 of the XR-2206) and the timing resistors VR1, VR2 and R2
(conencted in series between pin 7 and -12v). With the component values shown above, the overlapping frequency ranges are shown in the following
table: The overlapping of the ranges isn't ideal but it hasn't proven to be a problem in practice. The TAN-005 Application Note recommends a log-taper
for the frequency adjustment (VR1) although I've used a linear one and added the "fine" frequency control (VR2).
The Exar XR-2206 datasheet recommends 1000pF (0.001uF) as the minimum value for the timing capacitor connected to pin 5. I've found that the
square wave, in particular, tends to become 'jittery' and unstable between approximately 23kHz and 50kHz with a timing capacitor smaller than 400pF.
As I'm using the square wave output for the frequency counter/display, I've limited the smallest capacitor to 470pF which results in a top frequency
around 375kHz. If the capacitor is reduced to 100pF, the highest frequency is around 500kHz still with acceptable waveforms - except for the jittery
square wave and resulting unstable frequency display between 23kHz and 50kHz.
Output Amplitude
Selection between sine and triangle waveforms is accomplished with switch SW2b connected across XR-2206 pins 13 and 14. When the switch is
closed, the output is a sine wave. With the switch open, it is a triangle wave.
Unfortunately, the output voltages of the sine and triangle are not the same. The maximum sine wave is about 6 volts peak-peak and the triangle wave is
about twice that. In my circuit, I've added two pre-set trimmers - R15 and R16 - to adjust the waveforms so they're the same voltage. When SW2b is
closed, the output is a sine wave and SW2a connects R15. When SW2b is open, the output is triangle and R16 becomes the 'active' pre-set.
R15 and R16 both need to be "backed off" from maximum otherwise the TL027CP OpAmp is overloaded when the main Amplitude control - as part of
the TL072CP circuit - is turned to maximum. Once R15 and R16 are set correctly, the output from the TL027CP is fully adjustable from near zero to
about 10 volts peak-peak (ie ±5v about the centre ground 0v). Although about 20 volts peak-peak can be achieved, 10 volts peak-peak is preferable to
avoid excessive clipping when DC OFFSET is applied.
This image shows the effect of having the sinewave's Amplitude preset trimmer set too high.
DC Offset
R14, which is connected to the XR-2206 via R1, is used to set the DC Offset of the waveforms. As the circuit uses a split power supply ( ±12v), R14 can
adjust the waveform's centre to be slightly positive or negative of ground. In practice, the amount of adjustment is fairly limited so I've used R14 as a
pre-set trimmer instead. The Sine/Triangle output on pin 2 of the XR-2206 is connected to a TL072CP OpAmp which has its own DC Offset adjustment
via VR4 so the pre-set trimmer R14 is only used to"centralise" the adjustment of VR4 - ie the waveform is centred about 0v when VR4 is centred.
The TL072CP
www.vwlowen.co.uk/arduino/xr2206/XR2206-function-generator.htm 2/3
01.08.2019 Arduino - XR-2206 Function Generator
The first half of the TL072CP OpAmp (IC3a) is used as a unity-gain buffer . IC3b provides about 5.7x gain [ (R12/R13) +1 ] and a wide DC Offset
adjustment.
Choice of the TL072CP was quite critical. Initially, I used an LM6172 which has a better frequency response but I found I could get a higher un-
distorted output frequency using the TL072CP. As the chip is socketed on the PCB and OpAmps tend to be pin-compatible, it's easy to try different ICs.
This signal is fed to both halves of the comparator - LM293. The outputs at pins 1 and 7 swing between ground and 5 volts. The output on pin 7 is taken
to a front panel BNC socket (for 'scope sync or other uses) and the output on pin 1 is taken to a header - together with +5v and ground - for connecting to
the ATmega328-based frequency counter. The 1N4148 helps protect the ATmega328 input by removing any negative spikes that may be present on the
square wave.
At 590kHz, the square wave has a rise time of about 140ns and a fall time around 70ns. A faster comparater could be used if faster rise and fall times are
required. However, as I've noted above, I've restricted the upper frequency limit to about 310kHz because of the square wave's instability between 23kHz
and 50kHz when using the smaller timing capacitor.
www.vwlowen.co.uk/arduino/xr2206/XR2206-function-generator.htm 3/3
01.08.2019 Arduino - XR-2206 Function Generator
The 8-digit 7-segment LED display circuit is very simple and straightforward. An ATmega328 microcontroller uses
an Arduino library (FreqCounter) to count the rising edges of the +5v square wave pulses from the waveform
generator at digital pin D5.
The count per second (hence frequency in Hz) is displayed on a widely available 7-segment LED display
module using another Arduino library - LedControl.
I tried several different Arduino frequency counter libraries and they all use more-or-less the same principle of
setting up an ATmega328 internal 16-bit counter and measuring the pulses on pin 'T1' - which maps to Arduino pin
D5. Luckily, it's all taken care of in the FreqCounter library.
The counter works reasonably well but, being implemented in software, there is a one-second delay between
frequency measurements so isn't quite as responsive as a hardware implementation might be.
One slight problem with the specified LED display module is that it's supplied with the pin header already soldered
in place and, as it faces forward, it would make mounting the display flush with the front panel difficult. One
solution would be to ignore the pin header and solder wires directly to the back of the PCB.
I took a chance and desoldered the pin header and fitted a new one facing to the rear. I say "took a chance" because
plated-through holes can be difficult to desolder. It's easier if you cut off the header's black plastic spacer/separator
www.vwlowen.co.uk/arduino/xr2206/page2.htm 1/2
01.08.2019 Arduino - XR-2206 Function Generator
#include "LedControl.h"
// https://github.com/wayoda/LedControl/releases
#include <FreqCounter.h>
// http://interface.khm.de/index.php/lab/interfaces-advanced/arduino-frequency-counter-library/
// Counter input must be D5.
//LedControl lc=LedControl(DIN,CLK,CS,1);
LedControl lc=LedControl(6, 8, 7, 1);
void setup() {
lc.shutdown(0,false);
lc.setIntensity(0,4);
lc.clearDisplay(0);
delay(2000);
}
void loop() {
FreqCounter::f_comp=10; // Cal Value - Calibrate with professional Freq Counter
FreqCounter::start(1000); // 1000 ms Gate Time for 1Hz resolution.
frq=FreqCounter::f_freq;
lc.clearDisplay(0); // Clear LED display.
printNumber(0, frq); // Break number into individual digits for LED display.
}
www.vwlowen.co.uk/arduino/xr2206/page2.htm 2/2
01.08.2019 Arduino - XR-2206 Function Generator
The power supply circuit is fairly conventional. It provides plus and minus 12 volts for both the XR-2206
funtion generator IC and the TL072CP OpAmp. It also provides plus 5 volts for LM239 Comparator, the 7-
segment LED display and the ATmega328 display controller.
Although the XR-2206 and the TL072CP can be used with a single supply, the resulting sine and triangle
waveforms would always be positive voltages with respect to zero volts. By providing a split power supply,
the waveforms can be true AC waveforms with positive and negative excursions about the zero volts
(ground) point.
The square wave output from the XR-2206 is always a DC voltage above 0v regardless of the power supply.
Safety Considerations
This project uses potentially lethal mains voltages. Do NOT skimp on safety arrangements such as
earthing (grounding), fuses, ventilation and preventing access to live parts through ventilation slots.
AC mains is applied to the primary of the transformer through a 1A fuse and an illluminated switch.
There doesn't seem to be any particular standard as to whether the fuse should come before or after the
switch. My personal view is that the fuse should come first in case the illuminated switch becomes faulty.
Use a good quality screw-in type panel fuse and ensure that the design is such that, when removing the
fuse holder, it is well clear of live internal contacts before there is sufficient clearance to be able to touch
the fuse (or the holder's metal parts) with your fingers.
The mains earth (ground) lead is connected to the enclosure through one of the transformer mounting
bolts. Although I used a plastic enclosure, the mains transformer mounting bolts are exposed on the
underside so must be connected to mains earth.
Note that any parts of the enclosure that are attached separately (such as the front & rear panels and the
top attached with self-tapping screws, for example) should have their own earth wire back to the same
transformer mounting bolt. Do not rely on the self-tapping screws for earth continuity. Try to leave the
www.vwlowen.co.uk/arduino/xr2206/page3.htm 1/2
01.08.2019 Arduino - XR-2206 Function Generator
incoming earth conductor longer than the live and neutral conductors so that, if the cable does get
forcibly pulled, the earth will be the last conductor to break.
All exposed mains-voltage connections - to the illuminated switch, the fuseholder and the transformer -
must be insulated with heat-shrink sleeving and/or access prevented with insulating covers. It should not
be possible to make contact with any high voltage connections - even with the top cover removed-
without a determined and conscious effort!
The mains cable entering through the rear panel must be protected from chafing with a rubber grommet
and the cable must be clamped against moving inside the enclosure to prevent the connections being
pulled or twisted and to prevent the grommet being pulled from its hole.
Despite what commercial products may do, do not use the printed circuit board for any mains voltage
part of the circuit.
The low voltage components of the power supply are mounted on the main function generator PCB. The
+12v and +5v regulators require small heatsinks. Due to lack of space, I fabricated a heatsink for the +12v
regulator from a small strip of aluminium. Constructional details are shown on the next page...
www.vwlowen.co.uk/arduino/xr2206/page3.htm 2/2
01.08.2019 Arduino - XR-2206 Function Generator
Part 4 ~ Construction
The Main PCB
www.vwlowen.co.uk/arduino/xr2206/page4.htm 1/5
01.08.2019 Arduino - XR-2206 Function Generator
www.vwlowen.co.uk/arduino/xr2206/page4.htm 2/5
01.08.2019 Arduino - XR-2206 Function Generator
General Views
The fabricated heatsink for the LM7812 can be seen at the top left corner of the PCB in the image below.
As the potentiometers I used didn't have any "mechanical" attachment to the PCB, I wasn't happy allowing the solder connections
to flex so I stiffened their mounting with a small aluminium bracket attached to the PCB.
www.vwlowen.co.uk/arduino/xr2206/page4.htm 3/5
01.08.2019 Arduino - XR-2206 Function Generator
www.vwlowen.co.uk/arduino/xr2206/page4.htm 4/5
01.08.2019 Arduino - XR-2206 Function Generator
www.vwlowen.co.uk/arduino/xr2206/page4.htm 5/5
01.08.2019 Arduino - XR-2206 Function Generator
I printed a mirror image of the panel layout using a laser printer and ironed it onto the thoroughly cleaned and de-
greased aluminium front panel - in a similar way to making a printed circuit board etch mask. I followed it with a
couple of coats of clear varnish. It isn't perfect by any means but it did allow for some flexibility in font size - which
rub down lettering, for example, doesn't really allow.
I designed the panel layout using a free program called Front Panel Designer which makes positioning the labels easy.
General Views
The enclosure is a Hammond 1598D which I found on eBay.
The 3mm thick red transparent acrylic sheet was also from eBay. Cut a couple of millimetres larger than the panel cut-
out and super-glued to the front panel. I retained the protective plastic film on the rear face as it obscured the individual
unlit segments of the 7-segment LEDs but allowed the illuminated digits to shine through well.
The display board itself is attached with long M3 screws with their heads Araldited to the front panel and M3 nuts run
down the threads to position the 7-segmet displays to be just touching the back of the acryllic.
www.vwlowen.co.uk/arduino/xr2206/page5.htm 1/3
01.08.2019 Arduino - XR-2206 Function Generator
The front and rear panels both have mains-voltage components and MUST be earthed (grounded) to the same
transformer mounting bolt as the incoming mains earth wire. Heat shrink sleeving covers exposed mains-carrying
connections as much as is practicable.
Although the mains transformer runs fairly cool, I drilled a few rows of 1mm diameter holes in the rear panel (using an
old piece of Veroboard as a drilling template).
www.vwlowen.co.uk/arduino/xr2206/page5.htm 2/3
01.08.2019 Arduino - XR-2206 Function Generator
Calibration
1. Connect the Sine wave output to an oscilloscope and allow the function generator and the oscilloscope to warm
up for about 15 minutes.
2. On the function generator, switch SW2 to SINE, turn the DC OFFSET (VR4) to the central position and AMPLITUDE
(VR3) fully clockwise (maximum).
3. Set the Sine Amplitude preset (R15) for a peak-peak voltage on the 'scope of 10 volts.
4. Switch SW2 to TRIANGLE and set the Triangle Amplitude preset (R16) for a peak-peak voltage on the 'scope of 10
volts.
5. Switch SW2 back to SINE output. Set the 'scope input to DC and the DC OFFSET (VR4) to the central position, then
adjust the DC OFFSET TRIMMER (R14) until the waveform is vertically central about 0v.
6. Adjust the DISTORTION (R5) and SYMMETRY (R17) trimmers alternately for minimum distortion of the sinewave
viewed on the oscilloscope.
7. Repeat all the steps at various frequencies to find the best overall settings.
www.vwlowen.co.uk/arduino/xr2206/page5.htm 3/3