Op amp not working out as planned - Page 1
Forum section: electronics / beginners

author: netdudeuk
author_rank: Frequent Contributor
timestamp: March 04, 2018, 06:31:04 pm
content: HiI've got a AD9833 DDS Signal Generator Module sending out a 1KHz sine wave. I'm supposed to be amplifying it with a NJM5532 op amp (https://www.njr.com/semicon/PDF/NJM5532_E.pdf) running from the same 5v rail. However, the output looks poor, being clipped and with ringing.Here's how I have the op amp configured.Any idea why the output signal looks so bad and why the gain isn't -10 ?Thanks

author: Andy Watson
author_rank: Super Contributor
timestamp: March 04, 2018, 06:44:05 pm
content: Quote from: netdudeuk on March 04, 2018, 06:31:04 pmJust the one supply ?You will need both positive and negative power supplies to use any op-amp in that configuration. Also, the NE5532/34 requires a lot of headroom - If you have +5 and -5V supplies, the chip will only work properly with a signal within the range +3 to -3 (I think - look at the "common mode" range on the datasheet).

author: netdudeuk
author_rank: Frequent Contributor
timestamp: March 04, 2018, 07:00:30 pm
content: HiThanks for the prompt reply.Yes, I'm using a single 5v supply.I was taking the design from here but without wanting to add the offset voltage -https://youtu.be/ts-JqEVzvDo?t=6m35sHe looks to be using a single supply rail here -https://youtu.be/ts-JqEVzvDo?t=7m44sHe also uses a capacitor in the feedback loop which I don't have.

author: Mechatrommer
author_rank: Super Contributor
timestamp: March 04, 2018, 07:25:45 pm
content: Quote from: netdudeuk on March 04, 2018, 07:00:30 pmthat is used for audio amplification from microphone which usually in 100mV range. multiply by 10 in your application is 1Vpp well within the supply range. your application is 600mV input that is 6Vpp output well outside your supply range, hence the clipping. to avoid clipping you should either reduce your input Vpp or increase the voltage supply range or reduce the opamp gain.

author: Andy Watson
author_rank: Super Contributor
timestamp: March 04, 2018, 07:26:42 pm
content: Quote from: netdudeuk on March 04, 2018, 07:00:30 pmWith a single supply it is not optional - you need to bias the op-amp to around 2.5V - as is shown at approximately 6:45. You will also require the decoupling caps - depending on what you are using as your signal source.

author: rstofer
author_rank: Super Contributor
timestamp: March 04, 2018, 07:31:57 pm
content: You can use a single supply as long as you bias the non-inverting input up to half of the rail voltage. Then capacitively couple your AC signal or feed a signal that is biased up the same as the non-inverting input.Now all you have to worry about is gain and headroom. If you use an op amp that can't pull within 2 volts of the top or bottom supply and you are using a 5V supply, you only have 1V left to work with on the output. Your input needs to be less than 100 mV.

author: mav_iqdirect
author_rank: Contributor
timestamp: March 05, 2018, 10:44:43 am
content: You can use some free circuit simulator (like partsim) to review your schematic. Just build your circuit here and see if it can work at all.

author: Audioguru
author_rank: Super Contributor
timestamp: March 05, 2018, 03:56:03 pm
content: The minimum supply for a 5532 dual opamp is 6V so with only 5V it might not do anything or will work poorly. If the second opamp is not disabled or used properly then it could cause oscillation interference to the first opamp.Of course its input must be biased at half the supply voltage if it has a single positive supply.

author: Zero999
author_rank: Super Contributor
timestamp: March 05, 2018, 04:25:25 pm
content: Yes, the NJM5532 isn't specified to work below a total supply voltage of 6V.You're also exceeding the common mode input voltage range. The NJM5532 is only specified to work when its inputs are within 3V of either voltage rail, worst case, 2V being typical.https://www.njr.com/semicon/PDF/NJM5532_E.pdfYou could try the LM358, but beware it will have crossover distortion, unless its output always either sinks or sources current. A better option is an op-amp designed for 5V operation, with a rail-to-rail output, such as the MCP602.http://ww1.microchip.com/downloads/en/DeviceDoc/21314g.pdf

author: metrologist
author_rank: Super Contributor
timestamp: March 05, 2018, 05:02:16 pm
content: Just because I had this set up already, I modeled this using an LT1078 op amp.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: March 05, 2018, 05:22:57 pm
content: GuysThanks for all the replies.My circuit may not be there yet but I've learned plenty in the meantime.Looking at the schematic though, I'm pretty sure that the Great Scott video used a 5v supply with that op amp.I have some MCP602s so I'll try one of those.

author: Mechatrommer
author_rank: Super Contributor
timestamp: March 05, 2018, 05:36:49 pm
content: Quote from: netdudeuk on March 05, 2018, 05:22:57 pmno opamp in this world can produce 6V from 5V rail, let alone -6V in inverting amp as your setup that i missed to see.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: March 05, 2018, 05:55:40 pm
content: Quote from: Mechatrommer on March 05, 2018, 05:36:49 pmIf I get your meaning, I was just saying that he seems to have used a single 5v supply rail (which, according to Hero999, isn't supported), not that he was getting 6V out.

author: Andy Watson
author_rank: Super Contributor
timestamp: March 05, 2018, 06:16:03 pm
content: Quote from: netdudeuk on March 05, 2018, 05:22:57 pmThose op-amps will be a bit lethargic at 5V - they are not designed for such low supply voltages. Your signal amplitude will be limited - fortunately you do not need much amplitude for a mic signal, but you do need to bias the op-amp into its working range.QuoteI think you are going to half-disappointedConsider applying -100mV to the input and calculate the voltage at the output. Now repeat the exercise with +100mV at the input - it should be obvious why it's not going to work.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: April 04, 2018, 04:42:22 pm
content: HiI've replaced the NJM5532 with a MCP602 (http://ww1.microchip.com/downloads/en/DeviceDoc/21314g.pdf) running at 5V with the non-inverting input biased to 2.5V with two 10k resistors.This is a single rail (2.7V to 6V) device with Rail-to-Rail output.Things seem to look better on the scope. No clipping.I have a 4.7k resistor on the input and a 5.1k resistor in the feedback loop. I was expecting the gain to be 5.1/4.7 = 1.085106382978723I'm assuming that the actual gain is ( Vpp (Output) /2 ) / (Vpp (Input) /2 ) i.e. 360/280 = 1.285714285714286So, theory and practise don't match up. I'm assuming that's it is probably my theory that's not rightWhat's the situation here ?Thanks

author: Wimberleytech
author_rank: Super Contributor
timestamp: April 04, 2018, 05:16:59 pm
content: 1) your average input voltage is about 400mV dc. The NI input of the amp is biased at 2.5Vdc. So your output is close to the positive rail. Is that what you want?2) your resistors are not as precise as your calculator. With 5% tolerance, you are not too far off if the scope is giving you accurate measurements. Why not ac couple the output so that you can display it with the scope 200mV/div like the input? The scope might give a more accurate readout??It is not good engineering to keep all of those extra digits in your calculation. Two significant digits is all you have.

