Voltage level shifting

pebe1

May 3, 2004
45
Joined
May 3, 2004
Messages
45
Hi Staigen and Enac,
You are both right.
With input=5v, inv input=5v, output =5v and no current flows through the resistors.
With input = 2.5v, inv input=2.5v, output=0v because current flows through both resistors and giving equal voltage drop across each. So inv input is 2.5v below +rail (5v), and output is 2.5v below inv input.

EdwardM,
Your circuit is flawed because with R1=R2, the LH side of R3 is effectively sourced from 2.5v
When input=2.5v, inv input must be at 2.5v. So no current flows through R3 or R4 and output will be 2.5, whereas it should be 0v

Windoza,
This is such a simple circuit it cannot possibly fail. If you are still having trouble simulating it then either the simulator is handling the parameters of the opamp incorrectly, or it is selecting the wrong opamp. I cannot beleive the simulator has a fault - but worst things have happened.
Don't mess about with the simulator - just build it. It will work!

 

Enac

Mar 4, 2004
12
Joined
Mar 4, 2004
Messages
12
Staigen said:
Hi


As i suggested, roughly!

And what do you say pebe?

Anyone else?

//Staigen
I see that now. I'm sure glad I pre-apologized for missing it! :)
 

MP1

Dec 7, 2003
3,399
Joined
Dec 7, 2003
Messages
3,399
windoze killa said:
I am try to work out how to take an I/P voltage that is between 2.5V and 5V and produce an O/P of 0V to 5V. I only have a +5V supply to work with which is where I am having the problem. I have tried everything but just can't come up with an answer.

There has to be someone that can trip over an answer.
It sounds like you are connecting a sensor to the A2D on a micro. If this is the case, you do not need to waste your time converting the voltage. Just use what you have. Adjust the reference voltage on the micro if you need better resolution.
Also, if this is not your application, I think there would be an interest in what you are making. Please share with the forum if you are able to do so.

MP
 

windoze killa

Mar 4, 2006
136
Joined
Mar 4, 2006
Messages
136
MP said:
It sounds like you are connecting a sensor to the A2D on a micro. If this is the case, you do not need to waste your time converting the voltage. Just use what you have. Adjust the reference voltage on the micro if you need better resolution.
Also, if this is not your application, I think there would be an interest in what you are making. Please share with the forum if you are able to do so.

MP
You are partly right. This voltage will be fed into a micro but the I/P has to be 0V to 5V. The code in the micro is being used in many places and all the other inputs are 0V to 5V so we can't change the code just for this one. They are to be interchangable between each other.

I will give you a little bit more info for this project. I have a bunch of current sensors measuring various rails of a power supply. The current sensors have an O/P of 0V to 5V for the range of current. Unfortunately 0A equals 2.5V. Negative current is 0V to 2.5V and positive current is 2.5V to 5V. We are only interested in the positive bit. The problem is we need a current sensor that has a 5V supply and can handle 25A. These are the only ones available
in this range.
 

windoze killa

Mar 4, 2006
136
Joined
Mar 4, 2006
Messages
136
Guess what. In the process of building up my circuit I have been informed (after 3 weeks of toil) that I can have a 10V rail and have to use an LM324. Not bad seeing I was supposed to have this design finished last week. Oh well back to the drawing board.

While i am trying to work this out I will be happy to accept any suggestions.

 

pebe1

May 3, 2004
45
Joined
May 3, 2004
Messages
45
Now you have said what the purpose of the project is, could I suggest an alternative?

How about a dedicated micro just for this data input. Input would be to the A/D convertor section of this micro reading the 2.5v to 5v. Compare the digital readings obtained with a lookup table that will give equivalent outputs in the range 0v to 5v. Then output that to an R2R ladder network to give D/A to go into your main micro. You can still use just the 5v supply.

 

windoze killa

Mar 4, 2006
136
Joined
Mar 4, 2006
Messages
136
Good idea. Didn't think of that. Unfortunately I don't think we will have the real estate on the PCB. Pretty much why we are using op amps as we can get 4 in one package. And also the softies won't need to write anymore code.

 

MP1

Dec 7, 2003
3,399
Joined
Dec 7, 2003
Messages
3,399
You don't need 4 op-amps to achieve this. 2 will do it fine. You just need a circuit that will give you a zero and span calibration (this is the 1st op-amp). The zero cal will move the voltage window up or down. The span cal will widen or narrow the window, or voltage swing. You can add a span calibration with a pot in the feedback loop of the op-amp. The zero calibration adjustment can be added by connecting a vref bias to the negative input of the same op-amp. You will want to add a buffer on the output to keep other things in the circuit from effecting your calibration (this is the 2nd op-amp). The buffer is just another op-amp with no amplification. The cal can be performed by injecting 2.5V to the input and adjust the voltage reference pot at the op-amp minus input (the zero cal) until you get zero at the output. Then inject 5V into the input and adjust the pot in the feedback loop (the span cal) until you get 5V at the output. You will need to go back and forth and make the adjust a few times since the adjustments effect each other. Each time you adjust, you will notice you are shaping the output closer and closer to the shape you want. Once you see 0 out when you inject 2.5 and you see 5V when you inject 5V, then your adjustments are finished.
This is the type of circuit that has been used to shape the outputs of sensors in instrumentation for years. Most sensors are not very linear without a little help. Seems like it is almost a forgotten application since most manufacturers now scale the voltage in the source code and/or use sensors with digital outputs. Note that without a bipolar supply on the op-amp, you will not get the output to be perfect zero to five.

