Analog read of 5V signal?

Status
Not open for further replies.

jim lee

Well-known member
Have Teensy 3.2 and a 0-5V Vacuum gauge. From what I read, I need to knock the voltage down. So I assume I'm going to need to make a voltage divider. Two resistors, signal at one end, ground at the other. Read the middle between the two. What size resistors are good for this? 1K? 10K?

100K? The more the merrier?

EDIT : Output source A @ full output .5 mADC

Many thanks!

-jim lee
 
Last edited:
10k to the gauge and 20k to ground will read to 4.95v. 12k and 20k would go to 5.28. Depending on how fast you need to reading to keep up with changing sensor output a .1uf cap from the adc pin to analog ground can cut way down on noise. 1.2k and 2k for example would work well too but pull a bit more current.


Edit are you now saying it puts out 0-0.5ma? If so you just need one resistor 3.3v/0.0005 ma = 6.6k. If the output is 0-5v at 0.5ma max the 12k/22k would work fine but not the 1-2k/2k.
 
Last edited:
On the Teensy anything above 3.3v will read as the high end...

So if you have a voltage range of lets say 0-5v and you wish to measure 0 to 3.3v, you can use Ohms law or simply use a quick voltage divider calculator like:
http://www.ohmslawcalculator.com/voltage-divider-calculator or http://www.raltron.com/cust/tools/voltage_divider.asp

So for example if you choose 10K for R1 and 20K for R2:
you will see if you plug in 5v*20K(10K+20K) = 3.333333v which hopefully is close enough. If not fudge one of the numbers a little, like 10K and 19K, would give you the high end value of 3.275v...
 
Sometimes for a 5v in when I'm in a hurry ( um lazy) I just use 2 resistors the same size. It could read to 6.6v then but it's just easier.
 
or you could also get a 4/8 channel 10bit ADC chip for SPI bus. MCP3004/MCP3008. Run the chip power at 5Volts and you could get the reading without resistors.
 
Wait wait wait.. I'm no EE guy. Just code, only code.. I sound like the guy that only did eyes.

I just figured I'd cut it in half 0-2.5V so that it would be under the 3.2V limit of the analog pin. The thing gives a voltage. I only put the current out there just to show what it can supply.

1/2 miliamp is .0005 so 5/.005 = 10k Ohms. So 2, 5k-ish ohm resistors would work? Did I do the math right?

Thanks again, and no, this doesn't really need to react fast. In the realm of seconds is fine.

-jim lee
 
Looks correct to me. Good luck with the project. PS 5.1k iand 5.6 k are standard values for +/- 5% resistors. I'm with you just cut it half if you don't need every last bit of adc resolution. As a rule of thumb I try to use about half of what something says it can supply. Less surprises that way.
 
Last edited:
Thank you for posting this guys.. This will be a question for loads of people, maybe admins should stick it or wiki it.. The 2.5v is a great idea indeed..

But I was wondering, dear jim lee, do you use a 3 wire MAP sensor? Like 5v-signal-gnd? What if you power the sensor with 3.3v? Then it should ouput 0-3.3v.. I don't know, maybe it will drive it out of range or sending silly readings but you can try 5v, take a reading, then try 3.3v and take the same reading (ie atmospheric pressure, around 101.13 kpa)..

I have worked with a VDO OIL pressure sensor in the past which needed 12v to operate and have perfectly ran it using the Arduino's 5v.. Can you try that?
 
Oh hey!

What I ended up doing is getting a pack of 5.8k resistors and just doing a quick (50:50) voltage divider. I didn't want to change the vcc of the chip 'cause, for all I knew, there may have been a µprocessor in there that would have gotten upset. And, this way I'm assured that I'm running everything within spec. So I should have fewer surprises.

The sad part is, when I grabbed my trusty multimeter to do some real-world measurements to calibrate the thing, I found that the rain had gotten into it and it looks like the poor thing is dead. So my vacuum gauge, although complete, has not been calibrated. And, my trusty multi meter I've had for over 25 years is toast.

-jim lee
 
Vref of MCP3008 would then be 5v and VDD 3.3v? Why not use 3304 with 13bit of resolution? Are there any Teensy tutorials?

I searched for the 3008 and found the 3208 on the Arduino site but the code was using loads of digitalwrite ie and then at the bottom of the page is the 3304 which had nice SPI functions on its code, that's why I am asking..
 
Status
Not open for further replies.
Back
Top