author: Audioguru
author_rank: Super Contributor
timestamp: April 04, 2018, 05:54:36 pm
content: The NJM5532 is a Japanese copy of an American NE5532 so some of them might work when its supply is only 5V instead of the minimum of 6V.If you want everything you make to work perfectly then use the original IC not a copy and use it with a supply voltage that is guaranteed to work.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: April 04, 2018, 06:10:10 pm
content: Quote from: Wimberleytech on April 04, 2018, 05:16:59 pmMy resistors are from China so 5% is being optimisticActually, I measured them previously and got 4.67k and 5.1k.Here's what we have with AC coupling on the output.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: April 04, 2018, 06:11:01 pm
content: Quote from: Audioguru on April 04, 2018, 05:54:36 pmThat's the original IC that I ditched thanks. However, it did come from RS so will be genuine.

author: Wimberleytech
author_rank: Super Contributor
timestamp: April 04, 2018, 08:55:55 pm
content: Quote from: netdudeuk on April 04, 2018, 06:10:10 pmMove your NI voltage from 2.5 to 1.5 and run it again just to see if the distortion goes away

author: StillTrying
author_rank: Super Contributor
timestamp: April 04, 2018, 10:06:20 pm
content: Quote from: netdudeuk on April 04, 2018, 04:42:22 pmBiasing the +Ve input to 2.5V only makes sense if the signal is AC coupled to the 4k7 by adding a cap in series with it, at 100kHz a 0.1uF will do.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: April 05, 2018, 08:36:15 am
content: Thanks for all the replies so far.My original plan was to take the AD9833 DDS Signal Generator module and make a basic lab instrument with it.I believe that I need to boost the output to a more useful level so decided to use an op amp to do that.I'm now using the MCP602 op amp to do that at the moment but I'd probably like to end up with a range up to about 10Vdc. So, that would need a different single supply rail to rail op amp.The has an output frequency range of 0 MHz to 12.5 MHz and I'd want to be able to get all or most of that range out of it.

