Gravity__Water_Pressure_Sensor_SKU__SEN0257-DFRobot

Analog Water Pressure Sensor

Introduction

This is a water pressure sensor that adopts DFRobot Gravity 3-pin interface. It supports standard 5V voltage input and 0.5~4.5V linear voltage output. It is compatible with multiple Arduino controllers. Coordinate with a DFRobot Gravity IO Expansion Shield, the water pressure sensor can be plugged into an Arduino board, wiring-free. Put it with a Solenoid Valve , a Water Turbine Generator and other sensors, you can build a smart water control system. Briefly speaking, this water pressure sensor is a stethoscope to a water pipe. It will help 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 detection.

Features

Specification

PinOut

SEN0257 PinOut-Water Preessure Sensor

Label Name Description
Yellow Signal(Output:0.5~4.5V) Analog Signal
Red VCC(5VDC) +
Black GND -

Input & Output

The monocrystallinesilicon is one interior material of the sensor. When monocrystallinesilicon material suffers force, it makes an infinitesimal change and an electronic level change of internal atom structure, which will also lead to a great change in resistivity (Factor H Mutation), so as the resistance. This physical effect is piezoresistive effect.

Based on the piezoresistive effect, a strain gauge is also a work of IC (integrated circuit) engineering technology. Its production process contains doping, diffusion and a crystal orientation of the substrate. A strain gauge makes a Wheatstone Bridge. Taking advantage of elasticity properties of special silicon material and heterosexual micro-machining the same silicon material in different directions, then a diffused silicon sensor comes into being. The sensor is force-sensitive and mechanical-electrical detective.

Equipped with an amplify circuit and other parts in need, enable the circuit to output a standard signal, the diffused silicon sensor makes a pressure transmitter.

SEN0257 Signal Production Process SEN0257 Signal Production Process

Tutorial

In this section, we'll show the basic sensor usage and a simple demo about pressure detector.

Demo: Read Water Pressure Value

Requirements

Connection Diagram(Arduino)

SEN0257 Analog Module Connection Diagram

Sample Code

Read Data by Serial Port.

/*!
 * @file  SEN0257.ino
 * @brief  Water pressure sensor demo(Computer serial port)
 * @n      - Obtain the water pressure through the output voltage
 * @n        of the sensor.
 * @copyright  Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @license  The MIT License (MIT)
 * @author  DFRobot
 * @version  V1.0
 * @date  2023-07-06
 */

/************************************************************
  Water Sensor Key Parameter
  - Parts No.:KY-3-5
  - Sensing range: 0 - 1 MPa
  - Input Voltage: 5VDC
  - Output Voltage: 0.5 - 4.5 VDC
    (Linearly corresponding to 0 - 1 MPa)
  - Accuary: 0.5% - 1% FS
**************************************************************/

/************************************************************
  Water Sensor Calibration

  The output voltage offset of the sensor is 0.5V (norminal).
  However, due to the zero-drifting of the internal circuit, the
  no-load output voltage is not exactly 0.5V. Calibration needs to
  be carried out as follow.

  Calibration: connect the 3 pin wire to the Arduio UNO (VCC, GND and Signal)
  without connecting the sensor to the water pipe and run the program
  for once. Mark down the LOWEST voltage value through the serial
  monitor and revise the "OffSet" value to complete the calibration.

  After the calibration the sensor is ready for measuring!
**************************************************************/

const float  OffSet = 0.483 ;

float V, P;

void setup()
{
  Serial.begin(9600);        // open serial port, set the baud rate to 9600 bps
  Serial.println("/** Water pressure sensor demo **/");
}
void loop()
{
  //Connect sensor to Analog 0
  V = analogRead(0) * 5.00 / 1024;     //Sensor output voltage
  P = (V - OffSet) * 250;             //Calculate water pressure

  Serial.print("Voltage:");
  Serial.print(V, 3);
  Serial.println("V");

  Serial.print(" Pressure:");
  Serial.print(P, 1);
  Serial.println(" KPa");
  Serial.println();

  delay(500);
}

Demo: DIY a Simple Water Pressure Detector

Requirements

Connection Diagram

SEN0257 Water Pressure Detector

Sample Code

Please download the LCD library: DFRobot RGB LCD.How to install Libraries in Arduino IDE.

Read Data by LCD1602 Display.

/*!
 * @file  SEN0257.ino
 * @brief  Water pressure sensor demoB(LCD1602)
 * @n      - Obtain the water pressure through the output voltage
 * @n        of the sensor.
 * @copyright  Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @license  The MIT License (MIT)
 * @author  DFRobot
 * @version  V1.0
 * @date  2023-07-06
 */

/************************************************************
  Water Sensor Key Parameter
  - Parts No.:KY-3-5
  - Sensing range: 0 - 1 MPa
  - Input Voltage: 5VDC
  - Output Voltage: 0.5 - 4.5 VDC
    (Linearly corresponding to 0 - 1 MPa)
  - Accuary: 0.5% - 1% FS
**************************************************************/

/************************************************************
  Water Sensor Calibration

  The output voltage offset of the sensor is 0.5V (norminal).
  However, due to the zero-drifting of the internal circuit, the
  no-load output voltage is not exactly 0.5V. Calibration needs to
  be carried out as follow.

  Calibration: connect the 3 pin wire to the Arduio UNO (VCC, GND and Signal)
  without connecting the sensor to the water pipe and run the program
  for once. Mark down the LOWEST voltage value through the serial
  monitor and revise the "OffSet" value to complete the calibration.

  After the calibration the sensor is ready for measuring!
**************************************************************/

#include <Wire.h>
#include "DFRobot_RGBLCD1602.h"                          //LCD头文件
const float  OffSet = 0.483 ;
float V;
int P;
unsigned int lcdR = 0, lcdG = 0, lcdB = 0;
unsigned long delaytime = 0, lighttime = 0;

/*
Change the RGBaddr value based on the hardware version
-----------------------------------------
       Moudule        | Version| RGBAddr|
-----------------------------------------
  LCD1602 Module      |  V1.0  | 0x60   |
-----------------------------------------
  LCD1602 Module      |  V1.1  | 0x6B   |
-----------------------------------------
  LCD1602 RGB Module  |  V1.0  | 0x60   |
-----------------------------------------
  LCD1602 RGB Module  |  V1.1  | 0x2D   |
-----------------------------------------
*/
DFRobot_RGBLCD1602 lcd(/*RGBAddr*/0x60 ,/*lcdCols*/16,/*lcdRows*/2);  //16 characters and 2 lines of show

void setup()
{
  lcd.init();
  delay(5000);
  Serial.begin(115200);
  Serial.println("hello start");
  lighttime = millis();
  lcd.setCursor(0, 0);
  lcd.print("Water Pressure:");
  lcd.setRGB(255, 255, 0);
}

void loop()
{
  lcdR = random(256);
  delayMicroseconds(10);
  lcdG = random(256);
  delayMicroseconds(10);
  lcdB = random(256);
  if (millis() - lighttime > 3000)
  {
    lcd.setRGB(lcdR, lcdG, lcdB);
    lighttime = millis();
  }
  //delay(100);

  V = analogRead(5) * 5.00 / 1024;                    //Sensor output voltage
  P = (V - OffSet) * 250 * 10;                        //Calculate water pressure
  lcd.setCursor(3, 1);

  lcd.print(  P / 10000 % 10);                       //LCD显示
  lcd.print(  P / 1000 % 10);
  lcd.print(   P / 100 % 10);
  lcd.print(   P / 10 % 10);
  lcd.print('.');
  lcd.print(  P  % 10);
  lcd.print(" kPa");
}

Expected Results

SEN0257 Water Pressure Display

Installation

SEN0257 Tube Water Pressure Detection SEN0257 Tube Water Pressure Detection

NOTE: 1.To guarantee the interface tightness, you need to install a waterproof nut and bind PTFE tape.
2.Please take necessary measures to avoid large pressure involved during usage.

FAQ

If you have any questions about using this product, please check the FAQ list for that product for a corresponding solution. For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

<File:SEN0257_Dimension.png>