Author Topic: OPAMP following a square wave  (Read 3372 times)

0 Members and 1 Guest are viewing this topic.

Offline AeternamTopic starter

  • Supporter
  • ****
  • Posts: 97
  • Country: lu
    • Schartz Engineering
OPAMP following a square wave
« on: March 10, 2016, 12:13:21 pm »
Hey gang,

I have an LM324 configured as voltage follower. It is hooked up to a DAC through a voltage divider, the DAC is generating a square wave of 0 - 5V (see schematic). I hooked up my scope to this circuit to see how fast the OPAMP would react to a change on its positive input. Which is where I found something strange :)

The first screenshot shows the OPAMP doing its deed to ramp up the output. It's not perfectly following the input signal but I guess it's doing an OK job.

The second screenshot shows what's happening when the positive input falls from 0.33 to 0V. I don't understand where those ripples come from? As you can see on the 3rd screenshot they start way before the input starts falling off, so I suppose the DAC is not at fault.

I should probably mention that there are a few other components on the same breadboard (7812, 7805, another LM324, a LED, a few caps). Oh and the other 3 OPAMPs on the IC are properly terminated.

What the hell is going on here?
 

Offline RobK_NL

  • Frequent Contributor
  • **
  • Posts: 250
  • Country: nl
Re: OPAMP following a square wave
« Reply #1 on: March 10, 2016, 12:52:40 pm »
What the hell is going on here?
From the fact that those "ripples" appear just before the transition, it is almost certainly the DAC's digital input coupling into your analog output.
Tell us what problem you want to solve, not what solution you're having problems with
 

Offline kg4arn

  • Supporter
  • ****
  • Posts: 271
  • Country: us
Re: OPAMP following a square wave
« Reply #2 on: March 10, 2016, 01:16:48 pm »
Try probing the op amp output with the 10x setting on the probe with a 4.7 or 10K resistor in series between the output and the probe. If you are placing the probe directly on the output pin, the probe capacitance may be causing the loop to oscillate especially on the 1x setting where the capacitance is much greater. Just a thought.
 

Offline idpromnut

  • Supporter
  • ****
  • Posts: 613
  • Country: ca
Re: OPAMP following a square wave
« Reply #3 on: March 10, 2016, 01:21:25 pm »
Gentlemen, check your decoupling, something suspicious is going on there ;)
 

Offline AndersJ

  • Frequent Contributor
  • **
  • Posts: 406
  • Country: se
Re: OPAMP following a square wave
« Reply #4 on: March 10, 2016, 01:26:53 pm »
Your decoupling capacitor needs to be connected properly.
The op-amp works near ground, but not AT ground level.
The DAC needs to be grounded.
"It should work"
R.N.Naidoo
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21609
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: OPAMP following a square wave
« Reply #5 on: March 10, 2016, 02:35:45 pm »
Put a small capacitor from +in to GND, and probably assorted other filtering.  Most importantly is the kind of filtering that can't be expressed on the schematic. If you have digital switching currents flowing around the LM324, it will pick those up.

Shitty bipolar amps like LM324 don't respond to high frequency signals, proportionally; rather, they rectify them into an offset.  Anything from 10 to 1000 MHz will do.  You can very easily get signals in that range, which are beyond your scope's capability to see, with readily available digital ICs.

You should also have a pre-load resistor from OUT to GND, about 1-10k.  This will keep the output in class A operation, at least for some of its range.  LM324 is about the worst thing you can attach to a DAC -- unless you have good reason to shave every cent and have no need for a nice voltage output. :)

Tim
« Last Edit: March 10, 2016, 02:37:20 pm by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: OPAMP following a square wave
« Reply #6 on: March 10, 2016, 02:39:44 pm »
The LM324 is unity gain stable at low C loads. See attached response for C = 0
and C = 50 pF. Note the 50 pF load chart shows reduced phase margin, eg. stability.



The V divider, very high Z elements ? Like in the 100K ohms + element values ?
If so you can get stray pickup other signals in your lab.

The second pic, I take it green is output of LM324, violet the input to 324. A 324
should not show that kind of ripple. It does have a slew rate of ~ .5 V/uS so that
limits its step response significantly.

Bypassing critical, supply pins should have a .01 and .1 uF ceramic on them, as
well as a suitable bulk, like tantalum. Figure the tant size based on load driving
impedance and I = C x dV/dT, or C = (I x dT) / dV, what is the droop you want
to live with on supply pin...

Pay attention to any ground loops. That adds L to the ground path, and could be
the cause of unexpected ripple. Grounds, analog, should be single point grounding
system where possible.

Some ap notes on noise -

https://www.dropbox.com/s/2h96beh1fbvz4e2/noise_notes.zip?dl=0

https://www.dropbox.com/s/ruaf9booe17jk8n/PCB%20Layout.zip?dl=0


Regards, Dana.

« Last Edit: March 10, 2016, 02:59:32 pm by danadak »
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline Audioguru

  • Super Contributor
  • ***
  • Posts: 1507
  • Country: ca
