Monday, 22 October 2012

AD9835 Amplifier Stage

In the previous post I talked about Operational Amplifiers.  I'm going to use one to amplify the output of the AD9835 breakout board after the filtering stage.  For this circuit it doesn't matter whether I use an inverting or a non inverting amplifier so I'm going to use an inverting amplifier just because.  I may change my mind later.

Because I want my signal generator to work from 1Hz up to at least 10MHz I need an Op amp with at least 20MHz bandwidth and a fast slew rate.  I also need an amplifier that works with a +/- 5V supply and doesn't use too much current.  I have decided to use an LM6171BIN.  Here is the datasheet:

http://www.ti.com/lit/ds/symlink/lm6171.pdf

I've chosen this op-amp because I had a spice simulation model for it!  No, only joking I chose this op-amp having simulated a circuit and then looked for devices that had the characteristics I required:

I needed a device which has the following specifications:

Bandwidth of at least 20MHz....more would be better
High amplification
Rail to Rail Operation (Requires a positive and negative supply)
Good common mode rejection ratio - It has the ability to reject signals which appear on both inputs at the same time.
Low Power - always a nice feature.
Fast slew rate - the device can react to fast rise and fall times without distortion
Low distortion - The signal at the output looks exactly the same as at the input when the device is used within specification.
Reasonable cost - Op-amps like any integrated circuit can be very expensive - choose one that meets your design requirements but doesn't break the bank.  There is always a cheap alternative if you look hard enough!
DIP package if possible because I hate soldering surface mount packages!

I did a parametric search for devices with most of the above specifications on Farnell's website:

www.uk.farnell.com

This is what popped:


I then decided to use the LM6171 - It fits all the requirements and I have a spice model for it so I can simulate the circuit.  After I've got my simulation working I'll buy some and make a simple PCB to prove the concept.

Let's draw the schematic:

The signal input to the op-amp from the filter stage should be around 1V so I've placed a 1V signal source at the input.  I want the amplifier to have variable gain so I can turn the output up and down when using the signal generator so I have made the feedback resistor R2 a 4.7k potentiometer.

Lets do the mathematics and check out what gain this circuit should give:

Av (Gain) = - R2 / R1   -  (R2 should really be labelled Rf for the feedback resistor!)

Av (Gain) = 4.7k / 1k

Av (Gain = 4.7

So this circuit should make the output signal 4.7x bigger than the input.  Lets simulate and see what happens!



So having checked the datasheet and my circuit I now know that the output voltage from the AD9835 breakout board is going to be 1.4V Pk-Pk.  Therefore if I'm going to use the above circuit I need to do two things to avoid clipping.  I need to reduce the input signal to less than 1V and if possible to cover all bases I can increase the supply voltages from +/-5V to +/-12V.  Lets redraw the circuit:

I have used a resistor divider to reduce the input signal (820R resistor and 1kR resistor).  This reduces the input signal to a level which doesn't cause the output to be clipped ever.  Increasing the supply voltage also helps as it gives me more gain and ensures that the op-amp is always used within it's operating parameters.  Having the output close the rails causes the op-amp output to be distorted and is bad practice.  I'm not going to bother re-simulating the above circuit - take my word for it...its ok!

I now need to add this circuit to the filter circuit from a previous post, I'm also going to add supply decoupling capacitors as.....I tried this circuit already and a low frequencies at the input there wasn't an issue but at high frequencies there was distortion of the signal and problems with spurious oscillations....A friend at the hackspace then suggested I read the datasheet and added some decoupling capacitors to the supply pins....It was in the datasheet to do this and he was correct, Well done Ben!  It goes to show that design is much easier when you collaborate with someone else!

Here is the full circuit diagram so far:


I've added some extra components.  Lets start from the left to right to make things easier.  On the very left of the diagram is the input connector JP1 which then connects to 2x 150R resistors.  These resistors provide 300R impedance matching to ensure that the output from the AD9835 is correctly matched (Impedance matching is for another post really).  The next section is the Low pass Chebychev filter that I discussed in a previous post.  After the filter we have the voltage divider made up of the 820R resistor and the 1k resistor to reduce the input signal so we don't overdrive the op-amp.  I've also added a 10uF electrolyitic capacitor to remove any DC current that might be present in our signal.  After the capacitor the signal is input into the Op-Amp which is configured in inverting mode providing a gain 4.7.  I've also added some supply decoupling with 2x 100nF and 1uF capacitors and a 2.2pF feedback capacitor as it was specified in the datasheet and helps with the op-amp operation.  Finally at the output I've added two 100R resistors to provide 50R impedance matching at the output.

That's about it for now....Next post will talk about converting the sine wave to a square wave and then I might just build all of this on a PCB and lets see how well it all works!  Then all we have to do is design the control section and we are well on the way to having a signal generator!

Cheers for now - Alex