Manuals, Timing, Ham Radio, Test Equipment

Help keep this site free:
(More Info)
        

Synthetized Audio Frequency Signal Generator

This is more of a design idea than a complete project. However, it is a fully functional circuit.

The idea is to use an inexpensive single chip microcontroller to build a simple audio frequency generator that can be acurately calibrated using simple instruments.

The problem I am trying to resolve is that True RMS AC voltmeters and accurate AF Signal Generators are not usually found on the bench in home labs, and calibration of both is an issue.

Secondly, obtaining a clean sine wave is also difficult. Most inexpensive sine generators are actually function generators, and the sinewave may have significant distorsion, which makes calibration even more difficult.

This generator works by synthesizing a sine wave using the microcontroller's timer and DAC. The frequency can be adjusted using the device's A/D converter and a potentiometer. In this prototype, the frequency range goes almost down to DC (I took a picture at 8 Hz) to about 1.4 kHz.

The amplitude of the signal is determined by the DAC output voltage range, which is equal to the sine wave peak voltages. In this case, the DAC has a nominal output range of 0 to 2V, so the sinewave's positive and negative peaks are at 2V and 0V respectively. 2V peak-to-peak is equal to 0.707V RMS.

The calibration is facilitated by temporarily setting the DAC to the min and max values and using a DC voltmeter to measure the levels. Since the levels will be the same as the peak voltages of the sinewave, and the sinewave is fairly clean (the DAC is a 10 bit device and has 1 LSB max non-linearity), the RMS voltage can be calculated and the user can be assured to be within a fraction of 1% of the true value.

Here are some waveforms:

Figure 1: 8Hz signal

Figure 2: 1.4kHz signal

Figure 3: The Silabs F330DC Toolstick and Base Adapter

The potentiometer is used to adjust the frequency through the A/D converter which changes the phase accumulator step size and therefore the frequency, without changing the basic timer driven DAC update rate, so a small amount of filtering would be sufficient to smooth out the DAC steps and provide a clean sine wave.

For calibration, the potentiometer is set to the extremes. The firmware detects that the pot is at the end of its course and sets the DAC to constant values equal to the min and the max of its range respectively. A DC voltmeter can then be used to measure the two voltages. You then compute the peak-to-peak voltage and calculate the RMS value which is a quarter of the square root of two multiplied by the peak to peak voltage.

I checked it using a Fluke 77 hand held DMM. With the pot set to the max, the DAC provides 1.973V and at the minimum, it reads 0V. The (AC coupled) RMS value is therefore 1.973 * 1.414 / 4 = 0.6975. With the generator set around 400 Hz, the meter reading fluctuated between 0.697 and 0.698. That's close enough for my needs.

Please note that the pictures were taken with the scope in average mode because the small development board lacks sufficient decoupling and the signal was a little noisy in the frequency domain due to noise on the potentiometer used to adjust the frequency. However the amplitude was perfectly stable since it is not affected by the potentiometer. The fix would be to use a spare input of the microcontroller (there are plenty) driven by a push-button so that the phase step would only change when the switch is pushed. Once a new frequency is selected, releasing the switch would disable the pot and the noise would simply go away.

If anyone is interested, I will gladly improve the firmware to eliminate this problem.

It is certainly possible to increase the maximum frequency at the expense of precision of the waveform and more complicated filtering (there is none at the moment). The sine table has 256 entries and the DAC has a settling time of 5uS, so a frequency of about 1.3 kHz is the maximum that can be achieved with full resolution, which has the advantage of working well without filtering. The DDS people routinely generate signals with just a few samples per period, at the expense of more elaborate filtering.

It is also possible to generate other waveforms. The choice is yours.

The sine table was provided with a sample program that comes with the Toolstick.

 


Links:

  • Silabs Toolstick You wil need a Toolstick Base Adapter ($17.50) and a Toolstick330DC ($9.90). You can download the development tools directly from the Silabs web site.
  • Firmware is available from me, simply send me an email.