Can somebody explain rail-to-rail input/output?

dwell

pics?
Oct 9, 1999
5,185
2
0

esun

Platinum Member
Nov 12, 2001
2,214
0
0
So normally once the output voltage of an op-amp goes outside a certain range, the gain drops off. Transistors produce maximum gain only when their input and output voltages are at certain values, so op-amps are typically spec'd with input/output voltages that provide this gain.

However, if you are careful about the design you can make it so the gain is high when the output is any voltage between the rails (+supply and -supply voltages). There are always trade-offs involved, though, for example the gain might not be as high as a comparable amplifier with a more limited output range, or the distortion may be worse, etc.

EDIT: Here's a more technical explanation (scroll down to "Rail-to-Rail Output Stage"), but it may not make sense if you don't have a EE background:

http://www.maxim-ic.com/app-notes/index.mvp/id/741
 
Last edited:
May 11, 2008
21,678
1,295
126
The powersupply lines to the operational amplifier are also called rails.
The opamp needs a powersource.

Usually a traditional opamp can because of the limitations of the transistors not have an input voltage range that matches the powersupply. And can also not have an output voltage range that matches the powersupply.

For example, a single supply opamp at 5V may have an input range between GND en 3,5V. or 0,9V and 4,1V. Or an output range between 50mV and 4,1V.

An rail to rail input is an input where the value of the input can be the entire range from for example GND to +5V if the opamp was powerd by a single powersupply from 5V. Gnd means the return path for the current. An opamp has 2 inputs and both are then rail to rail.

An rail to rail output is an output where the value of the output can be the entire range of the power supply. For example GND to +5V.

A rail to rail i/o opamp is an opamp where thus the inputs and the output can swing the full power supply range.

These opamps seem to approach the ideal opamp.
Rail to rail opamps also have drawbacks. Because there is special circuitry in side the opamp that switch the inputs between different internal amplifiers, there is usually 1 point in the input voltage range where a small interference in the output can be seen. But usually this is not an issue. For audio it is better to use a normal opamp and stay between the input and output limits.
 
Last edited:
May 11, 2008
21,678
1,295
126
Forgot to mention the input common mode range, aka ICMR.

This article will explain it :

http://www.eetimes.com/design/analo...lating-your-op-amp-s-input-common-mode-range-

Defining input common-mode range

When speaking of op amp inputs, input common-mode voltage (VICM) is one of the first terms of which an engineer thinks, but may lead to some initial confusion. VICM describes a particular voltage level and is defined as the average voltage at the inverting and non-inverting input pins (Figure 1).

C0769-Figure2.gif


It is commonly expressed as:

VICM = [VIN (+) + VIN (–)]/2.

Another way to think of VICM is that it is the voltage level common to both non-inverting and inverting inputs, VIN (+) and VIN (–). As it turns out, in most applications VIN (+) is very close to VIN (–) because closed-loop negative feedback causes one input pin to closely track the other such that the difference between VIN (+) and VIN (–) is close to zero. T

This is true for many common circuits, including voltage followers, inverting, and non-inverting configurations. In these cases it is commonly assumed that VIN (+) = VIN (–) = VICM, since these voltages are approximately the same.

Another term used to describe op amp inputs is input common-mode range (VICMR), or more correctly input common-mode voltage range. This is the parameter most often used in datasheets and is also the one where circuit designers should be most concerned. VICMR defines a range of common-mode input voltages that results in proper operation of the op amp device, and describes how close the inputs can get to either supply rail.


C0769-Table1.gif
 
Last edited:
May 11, 2008
21,678
1,295
126
For the opamp you linked to, the TS922 :

Vicm Common mode input voltage range VCC- -0.2 to VCC+ +0.2 V
Can be found on page 4 of the datasheet you linked to.
 

dwell

pics?
Oct 9, 1999
5,185
2
0
Good info. Trying to parse through it all so it makes sense. Would I have to adjust any of my designs radically to accommodate vs a normal op amp?

I do pretty basic stuff like non-inverting amplifiers such as:

oGoAa.png


Mainly amplifying AC sources. The reasons I am looking at this op amp is it's low power as I am working with 5v now vs the 9v I am used to. Throwing me off.
 

