Analog Circuits Arduino Projects Electronic Circuits

How to Play with a Water Pressure Sensor?

Water Pressure Sensor is not a familiar everyday sensor for most electronics hobbyists and makers, so here’s an introductory tutorial on a popular water pressure sensor – the DFRobot Gravity: Analog Water Pressure Sensor. In this session, I’ll show you the basic sensor application and a simple demo on water pressure detection!

DFRobot Gravity – Introduction

The analog water pressure sensor from DFRobot compatible with multiple Arduino controllers runs on standard 5V voltage dc input and gives 0.5~4.5V dc linear output. The sensor can be used for water pressure detection of living environmental water systems, such as houses, gardens, farms, and outdoor environment such as rivers, lakes, sea, etc. The sensor with a pressure measurement range of 0~1.6 MPa adopts the DFRobot Gravity 3-pin interface: SIGNAL (Y) –VCC (R) – GND (B).

For more details, refer – https://www.dfrobot.com/wiki/index.php/Gravity:_Water_Pressure_Sensor_SKU:_SEN0257

Water Pressure Sensor - DFR Gravity Pinout

DF Robot Gravity: Analog Water Pressure Sensor

According to DFRobot, this analog water pressure sensor is a stethoscope to a water pipe helps you to diagnose whether there is water, how strong the water pressure is. It can be widely applied to smart home control systems (SCS), Internet of Things (IoT) and device detections. And by interfacing it with a Solenoid Valve and/or Water Turbine Generator we can build a smart water control system.

DFRobot Gravity – First Test

Although an Arduino is a quick solution for testing the water pressure sensor, I decided to build up a small module based on cheap analog components. Once I had the idea worked out I built a simple module with a bi-color LED provides a quick visual check, circuit of which is shown below.

Water Pressure Sensor Test Module Circuit

Water Pressure Sensor Test Module Circuit

This one is driven by a 5v dc supply. The key component here is the LM393 dual- comparator, with same reference and threshold but inverted between comparators to “toggle” them in tune with the inputted pressure level. The reference/threshold level can be set using trimpot P1. Note that the output voltage of DFR analog water pressure sensor is 0.5~4.5V (0~1.6 MPa) with a nominal offset of 500mV. The “MPa” – megapascal –  pressure unit is a x1000000 multiple of the Pascal unit which is the SI unit for pressure, and is mainly used to describe the pressure ranges and ratings of hydraulic systems.

Frankly, I’m too lazy to plumbery but I was keen to catch if my setup worked, so I blow gently on the sensor and got only a feeble response from the comparator (disquieted moments). Later I learned (from google) that the maximum lung pressure for an adult male during exhalation is close to 2.1psi (Pound-force per square inch), equivalent to 0.014478990288000001MPa, actually so small when compared to the DFR analog water pressure sensor’s measurement scale (0 ~ 232.06 psi / 0~1.6 MPa). Yes, that answers why I didn’t get a happy reading then. Quite a bit of work will be required to clear this in, and I might need to ask a plumber’s help to continue my experiments!

An unbiased hint: In India, you can pick the DFRobot Gravity: Analog Water Pressure Sensor from various online vendors including “Fab to Lab” and “MG Super Labs”. The unit price is in INR1000 to INR1500 range, but you may get it cheap from most Chinese vendors!

Water Pressure Sensor-Indian Sources

Water Pressure Sensor – Indian Sources

And finally here is a simple Arduino demo code to read the sensor data by Serial Port.

const float OffSet = 0.483 ; // See Calibration Note!
float V, P; // Voltage & Pressure
void setup()
{
Serial.begin(9600); 
Serial.println("/** Water Pressure Sensor Data **/");
}
void loop()
{
//Connect sensor’s output (SIGNAL) to Analog 0
V = analogRead(0) * 5.00 / 1024; 
P = (V - OffSet) * 400; 
Serial.print("Voltage:");
Serial.print(V, 3);
Serial.println("V");
Serial.print(" Pressure:");
Serial.print(P, 1);
Serial.println(" KPa");
Serial.println();
delay(1000);
}

Calibration Note

The nominal output voltage offset of the sensor is 500mV, but due to the zero-drifting of the internal circuit this may varies and an initial calibration setup is required. For calibration, connect the sensor’s 3 pin cable (VCC, GND, and SIGNAL) to the Arduino (+5V, GND, and A0) without attaching the sensor to the water pipe and run your demo program for once. Write down the lowest voltage value through the serial monitor and revise the “const float OffSet” value to complete calibration. After calibration, the sensor is ready for the intended purpose!

Leave a Comment

5 Comments