Is this a school project or a project for your employer?

MP

 

pebe1

May 3, 2004
45
Joined
May 3, 2004
Messages
45
I cannot see how this more complex arrangement is better than Staigen's proposal in his post #6.

Or have I missed something?

 

MP1

Dec 7, 2003
3,399
Joined
Dec 7, 2003
Messages
3,399
Yes, you 'have' missed something. Go back and read them both again.

MP

 
Last edited by a moderator:

pebe1

May 3, 2004
45
Joined
May 3, 2004
Messages
45
I have read them, so what have I missed?
Please read my PM.

 

windoze killa

Mar 4, 2006
136
Joined
Mar 4, 2006
Messages
136
MP said:
You don't need 4 op-amps to achieve this. 2 will do it fine. You just need a circuit that will give you a zero and span calibration (this is the 1st op-amp). The zero cal will move the voltage window up or down. The span cal will widen or narrow the window, or voltage swing. You can add a span calibration with a pot in the feedback loop of the op-amp. The zero calibration adjustment can be added by connecting a vref bias to the negative input of the same op-amp. You will want to add a buffer on the output to keep other things in the circuit from effecting your calibration (this is the 2nd op-amp). The buffer is just another op-amp with no amplification. The cal can be performed by injecting 2.5V to the input and adjust the voltage reference pot at the op-amp minus input (the zero cal) until you get zero at the output. Then inject 5V into the input and adjust the pot in the feedback loop (the span cal) until you get 5V at the output. You will need to go back and forth and make the adjust a few times since the adjustments effect each other. Each time you adjust, you will notice you are shaping the output closer and closer to the shape you want. Once you see 0 out when you inject 2.5 and you see 5V when you inject 5V, then your adjustments are finished.
This is the type of circuit that has been used to shape the outputs of sensors in instrumentation for years. Most sensors are not very linear without a little help. Seems like it is almost a forgotten application since most manufacturers now scale the voltage in the source code and/or use sensors with digital outputs. Note that without a bipolar supply on the op-amp, you will not get the output to be perfect zero to five.

Is this a school project or a project for your employer?

MP
Well I actually need 5 OP amps as there are 5 currents I need to monitor so I can get away with 2 chips.

The good news is that I have got it working with LM324s.

Bad news is we are back to 5V supply and rail to rail amps.

Hopefully I will have this sorted by the end of the week. Thanks for all the help.
 

pebe1

May 3, 2004
45
Joined
May 3, 2004
Messages
45
Hi Windoze,
Here's an op-amp which may do you. It goes rail-to-rail on its input and output.

http://www.datasheetarchive.com/search.php?search=lt1782&sType=part

I'd like be interested in your final solution when you get it all going.
Best of luck.

 

MP1

Dec 7, 2003
3,399
Joined
Dec 7, 2003
Messages
3,399
pebe said:
I have read them, so what have I missed?
Please read my PM.
The difference between my post and Staigen's is the addition of calibration adjustment. Also, the second op-amp is there to isolate the sensor circuit from the other electronics.

Your sensor will drift with temperature and with time. A fixed resistance might be fine if your circuit never leaves the workbench. However, if it is to be used in a real world application, you should consider serviceablility and calibrations. Although I do not know which current sensor you are using, all of the 0-5VDC current sensor data sheets that I looked at show a substantial temperature drift. Since Windoze states that no specific compensation can be added to the firmware, some kind of adjustment at the front end would be desirable. Else, this margin of error will cause a significant numeric error after the A2D conversion. Check the data sheet to see if this margin of error is acceptable.
Another concern would be if this circuit is to be duplicated. No two units would be the same with resistor tolerances and tolerances in other components unless there is some ability to calibrate the front end.

Hey, just my 2 cents worth....
Good luck with your design, Windoze!

MP
 

windoze killa

Mar 4, 2006
136
Joined
Mar 4, 2006
Messages
136
The current sensor I am using is an LEM LTS15. A little drift won't be to much of a problem so super stable designs aren't required. This is more of a confidence circuit.

 

Nick Mulder

Oct 13, 2005
43
Joined
Oct 13, 2005
Messages
43
Hi,

I am working on a project that is using LDR's to sensor light which needs to be scaled to both 0-5v and 0-12volts with adjustable 'zero' points and scale factors depending on the ambient light mins and max's - looks like I need a similar cct...

I have only worked with op amps making simple comparators so far so this is new to me - after reading up on them I now know how to make a non-inverting amplifier with an adjustable scale factor - what I need to know is how to get the zero point ...

If I put 12 through my LDR and instead of getting a nice ~0-12volts output (from darkest dark to full on sunlight) and instead got say an 4-8volt range I would need to scale the output by 3 - easy.. but how do I make the 4volts output as zero before thnis scale ?

also I believe that op amps can be made to convert log scales to linear - I think this would be of use as I need a linear output compared to the LDR

any suggestions ?  is it a simple switch of the resistors in what has been discussed here already ?


cheers as always,
Nick

 
Top