sm625

Diamond Member
May 6, 2011
8,172
137
106
Just compare the numbers on the data sheet. Vid, Vin, Vicm, Vio, etc. If you have a part that you know works and you want to substitute it with a new part, you have to go through each electrical characteristic and make sure that the difference in specs will not cause you any problems. If you dont know what a particular electrical characteristic means then you better get used to looking them up because that's what an EE does lol.
 

PottedMeat

Lifer
Apr 17, 2002
12,363
475
126
Good info. Trying to parse through it all so it makes sense. Would I have to adjust any of my designs radically to accommodate vs a normal op amp?

nah. maybe put in a trimpot ( 20 turn ) in place of the 1M divider to shift the offset to where you want it.
 
May 11, 2008
21,678
1,295
126
I noticed in your schematic that you have the opamp and discrete components configured as a non inverting amplifier that is ac coupled. Did you check that the capacitor in combination with the input resistors is a high pass filter ?
Did you check that the cutoff frequency of this filter is how you have it in mind ?

With the free program from LTspice you can simulate easy how this works without having to calculate. Usually you can also get a spice model for the opamp you are using.
To be honest , to calculate for a simple first order filter is easy because there is a formula for it that is very simple :

7d87bc118166402407c6194a521f4eac.png


You can use this formula because the + input of the opamp has a very high input impedance and as such does not significantly influence the calculated result.

But with LTspice, it is really easy.
The AC sweep in the simulation option will do this for you :

Read this pdf for more information.
http://csserver.evansville.edu/~ric...07_FrequencyResponse/07_FrequencyResponse.pdf

General website about how to use LTspice :
http://denethor.wlu.ca/ltspice/

Here is a spicemodel :
http://www.st.com/internet/com/SOFTWARE_RESOURCES/HW_MODEL/SPICE_MODEL/ts92x.txt

Website from ST about product TS922.
http://www.st.com/internet/analog/product/65462.jsp

I will check to see if the spicemodel works later on.
 
May 11, 2008
21,678
1,295
126
I noticed the LTspice model from ST is different in the
PINATTR PinName and PINATTR SpiceOrder .

I adjusted it and see if it works. I will post it for you later on as a link in my general open dropbox account.
 

dwell

pics?
Oct 9, 1999
5,185
2
0
WG, thanks for your explanations and links. It's starting to make sense to me. Please do post the Spice model when you get a chance. I am a big fan of LTSpice. Importing the model posted above, yeah, something is wrong. LTS runs really slow and the output is not what I expect at all.

Here's a link to my spice project.

https://www.dropbox.com/s/4dlleljmlc2jawx/preamp.zip

Thanks again.
 
May 11, 2008
21,678
1,295
126
I have not got it to work. The inputs are mixed up as are the power rails and the output.
LTspice expects a certain order in the PINATTRIB pinname and spiceorder and i changed it around but i made a flaw.
I am at the moment a bit short in time to analyze in a relaxed moment what is going on. But i will try to solve it.

I do noticed a neat trick and have a usefull tip for you :

First, you should add always an capacitor between 10uF and 100uF in parallel over your battery.

For audio that is good enough. When you place a capacitor in parallel over your battery, the capacitor will when large enough act as a very low impedance (close to a short circuit) to an ac signal with a given frequency.
This is important for to simplify the calculation of the high pass filter on the input.

xc.gif


For Omega , you can write 2*pi*f where f is the frequency.

Here is an example :
calculate-impedance-capacitor-800x800.jpg


I do not know if LTspice actually takes this in account. I think that the voltage sources are ideal 0Ω impedances unless you specify it by adding an inductors, resistor and capacitor network that represents the power source you are going to use. But if you add in parallel a large capacitor, that capacitor will be the dominant reactance and you can within boundaries ignore the other effects.
Electronics has the advantage that you can easily simplify circuits as long as you design with a little bit of breathing space.

The calculation is simple and you can use a neat trick :

7d87bc118166402407c6194a521f4eac.png


The resistor divider of 2*1MΩ is for an ac signal really two resistor in parallel. Thus you have a first order hpf that has a resistance of 500kΩ and a capacitor of 100nF.