author: Paul Moir
author_rank: Frequent Contributor
timestamp: April 05, 2018, 08:50:58 am
content: You won't be able to get a 10v signal out of an opamp with a 6v max supply like the MCP602. You would need more than a 10V supply because even "rail to rail" opamps get a little flaky in their performance near their supply rails.Start by making a nice +15v/-15v supply for your opamp and use ones that will work with it. Just an LM7815 + LM7915 will work very well. Then start experimenting with opamps that work within it. Your project is ambitious and it will grow a bit (eg, you'll want an offset control eventually) but you stand to learn quite a lot from it.EDIT: Maybe just a +12v/-12v would be better and give you a wider range of opamps. Other's thoughts?

author: netdudeuk
author_rank: Frequent Contributor
timestamp: April 05, 2018, 09:00:53 am
content: Quote from: Paul Moir on April 05, 2018, 08:50:58 amThanks for the reply.I did mention in the previous post that the MCP602 would be no good for 10V and that I would need a different op amp. Any suggestions please ?I have a DP832 so I could supply the +15V/-15V with no issues although that would be two out of the three rails leaving me with only a 5V rail.Single rail still seems easier, especially as I could get up to 15V from the DP832 as a starting point.Learning is an objective. I've already learned plenty from the project.

author: Zero999
author_rank: Super Contributor
timestamp: April 05, 2018, 10:42:28 am
content: A bipolar power supply is probably easier, as there's no AC coupling to worry about.Start from the beginning.What peak input voltage and output voltages do you require? That will let you work out the gain, required bandwidth and slew rate.What load is this going to be driving? Is it going to be via a long cable? If so, the load impedance, will have to match, the characteristic impedance of the cable.https://en.wikipedia.org/wiki/Characteristic_impedanceGoing from what you've said, you need a fairly fast op-amp. A 12.5MHz sine wave, with a peak voltage of 5V (10V peak to peak) is a slew rate of 392.75V/µs (see link below), and if you want a gain of two, you need a gain bandwidth product of more than double the maximum frequency.http://www.radio-electronics.com/info/circuits/opamp_basics/operational-amplifier-slew-rate.phpI'd suggest a video amplifier IC, as a suitable op-amp won't be cheap. This is not a simple project. Careful attention needs to be given to layout, otherwise there will be problems with instability and oscillation.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: April 05, 2018, 11:10:47 am
content: The AD9833 has a VOUT Maximum of 0.65V and a VOUT Minimum of 38mV.So, that's the peak input voltage.Regarding the peak output voltage, here are the specifications for a branded budget 5MHz arbitrary function generator -2mVpp~10Vpp (50?, ?10MHz)4mVpp~20Vpp (high impedance, ?10MHz)So, maybe something along these lines (Vpp and maximum frequency) looks sensible for my purpose, which is to have a signal generator to experiment with op amps (which I'm now actually doing), filters, etc ?I'll not be putting the signal down long cables.I understand that I'm going to have to put in more volts in if I want more volts out.Thanks

author: StillTrying
author_rank: Super Contributor
timestamp: April 05, 2018, 07:40:58 pm
content: Quote from: netdudeuk on April 05, 2018, 11:10:47 amYep, it outputs a constant amplitude sine, triangle or square. But withonly25M samples per second I think any wave over 1MHz is going to be quite rough, and 12.5MHz not really possible other than just a 12.5MHz square, unless I've missed something!http://www.analog.com/media/en/technical-documentation/data-sheets/AD9833.pdfHave you scoped the AD933's 38-650mV output directly to see what a ~1MHz+ sine, triangle and square look like?I wouldn't know where to go from here in producing a variable amplitude, variable offset output, but you could get the AD9833's output to a 0V centered 1.25Vpp withsomething likethis.

author: Zero999
author_rank: Super Contributor
timestamp: April 05, 2018, 08:02:57 pm
content: Quote from: StillTrying on April 05, 2018, 07:40:58 pmYes you have missed something: an anti-aliasing filter will theoretically give a pure sine wave, right up to half the sampling frequency. In practise, you'll probably be limited to less than half the sample rate, but it should be possible to get a much higher frequency, than 1MHz and still have a decent sine wave.The problem will be the triangle wave and other arbitrary wave shapes, assuming this IC can do that, but I haven't chekted the data sheet.

author: StillTrying
author_rank: Super Contributor
timestamp: April 05, 2018, 08:30:16 pm
content: "The problem will be the triangle wave and other arbitrary wave shapes"It only does fixed amplitude 10 bit sine, triangle, and square, with a 28 bit word to set the frequency.I love the way the data sheet keeps saying "No other components necessary".

author: james_s
author_rank: Super Contributor
timestamp: April 05, 2018, 08:40:50 pm
content: At least to start with use a bipolar supply, you can work on making a single rail version after you have it working properly. Even a pair of 9V batteries can work quite well, op-amps typically draw very little current so you should be able to run it for a long time. Building a simple bench supply is another classic beginner project, it's hard to have too many power supplies.

author: Wimberleytech
author_rank: Super Contributor
timestamp: April 05, 2018, 08:48:02 pm
content: QuoteDid you mean "smoothing filter," and more specifically a "brick wall smoothing filter" would be the only way to get a pure sine up to half the sampling frequency?

author: StillTrying
author_rank: Super Contributor
timestamp: April 06, 2018, 12:43:10 am
content: Here's another +/- 12V version. Simply driving the top end R1 in the above schem. with -1V to +8V allows for the 1.2Vpp output to be offset all -Ve, all +Ve or centered on 0V of course, which looks like that.Amplitude is still fixed at 1.2Vpp, until someone comes up with a good simple idea.LT .asc if someone wants to play with it.

author: Zero999
author_rank: Super Contributor
timestamp: April 06, 2018, 10:57:38 pm
content: Quote from: StillTrying on April 06, 2018, 12:43:10 amUnfortunately the LT1022 is unsuitable for this application. It's over an order of magnitude too slow. Try a faster amplifier such as the AD818.Quote from: netdudeuk on April 05, 2018, 11:10:47 amWhat's your budget?High speed amplifier ICs aren't cheap, especially ones suitable for running off the higher supply voltages required to give 20Vpp. The AD818 I just mentioned above seems to be the best value for money and meets your specification.You'll need an anti-aliasing filter. I think a passive, LRC design might be the best option here, as it's tricky to design an active filter at these frequencies.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: April 26, 2018, 12:16:38 pm
content: Quote from: Hero999 on April 06, 2018, 10:57:38 pmI've ordered a AD818 thanks.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: June 07, 2018, 06:00:30 pm
content: I have the AD818 but TBH, I'm not sure to hook it up for this application.Here's the data sheet -http://www.analog.com/media/en/technical-documentation/data-sheets/AD818.pdfAlso, the data sheet states(gain ≥ 2, or gain ≤ –1). Is this really the limit of how much it can boost the signal from the AD9833 ?Thanks

author: Zero999
author_rank: Super Contributor
timestamp: June 07, 2018, 07:19:31 pm
content: Quote from: netdudeuk on June 07, 2018, 06:00:30 pmNo, those are the minimum gains before it can become unstable and oscillate: ≥ means greater than or equal to and ≤ means less than or equal to.This is very common on faster op-amps. Look at the OP37 datasheet, for example: it says gains >5.http://www.analog.com/media/en/technical-documentation/data-sheets/OP37.pdf

author: jmelson
author_rank: Super Contributor
timestamp: June 07, 2018, 07:23:22 pm
content: Assuming the first scope trace is the output from the DDS chip, that is 600 mV peak to peak. Your resistors program the op amp to have a gain of 11. So, you are expecting to get an output of 6.6 V P-P from a 5V power supply. Clearly, it will HAVE to clip.Jon

author: netdudeuk
author_rank: Frequent Contributor
timestamp: June 08, 2018, 09:27:08 am
content: Quote from: Hero999 on June 07, 2018, 07:19:31 pmThanks. Can I just use this in an inverting amplifier configuration like I did with the previous ones, using the same two resistor calculation to get the desired gain ?

author: Zero999
author_rank: Super Contributor
timestamp: June 08, 2018, 11:14:04 am
content: Quote from: Wimberleytech on April 05, 2018, 08:48:02 pmYes, you're right, I was talking about a brick wall filter, which is the only way to get a sine wave, up to half the sample rate. Unfortunately, it's useless for other wave shapes.Quote from: netdudeuk on June 08, 2018, 09:27:08 amRemind me which resistor values are you planning to use? A few schematics have been posted and I don't know which one you're referring to.That op-amp should be fine for gains greater than 2, as long as the resistor values aren't too high. The bias current of that op-amp is fairly high, so high resistor values will cause it output DC point to drift significantly. High resistor values will also slow it down, as there it will take longer to charge/discharge the parasitic capacitances.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: June 08, 2018, 11:30:12 am
content: Quote from: Hero999 on June 08, 2018, 11:14:04 amThe very first one right at the top of the post.

author: Zero999
author_rank: Super Contributor
timestamp: June 08, 2018, 12:10:23 pm
content: Quote from: netdudeuk on June 08, 2018, 11:30:12 amSo your original schematic?I advise reducing them by a factor of ten: RIN= 1k, RF= 10k.The advice previously given, regarding a dual power supply and output switch is still relevant: a dual 5V or single 10V power supply is essential with 600mVpp in and a gain of 10.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: June 10, 2018, 04:32:50 pm
content: So, no success, with virtually nothing on the output of the op amp.I've checked the wiring several times and it looks ok.RIN = 1k, RF = 10kNon inverting input is biased to 5v5v supply for the DDS and Arduino10v supply for the AD818Common groundWhat could be causing this ?Thanks

author: Audioguru
author_rank: Super Contributor
timestamp: June 10, 2018, 05:03:38 pm
content: You did not use a series input capacitor so its input DC voltage is amplified and causes its output to be close to 0V all the time.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: June 11, 2018, 12:06:52 pm
content: I added a series input capacitor and amended RF to 2K. So, the gain should be 2.However, the scope traces still don't look right (especially as it isn't inverting).Either there is still something wrong with the circuit or I'm measuring it wrong

author: Zero999
author_rank: Super Contributor
timestamp: June 12, 2018, 01:06:24 pm
content: Quote from: netdudeuk on June 11, 2018, 12:06:52 pmThat doesn't look right. Which trace is which? Where is the 'scope's 0V connection going to?Please post a complete schematic and a photograph, showing how it's physically connected up.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: June 12, 2018, 01:12:30 pm
content: Quote from: Hero999 on June 12, 2018, 01:06:24 pmThe yellow trace is connected to the output of the DDS before the series input capacitor. The blue trace is the output of the op amp.So, yes, it doesn't look right.The scope grounds, the ground for the 5 volt supply (Rigol DP832) and the ground for the 10 volt supply (the same DP832) are all connected together.I'll need to get a photo and a schematic later.Thanks

author: netdudeuk
author_rank: Frequent Contributor
timestamp: June 12, 2018, 04:18:17 pm
content: Schematic and setup photos.Thanks

author: Zero999
author_rank: Super Contributor
timestamp: June 13, 2018, 05:43:21 pm
content: Quote from: netdudeuk on June 12, 2018, 04:18:17 pmThat circuit looks fine.Such a high speed op-amp shouldn't be used on breadboard, but it doesn't appear to be oscillating. If all the connections are good, then I'd suspect it's the op-amp. Can you change the op-amp for the TL071 or TL081?If not, you could try the old '741 but the frequency would need to be lowered to 10kHz and a larger DC blocking capacitor used: try 1μF.

author: StillTrying
author_rank: Super Contributor
timestamp: June 13, 2018, 11:10:09 pm
content: The op amp might have more gain if you connected pin 4 to 0V.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: June 18, 2018, 03:33:47 pm
content: Quote from: StillTrying on June 13, 2018, 11:10:09 pmIt is working somewhat better now thanksI wanted to create an adjustable offset on the output so I connected the non inverting input to another rail on my PSU instead of the 5V. The ground for this was connected to all the others.However, if I dialled in anything more than a few hundred mV, I had what I'm guessing we'd describe as unwanted oscillation. The basic sine wave was still there but rather than a line that traced the rise and fall of the signal, think of it as a many columned bar graph where the numbers followed the sine wave. I don't have access to the equipment at the moment but hopefully it is clear what I mean.Why would this be ?Thanks again.

author: StillTrying
author_rank: Super Contributor
timestamp: June 21, 2018, 06:37:54 am
content: With a 100MHz op amp on a bread board with long leads I'm surprised you're getting anything other than oscillation!100nF directly across it's supply pins 4,7, I'd be tempted to solder it on top of the carrier.Replace some of the long breadboard leads with short 1 core wires.Apply the +ve input adjust voltage through a ~4k7 resistor, and with a 100n to 1u cap between the +ve input and 0V. With a gain of -2 the voltage on the +ve input will only be adjustable between about 3V and 8V before the output clips at it's limits.

author: netdudeuk
author_rank: Frequent Contributor
timestamp: April 15, 2019, 04:04:46 pm
content: I've had some time away from this project but I'm back on itI've set up a split rail supply for the op amp along with the 5v for the DDS and microcontroller.There's an analogue ground from the DDS along with the digital one. I guess the former is the right one to use.The question is though, as the DDS and microcontroller have their own common 0v / ground line and the op amp doesn't, how do I connect this side of things to the op amp ? And similarly, the op amp has an output but where's the equivalent 'ground reference' ?I'd like to use the DS1054Z to show me the input and output traces to confirm operation. While the scope ground on the input channel will connect ok to the DDS / microcontroller 'digital ground', I don't want to blow something up but putting the scope ground on the output channel to the wrong potential and cause a short.Please forgive any bad terminology.Thanks

author: rstofer
author_rank: Super Contributor
timestamp: April 15, 2019, 07:45:14 pm
content: Quote from: netdudeuk on April 15, 2019, 04:04:46 pmI haven't kept up the various op amps and power supplies so this may be completely wrong...The center point of your +-15V power supplies is ground. If you ground both op amp inputs to this point, you should measure an output voltage of 0V relative to this ground. In any event, you should have one supply that measures +15V to ground and the other measures -15V to ground. This being the case, the output of the op amp can swing above and below ground. How close the output can get to the rails is a datasheet issue.Your other grounds should connect to this ground reference including your 5V supply, your single ended DDS gadget and your scope ground.With dual supplies it's pretty easy to figure out where ground is. In the case of single supplies, we have to create a virtual ground at 1/2 the rail voltage and somehow connect all the other grounds to that point.