I've looked through the archives and as such I am using a 220ohm resistor to read the voltage of 4mA-20mA humidity sensor that takes 12-24vdc. I've mapped the sensor readings as follows:
senConv = map(senReading, 180, 900, 0, 100)
where
4mA220ohms= .88v
20mA220=4.4v
and for mapping
180= .88v/5v1023
900=4.4v/5v1023
The problem that I am having is that the sensor will not read above 70% humidity which is equal to around 3 volts. Is it possible that the resistor is causing too much of a voltage drop such that the 0-5v scale can not be realized?
Thanks for the reply. Please excuse the rough nature of this diagram, it shows the top rail of the Arduino with the humidity sensor and 15Vdc power supply coming into it.
Cheers,
Chumann
____________________________Humidity Sensor (non polar)
| |
|-220ohm-| |
| | |
| V | |
| i | |
| n | |
x x x x x x x x x x x x |
A A A A A A | G G 5 3 R |
5 4 3 2 1 0 | n n v v e | < 15Vdc into Arduino
| d d s |
|_______________________|
Well that wiring plan looks OK to me. Do you have a link to the sensors datasheet? Possible things you can try to troubleshoot:
Measure the current in the loop when you apply 100% humity to the sensor. If it doesn't reach 20ma, and the sensor is not at fault, then you need to either increase the loop voltage or lower the resistor value until you can reach a 20ma = 100% condition. Most loop powered sensors are designed to work with a 24vdc loop voltage and below that there are resistrictions on the total amount of loop resistance allowed (wire length + sensing resistor).
If it is designed for 24V it is very likely the current output doesn't have enough voltage compliance to work from 5V. If it can be powered from 9V say (but the analog pin protected by a 4v7 zener) the full voltage range might be achievable - again the datasheet would be useful