little spikes on the output of triangle to sine converter - Page 1
Forum section: electronics / beginners

author: dentaku
author_rank: Frequent Contributor
timestamp: April 05, 2017, 11:33:50 pm
content: I've noticed this sort of artifact in the past, probably while using an opamp integrator circuit but I just built a single supply 5V version of this circuit and saw similar little spikes half way up the waveform of the output of this triangle to sine converter.https://www.eevblog.com/forum/projects/function-generator-ics/?action=dlattach;attach=15848;imageIt works fine with certain better opamps like the MCP6002 and the LT1630 but it gets all weird with a basic LM358. If I was powering it from a +/- supply I would just use a TL072 but that's not useful for a single 5V supply.What is it about opamps like the LM358 that do this?Here's an example of the LT1630 and the LM358.

author: BrianHG
author_rank: Super Contributor
timestamp: April 05, 2017, 11:36:34 pm
content: The LM358 opamp has a class B output stage. You are looking at cross-over distortion. You might be able to fix this with a pull-down resistor to -vee right at the op-amp output pin and negative supply. Try a 10k, or 4.7k, or 2.2k depending on your supply voltage. This will force the output stage to use only 1 side of the transistor drivers making it a class A output. Depending on your output load conditions, this still may not work, or, just move the location of those spikes to a different location on the sine wave.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 05, 2017, 11:38:51 pm
content: https://www.eevblog.com/forum/beginners/strange-kink-in-non-inverting-op-amp-signal/Also, if that's an integrator, then it's not a triangle-to-sine converter, it's a triangle-to-piecewise-parabola converter. For the same reason the integrator is a square-to-triangle converter (constant to linear, linear to quadratic, etc. to etc.), and to precisely the same extent that a triangle is "more sinusoidal", but also most definitely not a sine wave, compared to the square wave.Tim

author: dentaku
author_rank: Frequent Contributor
timestamp: April 05, 2017, 11:52:43 pm
content: Quote from: BrianHG on April 05, 2017, 11:36:34 pmInteresting.It removed all the messy stuff at the bottom of the waveform but the little spikes half way up are still there.I'm going to read about crossover distortion now I guess.

author: dentaku
author_rank: Frequent Contributor
timestamp: April 05, 2017, 11:57:55 pm
content: Quote from: T3sl4co1l on April 05, 2017, 11:38:51 pmI just mean that I think I saw it in the past while messing with an integrator circuit, and yes, I was making a simple square to triangle converter at the time.It doesn't matter if the output isn't perfectly sinusoidal because the stuff I work on only has to sound right. I'm not building a function generator

author: BrianHG
author_rank: Super Contributor
timestamp: April 06, 2017, 12:11:22 am
content: This video should illustrate:https://youtu.be/VgodYtiD_F0

author: BrianHG
author_rank: Super Contributor
timestamp: April 06, 2017, 12:16:56 am
content: Note that if you are using multiple LM358 amps, each one needs the pull-down resistor...

author: dentaku
author_rank: Frequent Contributor
timestamp: April 06, 2017, 12:47:03 am
content: I love Alan's videosI actually WAS using the other half of the opamp so now that I've taken that into account I've managed to move the distortion down below the bottom of my output waveform and the little spikes are gone.

author: Audioguru
author_rank: Super Contributor
timestamp: April 06, 2017, 03:55:29 am
content: The LM358 is not good for anything. In addition to its crossover distortion, it is noisy and it has problems with high level frequencies above only 2kHz.An OPA134 single, OPA2134 dual and OPA4134 quad opamp work fine with a single +5V supply, have very low distortion, low noise and work fine up to 200kHz at high levels.

author: Zero999
author_rank: Super Contributor
timestamp: April 06, 2017, 07:41:54 am
content: Quote from: Audioguru on April 06, 2017, 03:55:29 amThat's a bit of a sweeping statement. Although there are much better op-amps available, the LM358 is cheap, widely available and is more than good enough for plenty of applications, such as amplifying DC voltages.Quote from: dentaku on April 06, 2017, 12:47:03 amWhich circuit did you use to generate the triangle wave?

author: capt bullshot
author_rank: Super Contributor
timestamp: April 06, 2017, 09:20:10 am
content: Quote from: Audioguru on April 06, 2017, 03:55:29 amAccording to Bob Pease, the LM358 is a lousy amplifier (lousy is a correct technical term)And yes, it's dead cheap, widely available and useful for many applications if you know about its issues (as pointed out above)

author: MrAl
author_rank: Super Contributor
timestamp: April 07, 2017, 12:53:53 am
content: Hi,Yeah that is crossover distortion. As someone said, if you bias the output with a resistor you can force the op amp to never cross over so you wont see that anymore if done right.A lot of people dont like the LM358 but i've used it so many times for so many things i cant see not having it. It's relatively slow and a little noisy, but hey if it works in an application then why argue :-)That's the main point about ANY part, does it work in the app or not. If it does, then you're all set.

