Sunday, April 29, 2012

DIY Audio Function Generator Part 1

Most of my Blog posts involve short 3-4 hour projects/hacks that I just build up for learning and fun. I thought it was time to develop something a bit more involved and share my design process in a series of posts over the next few months.

I have lots of test equipment in my home lab from O-scopes, RF Signal Generators, a Spectrum Analyzer, RF Power Amps to a slew of Multimeters and DC Power supplies, but one piece that is missing is a simple low end Audio Function Generator. I searched eBay and anything worth wild was in the $200+ mark and to be honest I wasn't that impressed with their specs. Most $200 Function Generators only have a Sine Wave output spec'd at 1% THD....... 1% is ok for most uses, but I just got done building up Jim Williams Wien-Bridge Osc. and was able to get 0.024%. I want to be able to use the Sine Wave output to test ADC resolution and as a base band signal for RF projects and having very Low Total-Harmonic-Distortion (THD) would be nice.

So I've decided to build my own Function Generator. Most DIY Function Generators I found online start out with a Square Wave Oscillator feed into an integrator to get a triangle wave, then you feed the triangle wave into a wave shaper and you get a rough Sine Wave output. This is similar to a project I built up last year.
This method works, but the wave shaped Sine wave isn't going to have the low THD I was looking for, so I am taking the opposite approach and starting with a Sine Wave Generator based on the #327 Lamp Wien-bridge Circuit to get the low THD. I'll then feed that into a Comparator to produce the Square wave; I am then using the Square Wave to turn on/off a ramp generator circuit. I would rather have a ramp output vs a triangle wave. The ramp circuit will let me play around with different single & dual slope ADC concepts later on.

Below is a block diagram of my proposed design:
I've added a +3.3V Square wave output to be feed into a frequency counter, so I don't need to bother to add a display to the function generator. Mine as well make use of the Frequency counter I have for a display, also having a +3.3V square wave output would be nice for any micro projects later on.

I'll have a Freq. Adjust Pot, Freq. Range switch, Ramp Current Source Adjustment Pot, and an Output Amplitude Adjustment potentiometer. Below is a rough layout of the proposed design:

I really like the layout of the CEE Source Measurement unit, so I'll be mounting the PCB in a similar looking plexi top and bottom when it is all done.

After sketching out the concept drawings my next step was to test the Wien-Bridge Oscillator circuit I was basing this whole design around. I prototyped up the circuit with the Frequency Range Select switch and 10K pot and was pleasantly surprised to see everything worked well.

The three switch selectable frequency ranges I have are: 16Hz to 600Hz, 160Hz to 6kHz, and 1.6kHz to 60kHz with the 10K potentiometer adjusting the output frequency continuously through the ranges. The one downside with this Lamp based implementation is there is a settling time of several seconds needed after each major adjustment to allow time for the Lamp to thermally settle.... this is an ok tradeoff for me given I should be able to achieve very low 0.05% or lower THD.

The next step was to draft up the rest of the circuitry in LTSPICE to see if I could create the Square Wave and Ramp functions successfully.
After an afternoon of playing I settled on this circuit. It works well in simulation and now I'll have to build it up and see if it works for real.

Here is a link to the LTSPICE file:
A Link to the LTSPICE OSC file:

More Testing, DesignSpark PCB Layout, and prototyping to come...........................

1 comment: