Go Down

Topic: Operational Amplifiers tutorial: comments and questions here please (Read 780 times) previous topic - next topic

johnerrington

Comments questions and feedback on my "op amps tutorial"
I'm trying to help. If I find your question interesting I'll give you karma. If you find my input useful please give me karma (I need it)

Robin2

I'm deliberately breaching your request for comments by PM.

IMHO comments here will be more effective as everyone will be able to read all the comments.

At some time in the near future when you consider that you have had all the useful comments I suggest you then create another Thread with the final version of the Tutorial and (perhaps) ask the Moderators to lock this one.

I am not competent about OP amps so please see my following comments in that light.

The first thing that strikes me is that there is no mention of the amplifiers included in most Atmega and Attiny microprocessors (but not, alas, in the Atmega 328). Using an internal amplifier would seem to be much the easiest solution for the less experienced and I reckon that option should be explored first.


It may be useful to consider who is the target audience for your Tutorial - is it a complete newbie, or someone familiar with programming but not with external circuits, or who?

I think if this was my tutorial I would provide some example circuits (and code) with a specific op-amp connected to an Arduino board.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

johnerrington

Thanks Robin. I checked the data sheet for the atmega2560, and 32U4. Yes its true they include a differential amplifier with programmable gain, so I'll be sure to mention that.
However they dont offer the flexibility in setting gain or offset that an external op amp can provide.

Quote
I think if this was my tutorial I would provide some example circuits (and code) with a specific op-amp connected to an Arduino board.
I'll have a look at that, it does need a "bridge" to establish the relevance of the circuits to an Arduino-er.
Measuring a small voltage from a high impedance source would be appropriate and might also tie in with the
Quote
amplifiers included in most Atmega and Attiny microprocessors
if anyone can think of a PRACTICAL example.

Another example would be filtering and buffering a PWM signal to make a DAC; but it needs higher frequency PWM than standard, so makes the code a bit more complicated (direct access to registers).

I'm trying to help. If I find your question interesting I'll give you karma. If you find my input useful please give me karma (I need it)

Robin2

However they dont offer the flexibility in setting gain or offset that an external op amp can provide.
Agreed. But I suspect they will be useful for very many situations. Don't let the "best" be the enemy of the "good"

Quote
if anyone can think of a PRACTICAL example.
If they are hard to come by it puts the whole Tutorial into question :)

Quote
Another example would be filtering and buffering a PWM signal to make a DAC; but it needs higher frequency PWM than standard, so makes the code a bit more complicated (direct access to registers).
Again I suggest you consider your target market carefully. That might be better in a separate Tutorial.

I have recently come across a library which IMHO has undermined its own usefulness by being extended to cover too many things and becoming overly complex.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

MarkT

You should include some audio opamps in the list, both old style and newer rail-to-rail designs,
basically chips with low distortion, unity-gain stable and low noise.

NE5532 springs to mind, the newer LM4562, and for low voltage rail to rail the OPA2134 perhaps.
I've used the 5V CMOS AD8656 which is audio quality and can drive headphones directly (slightly
higher noise than some though).