author: David Hess
author_rank: Super Contributor
timestamp: April 08, 2017, 10:34:38 pm
content: As others said, the spikes at the zero crossings are crossover distortion. You could use an LT1013 to replace the LM358 to get rid of those.The distortion at the bottom looks like saturation of the LM358 output as it approaches ground. The LM358 outputs cannot sink current all the way to ground. Again, the LT1013 is better for this but better yet is to modify the circuit to solve this because all operational amplifier outputs suffer from this to one extent or another.

author: Cerebus
author_rank: Super Contributor
timestamp: April 09, 2017, 01:42:52 am
content: Quote from: Audioguru on April 06, 2017, 03:55:29 amUsed in the right place there's nothing wrong with an LM358, you just have to know what's the right place. I've got a little thermal chamber sitting being prototyped on the bench at the moment and an LM358 is doing a fine job of keeping that at a steady temperature to well within 0.1 degrees C (and probably better).In small quantities an LM358 costs £0.10, an OPA2134 £2.62. Use an OPA2134 where an LM358 would have done the job and you've just spaffed £2.50. Use an OPA134 (£1.80) with it's 2mV input offset where you should have used a £1.35 OP177 with its 20uV input offset and you've spaffed £0.45 and buggered up the DC characteristics of your circuit. Horses for courses - pick an appropriate amp for the circuit in hand, not something grossly overspecified in one direction and even possibly underspecified in another.A JFET input op amp, as you've suggested, would be a poor choice in the OP's circuit as the circuit has a source impedance of under 2k - no need to scrabble for low bias current here - and you'd smother the inherent 5nV/sqrt(Hz) voltage noise of the source resistance with the 8nV/sqrt(Hz) of the OPAx134, worse if you're below the amp's 100Hz 1/f noise corner (if noise that low is really a consideration here and I suspect it's not even on the table). The LT1630 that he's tried as an alternative is a mid-spec bipolar op amp and seems, on its specifications, like a very good fit for the circuit at hand, in particular the noise spec at 6nV/sqrt(Hz) (1/f noise corner at 8Hz) is an almost perfect match to the source impedance and obviously works well in practice. (I won't bore everybody further by doing the number for current noise.)And I have no idea where you get the idea that an LM358 doesn't work at "high level frequencies above only 2kHz". It's got a typical gain bandwidth product of 1.1 MHz, and a slew rate of 600kV/s from which it's easy to calculate that it's got a typical full power bandwidth of 13.6kHz at 20V ptp. I have a receiver I made for a wireless chest heart rate strap that works at 5.6kHz constructed out of LM358s, an NE567 tone detector and an Arduino nano all running at 5V and I've hundreds of hours of exercise logs to show that it works just fine.From the particular amps you've listed, what I suspect you do is carry around a list of known good 'audio' amps in your head and reject anything that's not on your favoured list. It's a bit like the old saw about when you only have a hammer, everything looks like a nail. Yes, in the wrong place the LM358 is a horrible little amp and I wouldn't stick it in an audio signal path anywhere expect possibly in a telephone, but that doesn't mean it's "not good for anything" as you stated, I've cited two places I've used it where it has behaved impeccably.

author: dentaku
author_rank: Frequent Contributor
timestamp: April 09, 2017, 01:58:07 am
content: The LT1630 was just what I happened to have on my desk in an 8 pin DIP too. It was also free but I wouldn't normally use a $3.50 opamp unless I absolutely had tooThis circuit also worked well with a few cent MCP6002 but since it's only a 5v part it's not as useful to me. Most analogue synth circuits are 12v.

author: Cubrilo
author_rank: Newbie
timestamp: October 09, 2017, 09:36:15 am
content: Quote from: Cerebus on April 09, 2017, 01:42:52 amCan you please be more specific on this? I got the same experience as Audioguru that about 4kHz LM358 could not achieve closed-loop gain of 20, in contrast to datasheet specifications.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: October 09, 2017, 11:58:53 am
content: It is quite slow, yes. If you stay within slew rate limit (it's a nonlinear process, like clipping), then the bandwidth is given by fT / gain.Tim

author: Cerebus
author_rank: Super Contributor
timestamp: October 09, 2017, 03:55:19 pm
content: Quote from: Cubrilo on October 09, 2017, 09:36:15 amIs that a nice 4kHz sine wave, or something with much higher harmonics like a square wave? Where did you get your LM358s from, somewhere reputable or from China via ebay (i.e. do you know that they were LM358s or just some random OPA with blacktopping and relabelling*)? Were you pushing the envelope somewhere else, like operating with a common mode voltage near either of the rails, or driving a significant load (not ignoring the feedback path's contribution to said load)?* I know, why would someone bother with a cheap part like an LM358? Yet they do, I've got a handful of equally cheap TL072's here that are obvious counterfeits.

author: Cubrilo
author_rank: Newbie
timestamp: October 10, 2017, 05:54:04 am
content: Thank you Cerebus, you restored my faith in analog electronics!I attached 5 kHz G=18 response from LM358 made on a separate test setup. The output (Ch2) is properly amplified, there is slight phase delay but that's expected. So the problem was not LM358 itself but my circuit design.Thanks again!