If you add that in the formula you get 1/(1*10^6 * pi * 100*10^-9)
= 3.18Hz. This means every frequency below this cutoff frequency will be continued to be attenuated.

As long as your power source has a very low impedance( near 0) you can use this :
If you use always powers of ten for the resistor, the intermediate result is always a power of ten times pi . For example :

For a resistor divider with equal resistors :
1MΩ in parallel is 500kΩ, 100kΩ in parallel is 50kΩ.
10KΩ in parallel is 5kΩ.

2*pi times this replacement resistance makes a power of ten * pi.
If you always use a capacitor that has a value that is also a power of ten
and the same capacitance as well, you always get a result that is 1 divided by (pi * a power of ten). If you shift the powers of ten around :

When always using a 100nF capacitor :
For 10MΩ you get 1/pi = 0.318 Hz.
For 1MΩ you get 10/pi = 3.18Hz.
For 100kΩ you get 100/ pi = 31,8Hz.
For 10kΩ you get 1000/ pi = 318Hz.

You can use this for low pass filters as well since the same formula applies.
 
Last edited:

dwell

pics?
Oct 9, 1999
5,185
2
0
Good info. I always put a 100uF cap in parallel with my battery for noise filtering but didn't know the exact science behind it.

I need to load the input with high impedance. It's guitar pickups and they need at least 1M impedance but I've loaded it with up to 5MΩ with two 10MΩ resistors.

I think that LTSpice model is broken. I've replaced the op amp in the model with both a LM741 and LM358 and they worked as expected. I've never seen LTS get bogged down.

Anyway, I finally got a physical TS922 in and built a preamp with it and it works as expected using a 10K pot to set the gain on the first amp stage. I'll be getting some LM358s from Asia eventually (I eBay'd a bunch of parts) and am interested to see how they perform in contrast (don't think they're rail-to-rail).

Now I'm slamming all this into an Arduino and dealing with 10-bit DAC and have a whole new host of problems -- none of that seems to work but I'll get it :D
 
May 11, 2008
21,678
1,295
126
I have not solved the TS922 issue yet, i know it has something to the with the node order of a .subpckt. But i have to dive into it as well.

I do have a schematic for you and some pdf files :
The schematic uses a standard ltspice opamp LT1490 as example, but you can exchange it with another one to learn about the differences between opamps.

For your guitar amplifier circuit, you should check it has a proper frequency response and phase variance response. The "color" of your guitar sound will change depending the frequency response of the amplifier and the phase response of the amplifier.

The green solid line is the frequency response, the dotted line the phase response.

Image1.jpg



An example circuit from this schematic :

http://dl.dropbox.com/u/45177488/test_ts922.asc


Some pdf files to learn about how to use about ltspice :

http://ltspice.linear.com/software/LTspiceGettingStartedGuide.pdf
http://cds.linear.com/docs/ltspice/LTspiceHelp.chm

This pdf file is for easy lessons about LT spice and how to simulate :
http://dl.dropbox.com/u/45177488/LTspice__lessons.pdf

Manual :
http://ltspice.linear.com/software/scad3.pdf

This website may be useful if not already known.
http://ltwiki.org/index.php5?title=Undocumented_LTspice

These pdf files are addition to the pdf files above :
http://dl.dropbox.com/u/45177488/RF_Electronics_ltspice.pdf
 
Last edited:

dwell

pics?
Oct 9, 1999
5,185
2
0
Thanks for the info. There's all sorts of ways to curve the sound for guitar effects. One popular method is a mid-range hump as displayed in this model I made a while back based on a popular distortion pedal. The lines are different parameter steps.

mcGcn.png


Another method is a to carve the mids out a bit. There's no wrong way really, just what sounds good.

Here's a couple LTS models of effects pedals I have built (but not designed). It's really enlightening to experiment with software models to see how the components affect the sound and current flow.

https://www.dropbox.com/s/qhpafeo8kt4v27a/Proco Rat.zip

https://www.dropbox.com/s/cyd8f1q9qyiirlr/IC Big Muff.zip
 