Re: OPAMP following a square wave
« Reply #7 on: March 10, 2016, 04:53:24 pm »
EVERY time somebody asks what causes his circuit to make weird output signals it was wired on a solderless breadboard with intermittent contacts and stray coupling caused by its many rows of contacts and long jumper wires all over the place. Frequently its rows and jumpers are antennas that pickup all kinds of external interference. Use a pcb instead.
 

Offline suicidaleggroll

  • Super Contributor
  • ***
  • Posts: 1453
  • Country: us
Re: OPAMP following a square wave
« Reply #8 on: March 10, 2016, 04:59:05 pm »
You only have one wire coming from your DAC in that schematic.  Where is its ground reference?
Your decoupling of the op-amp is also quite...interesting.  Your cap needs to run between V+ and V-, as you've drawn it those caps are doing absolutely nothing.
 

Offline AeternamTopic starter

  • Supporter
  • ****
  • Posts: 97
  • Country: lu
    • Schartz Engineering
Re: OPAMP following a square wave
« Reply #9 on: March 10, 2016, 04:59:41 pm »
You guys are the best, thank you  :D

I will check out the different pointers and report back on what I found  :-+
 

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 19281
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: OPAMP following a square wave
« Reply #10 on: March 10, 2016, 05:37:44 pm »
EVERY time somebody asks what causes his circuit to make weird output signals it was wired on a solderless breadboard with intermittent contacts and stray coupling caused by its many rows of contacts and long jumper wires all over the place. Frequently its rows and jumpers are antennas that pickup all kinds of external interference. Use a pcb instead.

Yes, indeed, breadboards are the spawn of the devil.

But there are perfectly satisfactory halfway houses that work up to UHF. Dead-bug and manhattan techniques spring to mind.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline alsetalokin4017

  • Super Contributor
  • ***
  • Posts: 2055
  • Country: us
Re: OPAMP following a square wave
« Reply #11 on: March 10, 2016, 07:27:01 pm »
Try as I might, I can't seem to reproduce the OP's problem. I am getting relatively clean and accurate output signals. I get a single switching transient on LE and TE but nothing like the oscillations and wobbly ramp that Aeternam is getting.

I am using:
A breadboard
A KA324 (unfortunately no LM324 in my stash)
Metal-film resistors
A cheapo DDS FG to produce a 0-5V square pulse train at 1 kHz with 50 percent duty cycle (this produces a much higher slew rate for the input signal but the output signal has a slower slew rate of course)

I have tried:
unused outputs/inputs floating
100nF directly between pins 4 and 11 of the LM324 or no decoupling
1x or 10x probe attenuation
different frequencies
The easiest person to fool is yourself. -- Richard Feynman
 

Offline AeternamTopic starter

  • Supporter
  • ****
  • Posts: 97
  • Country: lu
    • Schartz Engineering
Re: OPAMP following a square wave
« Reply #12 on: March 10, 2016, 10:41:38 pm »
Ok so I dug a bit deeper and found that the LM324 is not to blame. It's the DAC >:D

Its output is picking up the clock signal from the I2C bus used to control it -- which explains why the signal deteriorates just before the DAC drops the voltage. I haven't found a way around this yet. The DAC is on a breakout board (the one from Adafruit) so my hands are a bit tied there.

Anyways. Reducing the voltage by an order of magnitude (down to 47k/3.3K) seems to reduce the amount of pickup considerably. I'm not sure why that is, anyone willing to give me a pointer to the mechanics at work here?

After reading your posts it looks like it would be a prudent approach to reconsider my decouplings :) But that will be for tomorrow, I'm turning in now.

Thanks again for all the help, much appreciated.
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: OPAMP following a square wave
« Reply #13 on: March 10, 2016, 11:01:36 pm »
You could always implement a S/H timed to hold the DAC value
after its settled. Or use a LPF after DAC. All of course have timing
issues, whose significance depends on your sampling rate.

Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline uncle_bob

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: OPAMP following a square wave
« Reply #14 on: March 11, 2016, 12:36:41 am »
Hi

If you want clean signals, start with the ground. You need a nice copper sheet or something similar to tie everything down to. Any part more than 1/4" off of that sheet does not count as "grounded". The digital stuff needs to be *much* closer to ground. The digital edges are likely fast enough that 0.01" (no not a typo) is a good guideline for both the ground pins and the high speed conductors spacing off ground.

Yes, you *can* back off of that a bit. A few years experience and a  couple years at school will let you figure out when.

===

Now that the ground at least has a chance of being quiet, you need good supply rails. That involves bypassing each supply pin to ground at the IC with at least 0.1 uf. It also means "bulk bypassing" that is appropriate to what you are doing. For analog, start with 10 uF of ceramic or tantalum and another few hundred uF of electrolytic. That bypassing goes on each rail and it all ties to your ground sheet. Can you back off? Sure, after a few years and some courses you will get a pretty good feel on how much you can back off. You may also find that the guidelines above are not enough for what you are trying to do.

====

At this point you at least are set up to start hooking up parts. Solder a few down and check things out. Solder a few more and check them. Don't try to do it all at once. Doing this on a plugin breadboard is fine as long as you accept that there will be noise all over the place. You have to do it another way to keep things quiet.

Yes, you could lay out a pc board for your "gizmo". It normally is easier to womp up a circuit point to point than laying out a board. If you do a board, all the same rules apply.

Bob
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf