Go Down

Topic: How to read a negative voltage (Read 26654 times)previous topic - next topic

Jassper

Oct 03, 2009, 05:41 am
I haven't seen it mentioned anywhare, but I would assume the Arduino Analog input can only read a positive voltage.

So what would be the best way to reverse the polarity on a analog signal from -5volts to 0 to a positive voltage of 0 to +5v so it can be read by an ADC?

I would search for it, but I am not sure what to search for, is there such a thing as an Analog flipflop? I feel I should know the answer to this, so I feel a bit silly asking the question.  :-/

Thanks

westfw

#1
Oct 03, 2009, 06:01 am
An op-amp "inverting amplifier" (perhaps with a gain of 1) will do this, given appropriate power supplies.

Jassper

#2
Oct 03, 2009, 06:06 am
Quote

An op-amp "inverting amplifier" (perhaps with a gain of 1) will do this, given appropriate power supplies.

I can source/sink 20ma max.

tektro69

#3
Oct 04, 2009, 11:35 pm
hi
With 2 resistors

+5V----[2K]----(analog_read_pin)-----[3K]-----(-5V to 0) Vss for testing

if Vss = 0V you should read 3V
if Vss = -5V you should read 1V

ratio for the value from 0 to -5v

Jassper

#4
Oct 05, 2009, 03:31 pm
Thanks Tektro69, But I will loose a lot accuracy that way.
I think the Op-Amp is a better way to go to maintain accuracy and I won't need to do any internale scaling in the software.

Grumpy_Mike

#5
Oct 05, 2009, 08:37 pm
Quote
But I will loose a lot accuracy that way.

Why do you think that then? You can always change the values if you want to change the range. With equal resistors you will get the same voltage range. Watch out for negative voltages and put a catcher diode on the input.

Jassper

#6
Oct 05, 2009, 08:59 pm
Quote

Why do you think that then?

Because I'm not that smart, which is why I am asking you guys.

Thanks

Jassper

#7
Oct 06, 2009, 04:57 am
GrumpyMike,

If I use 2 equal values of resistors, then wouldn't that make the voltage between 0 snd 2.5 volts?

If the input is 0, then the +5 should be dropped equal across the 2 resistors, would it not? Assuming the 0 input is the same potential as ground.

Grumpy_Mike

#8
Oct 06, 2009, 10:25 am
Quote
then wouldn't that make the voltage between 0 snd 2.5 volts?

Yes it would, sorry I was having a bad day.

You have to make the pull up larger than the pull down to extend the range over half. It should be possible to easily get a 4v range if not a bit bigger, keep the pull down to something like 470R and see where you get.

Jassper

#9
Oct 06, 2009, 12:34 pm
I think it is time to order some parts and start playing.

Thanks

Grumpy_Mike

#10
Oct 06, 2009, 01:55 pm
Do some calculations before ordering parts.

Jassper

#11
Oct 06, 2009, 02:10 pm
Quote

Do some calculations before ordering parts

Oh for sure, but I will need the main parts regardless - and I got tons of resistors to play with.

If my volt divider Calculator is correct, 200K pu and a 1K pd should give me about a 0.02 to 4.8 volt range. Does that sound right?

Grumpy_Mike

#12
Oct 06, 2009, 03:07 pm
Quote
Yes it would, sorry I was having a bad day.

I think my bad day is today.

If the resistors are equal then you will get a value of 0V to the Arduino's input when you have -5V in.
Therefore when you change this to 0V there will be only +2.5V on the analogue input, as you rightly pointed out.

Any less in the bottom bit and you will have a negative input on the Arduino's analogue input with the full -5V input.

However what you could do is to change the Vref to 1.1V and get the full digitisation range with a smaller swing. Then you make the bottom resistor bigger.

tektro69

#13
Oct 06, 2009, 03:24 pm
Hi

try R pu = R pd = 1K

and Vref =2.5V

you should get full range

#14