0-5v analog on 3.1

Status
Not open for further replies.

100

Member
Hi , In a project ive been working on i need to read some 0-5v analog signals I have been doing this with just a voltage devider but only just realised that this will be causing the car which this is wired into to get lower signal reads that it should be .I need a way to solve this problem my first thought was an external adc but that looks as if it could get complicated is there a way i can do this with a transistor or an op amp so as not to put any load on the cars curcuit ? I seem to remember seeing something along these lines. If that isnt possible or you kow a better way please let me know , any help is appreciated .

I tried running my code on a 5v arduino how ever it ran way to slow to do what i want , the speed difference between an arduino uno and a teensy 3.1 is increadible:D
 
voltage divider ahead of an ADC changes the digital full scale. So in the software, you multiply the ADC datum by a constant (or some such) to adjust.
 
Unless you are using ridiculously low value resistors a voltage divider should present negligible load (current drain) to the target system.

If by 'lower signal reads' you mean that the voltage divider makes the ADC see (and so report) a lower voltage than the actual voltage then maybe all you need to know is that if you label the resistor between ADC pin and ground as Rb and the resistor going between ADC pin and 'signal' as Ra then the following formula can get you the original voltage:

Vsig=((ADC/<ADC_RESOLUTION>)*3.3) * ((Ra+Rb)/Rb)

I'd swear I knew a better variant of the formula but I seem to have forgotten it, the result of '(Ra+Rb)/Rb' can be stored as stevech's constant.

Edit: My use of 3.3 above assumes that you are using the 3.3V reference as opposed the 1.2V reference or some other reference provided externally (while I mention the possibility of an external reference I should probably mention that it would not be good to go much (<0.3V I think, fact is in the datasheet) past 3.3V on the VREF pin so please don't rush into an idea that maybe you can just feed it 5V there).
 
Last edited:
Hi , I might need to explain this a bit better .
With the teensy I am measuring the output of a potentiometer which out puts between 0 and 5 v.
To get the 5v down to the 3.3 I have been using a voltage divider I forget the exact numbers but assuming the potentiometer is a 10k pot sitting in the middle of range it will have 5k resistance on the input and 5k to ground giving 2.5v output .
My voltage divider for the teensy has a 5k resistor on the input and a 10k to ground wont this then be equal to a 5k resistor on the input(from the pot ) and a (5k to ground (from pot )and a 10k and a 5k (in series in devider ) to ground making 3750 ohms to ground in total which will give me 2.1 v on the signal wire .
The issue is that the car then sees the 2.1v instead or the 2.5v it should .

I think I need this unless there is an easier way http://i.cmpnet.com/planetanalog/2007/06/C0194-Figure4.gif
 
Last edited:
So, you wish to show a device in the car the resulting voltage from where the pot is set and you want the Teensy to read that same voltage without changing it - is that right or did I misunderstand?

A super low forward drop diode from wiper of pot and 'device in car' node to Vin of a voltage divider driving Vout to Teensy 3.1 may give reasonable result but missing from the range will always be the voltage drop across the diode; there will be a dead spot on the pot as far as Teensy is concerned but the device in the car will see the full range of the pot.

There is a simplistic enough circuit based on an opamp I can think of managing full range on the pot being readable by both devices.

Only alternative to that sort of thing would have to be using a 5V capable ADC.
 
Yes rob you got exactly what i was trying to explain. I dont under stand how the diode would work but it sounds like a suitable solution I will search for more info on it , Thanks .
 
I think your divider after the wiper is too low. It has a total resistence of 15 KOhm. At middle range, your example, it will give an effective resistance of 5 KOhm || 15 KOhm = 3.75 KOhm. This leads to a 8 % error and this error is higher at higher voltages. Try to multiply the values of the divider by at least 10.
 
I think your divider after the wiper is too low. It has a total resistence of 15 KOhm. At middle range, your example, it will give an effective resistance of 5 KOhm || 15 KOhm = 3.75 KOhm. This leads to a 8 % error and this error is higher at higher voltages. Try to multiply the values of the divider by at least 10.
EE I know just told me you could use 300K and 600K, add a 1uF capacitor across the ground resistor in teensy's divider and expect much less effect, adding a schottky diode with a 0.2V drop at this point may subtract more value than it may add --- do add Constantin's suggested cap too.
 
Last edited:
The manufacturer recommends 0.01uF. For a slow moving signal 0.1 should work also. For a fast moving signal I'd opt for a resistor divider followed by a unity gain op amp.
 
Status
Not open for further replies.
Back
Top