May 11, 2008
21,678
1,295
126
I see you are doing great with LT spice and creating circuits. ^_^

In the schematic, the diodes D1,D2 function as a "hard" limiter. These diodes
clamp the audio signal to a fixed level at + 0.6V and - 0.6V This of course causes a desired distortion.

In the good ol' days, with tube amplifiers, the tubes when given an input signal with a large amplitude, would "soft" limit the audio signal. This causes a typical distortion of the audio signal. The distortion can be seen as when a sine wave is applied, there would appear a lot of harmonics in the output signal.
How the number and amplitude of these harmonics are build up depends on the circuit.
Today tubes are still used in audio amplifiers but are less common.
 

dwell

pics?
Oct 9, 1999
5,185
2
0
One thing I never really understood is odd and even harmonics. Apparently tubes and MOSFETs produce even harmonics which are more pleasing to the ear, but how would I visualize something like that in LTSpice or the equivalent.
 
May 11, 2008
21,678
1,295
126
It seems Ltspice can do Fourier analysis on a signal. This will display in a frequency spectrum all the components (Fundamental tone and harmonics).
On this website, an excel tool is given to use in combination with LTspice.
I have not yet used it. When i have some time i am going to try it myself, it is interesting.
http://www.elektor.com/magazines/2010/january/fourier-analysis-using-ltspice-excel.1191300.lynkx


A little bit of history about Joseph Fourier :
http://en.wikipedia.org/wiki/Fast_Fourier_transform
http://en.wikipedia.org/wiki/Joseph_Fourier


images
 
Last edited:
May 11, 2008
21,678
1,295
126
Here i found something that is useful :
http://pkropik.com/storage/1202227692_sb_switchercad_1.pdf

A pdf file explaining how to use the FFT feature :
Fourier analysis
.FOUR <Frequency> [Nharmonics] [Nperiods]
<Data trace1> [<Data trace2> ...]
Fourier analysis computes amplitude and phase of harmonic
components of specified variables (Data trace). You can
use Fourier analysis only after transient analysis. This
direction is supported only for back compatibility. Fourier
analysis implemented in waveform viewer is more useful.

If i understand correctly, you must first execute a transient analysis and then add a directive with the .FOUR command.
I will try it tomorrow, could be fun. Feel free to try it out...
 
Last edited:
May 11, 2008
21,678
1,295
126
Now that i have the time and read the actual text, the FFT is very simple.
Just click on the wave view window and below select FFT.

Then you have to select the proper values. I am still trying something here.
 
May 11, 2008
21,678
1,295
126
I got a sort of spectrum analysis working :

  1. Run transient.
  2. Select FFT by clicking on the wave viewer and select with alt mouse button : [view],[FFT].
  3. Select with alt mouse button : [Manual limits].
  4. Select for the left vertical axis, [linear].

It will show you a spectrum analysis.

If you for example use a square wave by using a voltage source in pulse mode and use a 1kHz square wave of 0.1V...
You will get a 1kHz line and another on 3kHz and another on 5kHz and so on.
The odd harmonics so to say.

EDIT:
It works as well with a triangle wave.
A triangle is also made up of odd harmonics but only to a lesser extent, it drops off quickly after the 5th harmonic while a square wave can have theoretically an infinite amount of harmonics if i am not mistaken.
 
Last edited:

dwell

pics?
Oct 9, 1999
5,185
2
0
Can you post a screenshot of the voltage source set up to product a square wave? Can't seem to get it working.
 
May 11, 2008
21,678
1,295
126
Of course...
Schematic :
ss1.jpg


Voltage source settings for a 1kHz squarewave, 0,1V low to high.
1kHzSquarewave.jpg

Screenshot with FFT of the amplified squarewave.
ss2.jpg

Manual limits and settings for the FFT screen.
manual_limits.jpg



Good luck. ^_^

EDIT:
For the FFT function, there seems to be an underlimit
for the horizontal axis. Never set it to 0 or 1 for this has no use. LTspice will automatically adjust the lowest value on the left side of the horizontal bar. But this is usually a fractional number. Try 100 or 200, steps of 100 until LTSpice has no longer a need to adjust.​
 
Last edited: