Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

+/-12V to 0/5V converter. Please help!

Status
Not open for further replies.
eblc1388 said:
If one solves the equations, one would end up with a much easier method to calculate those resistor values.

Let's say:
Vmax=+12V (from +/-12V),
Vpic=5V,
Rin=10K (we have full control over this value and can choose one to suit the signal source),
Rvcc=?,
Rgnd=?

So we have just two unknown resistors to calculate.

Rvcc = Vpic * Rin / Vmax = 5 * 10K / 12 = 4.167K

Rgnd = Vpic * Rin /( Vmax - Vpic ) = 5 * 10K / ( 12 - 5 ) = 7.143K

That is certainly easier way to calculate it.

One way of looking at it is that when the input is at +12V, the output should be at 5V, so there is no voltage across Rvcc and its value is irrelevant, so Rgnd can be calculated on its own.

Then when the input is at -12V, the output should be at 0V so the value of Rgnd is irrelevant and Rvcc can be calculated on its own

I hadn't thought of that earlier.
 
Diver300 said:
Also the input impedance is quite small for some sources.

I assumed, maybe wrongly, that the ±12V source was already buffered to give that scale.

Your solution 'may' be perfectly fine, but we don't know the exact circumstances - and it's obviously not a 'general purpose' solution.
 
To ericgibbs: The +/-12V signal comes from a signal conditioning amplifier for accelerometers.
To Diver300: Your resistor circuit is very nice. I didn't think such a simple circuit can solve my problem. This circuit is fast and -of course- simple. Moreover, no +/- power supply is needed for op-amps. To minimize the effects of pin leakage currents on the accuracy of the ADC, I'm gonna add a voltage follower (using LM358, which only needs 0-5V power supply) between the resistor circuit and PIC's pin.

Thanks all.
 
Last edited:
benq said:
To minimize the effects of pin leakage currents on the accuracy of the ADC, I'm gonna add a voltage follower (using LM358, which only needs 0-5V power supply) between the resistor circuit and PIC's pin.

You should check the LM358 datasheet on the max common mode input voltage(+3.5Vmax with +5V supply) and max. output voltage swing(+3.5V max with +5V supply) that it can satisfy your requirement.
 
benq said:
To ericgibbs: The +/-12Vdc comes from a signal conditioning amplifier for accelerometers.
To minimize the effects of pin leakage currents on the accuracy of the ADC, I'm gonna add a voltage follower (using LM358, which only needs 0-5V power supply) between the resistor circuit and PIC's pin.

The ADC input of a PIC is very high impedance. You do not need a voltage follower. You might need to increase the sampling time to allow the capacitor to charge.

The LM358 does not swing to the positive rail, so with a 5V supply, you will not even get 4V output which will limit your range.

The output of the signal conditioning amplifier will have a low impedance and it will not be affected by the 10k:eek:hm: . You don't need an amplifier at all.
 
Last edited:
hi beng,
I should confirm the Vmax output of +5V when using a +5V supply rail.

Thanks for the sensor info.
 
Hi,

When I click on the linked PDF posted by ericgibbs on page 1 it shows a blank page. Not sure if the link is broken, or if the issue is my end. I believe I have a need for a similar circuit where I've got an LM338 variable voltage regulator across the -12V and 12V outputs of an ATX power supply and would like to use an ATmega328P analog input to determine & display the voltage being output. Am I right in thinking this will do the job? This is the first time I've used an op amp so apologies for the naive question if not.

Can someone point me to that circuit from another source if that link is gone?

Cheers ! Geoff
 
Last edited:
hi str,
The pdf would not open for me, so I have made a copy in GIF format, re-look at the original post for the update.;) Post #3
 
Last edited:
I don't know why everyone is going for the difficult solutions, when there is an easy one.

Connect a 10k :eek:hm: resistor in series with the point to be measured.
Connect the other end to the PIC A/D input
Connect a 4200 :eek:hm: from the PIC A/D input to +5V
Connect a 7200 :eek:hm: from the PIC A/D input to Ground.

More precise values are 4166.714611 :eek:hm: and 7142.857143 :eek:hm:

Having said that, I had a similar problem some years ago and I solved it with OP amps, before I realised the simple way.

Because you don't know the output impedance of what is being measured. Your resistors could load it and lead to misreadings. Hence why buffers are mentioned in the replies.
That's why. Simple!
 
hi str,
The pdf would not open for me, so I have made a copy in GIF format, re-look at the original post for the update.;) Post #3
That is awesome - thanks so much.

Can I ask if the 8V & -8V supplies to the op amps are significant? I have a TL072 which says it can use +/-18V max for the power supply so would it be okay if I fed it -12V and 12V instead? And if I may have one other perhaps silly question: what do the cermets allow the adjustment of?

Thanks! Geoff
 
That is awesome - thanks so much.

...may have one other perhaps silly question: what do the cermets allow the adjustment of?
After some more reading on op amps I think I have a handle on these now. The part of the circuit which is still a puzzle to me is down at the input for the 2nd op amp that includes the unmarked R3. Is this just a fixed reference voltage, and therefore I could use +5V through a potential divider as that input? I was half thinking that's what this was but that means ignoring the box marked "2.5Vref" which appears to link R3 to GND. What is that component? I was also presuming the cap there was for noise suppression - is that correct?

Can I ask if the 8V & -8V supplies to the op amps are significant? I have a TL072 which says it can use +/-18V max for the power supply so would it be okay if I fed it -12V and 12V instead?
Unless there is an issue, this is how I'm intending to power the TL072.

Thanks again for your help. I've got the components all together now in preparation... Geoff
 
hi Geoff,
+/-12V will be OK, I would add the dotted section on the OPA output, 220R and zener
You could use a potential divider for the +2.5Vref, the voltage powering the top of the divider should be a regulated supply.

Ref the trim pots, most components in the circuit have value tolerance range so the trim pots allow fine adjustment of the Gain to compensate for these tolerances.

E.
 
Thanks so much for your explanations Eric
You could use a potential divider for the +2.5Vref, the voltage powering the top of the divider should be a regulated supply.
The 5V will be one of the rails out of the switched power supply. I've read that putting a linear regulator after a switched supply introduces noise - will just using the vanilla output of the ATX supply do the job?
I would add the dotted section on the OPA output, 220R and zener
I expect the dotted section is a manner of protecting the uC's ADC pin in case things go poorly? Since this is my first taste of an op-amp circuit I'll be taking that sage advice :)

Thanks again, Geoff
 
Hi again

Have been away from this project for a while. Now, before I power this up and risk letting the smoke out, just wanted to check that the GND represented in the R1/R2 potential divider should actually be -12V? That's what I presumed, but better to know for sure.

Thanks again, Geoff
 
Hi again

Have been away from this project for a while. Now, before I power this up and risk letting the smoke out, just wanted to check that the GND represented in the R1/R2 potential divider should actually be -12V? That's what I presumed, but better to know for sure.

Thanks again, Geoff

Hi,
If you mean the R1/2 divider in this image, the bottom of the divider is at 0V.

It divides the +/-12V input signal.
 
Glad I double-checked then :eek:

For some reason I presumed in order to reduce the input to +/- 2.5V that the lower end of the potential divider would have to be -12V

Thanks ! Geoff
 
Eric,

This has turned out to be just perfect. On a breadboard initially I changed the potential divider to more accurately split the range of voltages the LM338 provides from the +/- 12V inputs and I've soon got the hang of why you suggested the cermets. Now it's soldered into my project and works just as you advertised.

Thanks again! Geoff
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top