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...........................

Friday, April 6, 2012

Vichy DM4070 LCR Meter Teardown

A few weeks ago I was inspired by VK2ZAY's LC Test Oscillator video and wanted to build one of my own. So I jumped on ebay and bought a handful of J310 N-channel JFETs and started up LTSPICE to get a circuit sketched up.
The circuit simulated well and I jumped into prototyping.
Well long story short I couldn't get it working, so I started to suspect the inductors and caps I was using. The caps were el cheapo ebay bought parts and were shipped from Thailand, so I had little confidence they would hold up at 50MHz, also the inductors I was using weren't really suited for RF frequencies so I hand-wound my own aircore inductor. 

In the heat of debugging I decided I needed an LCR Meter to check out some of these components, so I went on to ebay and bought a Vichy DM4070 LCR Meter for $37.... I know this is an el cheapo ebay meter, but for home use it looked good. I have been pretty happy with it so far. It is not auto-ranging, but offers an adjustment pot to dial out any stray capacitance. It is well put together and looks sharp, which doesn't hurt :)

Upon tearing it open the first thing I noticed was the large amount of manual adjustment pots. Most of the higher priced LCR meters have a bit more of software calibration in them and don't have near as many pots as this one has.

There isn't a whole lot of protection circuitry; just some clamping diodes and a single varistor.... so don't be hooking up large voltages to this meter or smoke will come billowing out.

Not a lot to it, just a lot of passives, Analog Switches and Mux ICs. All the magic is under that epoxy blob, which is probably the Micro with internal ADC.

Now that I am armed with an LCR Meter hopefully I'll get that Oscillator up and running soon........