Pressure level sensor

Hi,
I am trying to evaluate a DFRobotic Pressure level sensor and interface it with an Arduino UNO as outlined in the pdf documentation. That can be read HERE

The setup seems very straight forward. The sensor reads between 0 and 5m of liquid. I am using water. The documentation states the input voltage to the sensor is between 12 and 36v. I am using a 12v transformer with an output of about 13v. The connections to the UNO are as per the diagram.

I am also using the example code with no alterations.

/***********************************************************
DFRobot Gravity: Analog Current to Voltage Converter(For 4~20mA Application)
SKU:SEN0262
GNU Lesser General Public License.
See <http://www.gnu.org/licenses/> for details.
All above must be included in any redistribution
****************************************************/
#define ANALOG_PIN A1
#define RANGE 5000 // Depth measuring range 5000mm (for water)
#define CURRENT_INIT 4.00 // Current @ 0mm (uint: mA)
#define DENSITY_WATER 1 // Pure water density normalized to 1
#define DENSITY_GASOLINE 0.74 // Gasoline density
#define PRINT_INTERVAL 1000
int16_t dataVoltage;
float dataCurrent, depth; //unit:mA
unsigned long timepoint_measure;
void setup()
{
Serial.begin(9600);
pinMode(ANALOG_PIN, INPUT);
timepoint_measure = millis();
}
void loop()
{
if (millis() ‐ timepoint_measure > PRINT_INTERVAL) {
timepoint_measure = millis();
dataVoltage = analogRead(ANALOG_PIN);
dataCurrent = dataVoltage / 120.0; //Sense Resistor:120ohm
depth = (dataCurrent ‐ CURRENT_INIT) * (RANGE/ DENSITY_WATER / 16.0); //Calculate
depth from current readings
if (depth < 0) depth = 0.0;
//Serial print results
Serial.print("depth:");
Serial.print(depth);
Serial.println("mm");
}
}

I am placing the sensor in a 5lt container and slowly filling up the container. The output to serial print doesn't change regardless of the volume in the container. I checked with my multimeter and it looks like I am getting about 105mah when out of water or in about 6" of water. But the reading doesn't change.

Can anyone see an issue with the connections or the example code?

Thanks

It does not measure volume, it measures depth.
There will be very little output change in only 6" of water

I checked with my multimeter and it looks like I am getting about 105mah when out of water or in about 6" of water.

It should measure between 2mA and 40ma. If not, it may be damaged

1 Like

If you mean mA, either the sensor is defective, or you are measuring the sensor current incorrectly. The current should always be between 4 and 20 mA.

Please explain exactly how you measured the sensor current.

"mAh" is a measure of battery capacity. What are you trying to measure here, voltage, current, or ?

Please stick to either metric or imperial. Preferably metric.

I'm not sure this is a good idea. With an unregulated transformer, the output voltage will vary with the current drawn from the transformer. Your sensor is trying to control the current based on pressure, but if it's input voltage varies as it is attempting to control the current, who knows what the result will be.

I think you should use a regulated 12V supply.

Thanks for your replies. I'm thinking that 12v is at the lower end so not reading properly. I will get hold of a regulated 24v power supply and see how that that goes.

It is supposed to give a mAh value between 4 and 120

It is depth that I am trying to measure. I had it in a 5lt container about 25cm high and filled from 0 to full so was expecting a reading to vary with the changing depth, but the reading didn't change. It stayed at 0mm. I'll report back once I try the higher voltage.

Thanks

DFRobot recommends letting it warmup for 30 minutes.
I don't think you will see any change unless you pour the water very very very slowly.

NO. Please read the data sheet you linked in post #1.

The sensor output current ranges from 4 to 20 mA (milliAmperes) depending on the pressure.

Use a regulated DC power supply for the sensor, and a 4 to 20 mA interface for the Arduino.

My typo I agree 4 to 20 ma. I am only getting 3.7 empty and this value doesn't change even when immersed. So I am concluding that the power supply is part of the issue. I can get hold of a 24v power supply tomorrow and will try it again.

Thanks

I see the air pipe may be blocked by bending the tube, etc.

That's something I did wonder about but the pipe hasn't been bent in any way beyond the initial coiling. No obvious kinks. I did wonder about the terminal as it has shrink plastic but there is a gap. Thanks

Or the sensor is defective.

That's something I can't rule out yet. If changing the power supply doesn't change anything then it has to be a possibility. Thanks

A quick test would be to SUCK on the end of the air vent tube!!!!

Good idea. I'll try that.

You should not get less than 4mA
Did you let it warm up and stabilize before you took a reading?

I left it running for about an hour, but no difference in the reading. It stayed at 3.7 the whole time whether immersed or not.

I hopefully will get a 24v power supply later today (assuming Amazon delivery on time) so will try that and see if there is a difference. Fingers crossed.

Why are you reading the current and not the voltage output from the converter board?

When I measure the voltage. The converter board is wired with red 5v from Uno, GND, and Blue to A1. I am getting 4.8v from the uno connected to the Red wire and 0.11v on the blue signal wire. The sensor was dry.

When I measure across the sensor V in and V out on the board I get 3.7mA with the sensor dry. That reading doesn't change wet or dry. Which is why I suspect the power supply which is marked as 12v 1Amp supply, although I get 13v.

You can't measure current that way. You are basically shorting out the sensor output. Hopefully nothing was damaged.
You should only read the converter board output voltage.
0.11V indicated that something is wrong.
If the power supply reads 13V, then I suspect that the sensor or converter board is damaged.