Explain that for low distortion across the audio bandwidth the gain-bandwidth product needs to be in
the tens of MHz (this confuses many as they don't realize that is traded for linearity).
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

MarkT

I'd also suggest losing the comparator circuit entirely - many opamps cannot be used as comparators, and make
very poor comparators compared to even the lowly LM339.  For instance most audio opamps have back-to-back
diodes across the inputs to protect the input transistors from transients demolishing their noise performance.

Using the wrong opamp as a comparator may damage the opamp or other parts of the circuit as a result - not a good experience for a beginner...

Suggest using a comparator chip for a comparator function...
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

johnerrington

Thanks for your useful feedback MarkT much appreciated.

#10 the ne5532 is already in the list; however the others you suggest dont appear to be readily available - if at all - in a package suitable for breadboarding, which was one of my criteria.

Quote
Explain that for low distortion across the audio bandwidth the gain-bandwidth product needs to be in the tens of MHz (this confuses many as they don't realize that is traded for linearity).
I'll edit #5 in the final version to include that issue - thanks.

#11
Quote
Suggest using a comparator chip for a comparator function...
well its been in and out Mark - and back in because its kind of a bridge between the bits either side.

Quote
Comparators are an important part of an ADC converter.  For many reasons op amps dont make great comparators, and its better where possible to use a purpose built comparator.
Quote
For instance most audio opamps have back-to-back
diodes across the inputs to protect the input transistors from transients demolishing their noise performance.
I checked the data sheet for the LM4562 (which I may well add to my list ) but could not find any reference to input protection. Do you mean transients outside their CM range or supply range?
I'm trying to help. If I find your question interesting I'll give you karma. If you find my input useful please give me karma (I need it)

Robin2

Referring to Reply #13 ...

The circuit is nice and simple but I really have no idea what this means
Quote
but this circuit uses the "short circuit current" - so the voltage across the device needs to be kept at zero.
I am not trying to say that the English is faulty  - I'm saying that it is beyond my present technical knowledge. And as I am not sure what sorts of people the Tutorial is aimed at I don't know whether what is written is sufficient or not.

Regarding this code
Code: [Select]
uAmps = (mVolts * 1000 ) / rFeedback;
would it be safer to define uAmps as a long?

...R


Two or three hours spent thinking and reading documentation solves most programming problems.

johnerrington

Thanks Robin, yes, a good point I've changed it in the code.

Quote
There are different ways of detecting this, and you CAN measure the voltage generated; but this circuit uses the "short circuit current" - so the voltage across the device needs to be kept at zero.
Without getting technical about the operation of a photodiode I think it would be difficult to explain further. Basically, if the photo current flows through a resistor a voltage is developed producing a potential across the junction that opposes the carrier movement and reduces the current.
Photodiodes are mostly used in photocurrent mode - where the terminals are effectively short-circuited and the short circuit current measured; or in photovoltaic mode where the terminals are effectively open-circuit and the voltage measured with a high impedance voltmeter.
I'm trying to help. If I find your question interesting I'll give you karma. If you find my input useful please give me karma (I need it)

MarkT

I checked the data sheet for the LM4562 (which I may well add to my list ) but could not find any reference to input protection. Do you mean transients outside their CM range or supply range?
Transients in differential mode.

Low noise bipolar opamps need the diodes to prevent transients destroying the noise performance of
the input stage - reverse breakdown of emitter-base junction in a low noise transistor causes injection
of defect sites into the junction leading to both temperary and permanent increase in voltage noise
(1/f and popcorn noise are mainly due to defects)

If you measure the LM4562 in this circuit you'll see about 800mV between inputs:


Which didn't surprize me when I measured it - the high diode forward voltage suggests the
protection diodes are very small (and thus easily damaged if you did try to use this device as
a comparator).


[ PS Here's a paper, see page 32 about reverse breakdown degradation: https://www.uio.no/studier/emner/matnat/ifi/INF5460/h16/undervisningsmateriale/f8-1p.pdf ]
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

johnerrington

Thanks Mark - very interesting. None of the IC's I have tested have that feature so it must just be audio amps. It would prevent some of the applications eg sine or triangle oscillator from functioning properly.
I'm trying to help. If I find your question interesting I'll give you karma. If you find my input useful please give me karma (I need it)

Robin2

Without getting technical about the operation of a photodiode I think it would be difficult to explain further.
If your target audience is a person with my limited knowledge then maybe the photodiode is too complex to use as an example.

When I think about all of this, including @MarkT's comments it makes me wonder if the whole thing is too technical for this Forum. I imagine there are many other websites where someone can learn about OP amps. (Sorry, I do realise this is a rather negative comment).

In an effort to be positive may I suggest you change the whole thrust of this Tutorial so it just explains how to use the amplifiers within the Atmega chips. To my mind that would be a useful addition for the Forum.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

MarkT

Thanks Mark - very interesting. None of the IC's I have tested have that feature so it must just be audio amps. It would prevent some of the applications eg sine or triangle oscillator from functioning properly.
Its ultra low noise BJTs that need the protection to meet their specifications.  Many other opamps pull
significant input currents when the inputs are more than about 5V apart due to protection components -
an opamp is not a comparator(*), that's the point, they expect to operate with the inputs at the same voltage due to negative feedback.  Some opamps have phase-reversal when the inputs
are near the rails, which again plays havoc if used as a comparator.  Its best to advise people to
use a comparator when comparing voltages and an opamp for feedback amplifiers / integrators etc.

Another issue with opamps is the outputs often slew too slowly to drive a logic input reliably - logic inputs
have a minimum required slew-rate for glitch-free operation (well actually its really a decrease in noise
immunity as slew rate decreases).  For instance the MCP6002 output takes a whole 10┬Ás to slew 5V,
whereas most CMOS logic transitions are around 5ns or so...  Even the lowly LM339 can slew about 200 times
faster than the MCP6002.

(*) comparators normally have low input current across the full differential voltage swing, so don't disturb the
circuit they are monitoring.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

johnerrington

Quote
Some opamps have phase-reversal when the inputs
are near the rails,
yes I've seen that in the data sheets and observed it on test.

On balance I think it would get too complicated to explain and detract from the thread, so I guess the comparator is out again - and staying out.
I'm trying to help. If I find your question interesting I'll give you karma. If you find my input useful please give me karma (I need it)

Robin2

On balance I think it would get too complicated to explain and detract from the thread, so I guess the comparator is out again - and staying out.
Even the Atmega 328 has an internal comparator.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up