Go Down

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

Jassper

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

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

Jassper

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

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

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

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

Quote

Why do you think that then?


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

Thanks

Jassper

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

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

I think it is time to order some parts and start playing.

Thanks

Grumpy_Mike

Do some calculations before ordering parts.  ;)

Jassper

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

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

Hi

try R pu = R pd = 1K

and Vref =2.5V

you should get full range

tektro69

#14
Oct 06, 2009, 03:27 pm Last Edit: Oct 06, 2009, 04:05 pm by tektro69 Reason: 1
but your measurement is reverse
Vref =2.5V

if Vss = 0v => Vin = 2.5v => analog read = 1023

if Vss = -5v => Vin = 0v => analog read = 0

Go Up