So I have a pressure sensor that outputs a 4-20mA signal. I am using an ESP8266, and have converted that 4-20mA signal to be a 0-3.3V signal for the 10 Bit ADC to read. I get the ADC to display a value, but I know that is the ADC value, not the pressure. How would I convert that ADC value into a pressure range of 0 PSI to 250 PSI?
See datasheet. No doubt it's explained in detail how the output (in mA) of the sensor relates to the pressure it reads. From there it's a matter of calculation: ADC reading to V to mA to pressure.
wvmarle:
See datasheet. No doubt it's explained in detail how the output (in mA) of the sensor relates to the pressure it reads. From there it's a matter of calculation: ADC reading to V to mA to pressure.
The datasheet is on this website. This is the sensor in use, and the datasheet says nothing about the conversion. Currently I am thinking I can go from ADC output > Voltage > to pressure?
0--250 psi, 4--20mA current loop output.
0psi = 4mA
250pis = 20mA.
As its a current output you'll need a shunt resistor to convert this to a voltage in the
range 0..5V.
MarkT:
0--250 psi, 4--20mA current loop output.0psi = 4mA
250pis = 20mA.As its a current output you'll need a shunt resistor to convert this to a voltage in the
range 0..5V.
So the range of the ADC pin on this board is 0 - 3.3V. I added a 150 ohm resistor to limit the 4-20mA signal to 0.6V to 3.0V.
queenlexi13:
Currently I am thinking I can go from ADC output > Voltage > to pressure?
No.
Go from A/D values directly to pressure.
-
Write a simple sketch that only prints the A/D values, and see what values you're getting without pressure.
That offset value must of course be subtracted from the A/D readings. -
Max pressure, as a result, must have a value five times that value (4-20mA).
See if it's within the range of the A/D, near it's max. Otherwise your sense resistor is wrong. -
Formula is now:
(float) pressure = (analogRead(A0) - offset) * someFactor;
someFactor depends on what you want to display. BAR, PSI, KPa.
In your case, for the 250PSI readout, 250/(4*offset)= ~0.3125
Leo..
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.