模拟量水压传感器

简介

本款水压传感器采用DFRobot Gravity标准3-Pin接口,标准5V供电,0.5~4.5V线性电压输出,可兼容各种Arduino控制器。配合DFRobot Gravity IO Expansion Shield,可直插Arduino。无需额外接线。 当它配合电磁阀、微型水流发电机以及其它传感器使用时,还可以通过编程和硬件组合的方式设计出许多智能的系统。可以说,水压传感器就像是贴着水管的听诊器,它会告诉你许多水的信息,包括水的强弱,水的有无。

应用场景

产品参数

引脚说明

标号 名称 功能描述
黄色 Signal 模拟信号端
红色 VCC 电源正极5V
黑色 GND 电源负极

输入输出关系和原理介绍

传感器内部有硅单晶材料,硅单晶材料在受到外力作用产生极微小应变时(一般步于400微应变),其内部原子结构的电子能级状态会发生变化,从而导致其电阻率剧烈变化(G因子突变)。用此材料制成的电阻也就出现极大变化,这种物理效应称为压阻效应。利用压阻效应原理,采用集成工艺技术经过掺杂、扩散,沿单晶硅片上的特点晶向,制成应变电阻,构成惠斯通电桥,利用硅材料的弹性力学特性,在同一切硅材料上进行各向异性微加工,就制成了一个集力敏与力电转换检测于一体的扩散硅传感器。给传感器匹配一放大电路及相关部件,使之输出一个标准信号,就组成了一台完整的压力变送器。

信号产生流程
输入输出关系

使用教程

Arduino 串口数据读取

模拟模块连接示意图

串口显示代码

/************************************************************
       Water pressure sensor demo(Computer serial port)
       - Obtain the water pressure through the output voltage
         of the sensor.
    **************************************************************/

/************************************************************
  Water Sensor Key Parameter
  - Parts No.:KY-3-5
  - Sensing range: 0 - 1.6 MPa
  - Input Voltage: 5VDC
  - Output Voltage: 0.5 - 4.5 VDC
    (Linearly corresponding to 0 - 1.6 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) * 400;             //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);
}

做一个简易的水压检测仪

连接图

水压检测仪

LCD1602显示代码

点击下载LCD库文件库和例程下载如何安装库?

/************************************************************
       Water pressure sensor demoB(LCD1602)
       - Obtain the water pressure through the output voltage
         of the sensor.
    **************************************************************/

/************************************************************
  Water Sensor Key Parameter
  - Parts No.:KY-3-5
  - Sensing range: 0 - 1.6 MPa
  - Input Voltage: 5VDC
  - Output Voltage: 0.5 - 4.5 VDC
    (Linearly corresponding to 0 - 1.6 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_RGBLCD.h>                          //LCD头文件
const float  OffSet = 0.483 ;
float V;
int P;
unsigned int lcd_r = 0, lcd_g = 0, lcd_b = 0;
unsigned long delaytime = 0, lighttime = 0;

DFRobot_RGBLCD lcd(16, 2);
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, 000);
}
void loop() {
  lcd_r = random(256);
  delayMicroseconds(10);
  lcd_g = random(256);
  delayMicroseconds(10);
  lcd_b = random(256);
  if (millis() - lighttime > 3000)
  {
    lcd.setRGB(lcd_r, lcd_g, lcd_b);
    lighttime = millis();
  }
  //delay(100);

  V = analogRead(0) * 5.00 / 1024;                    //Sensor output voltage
  P = (V - OffSet) * 400 * 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");

}

显示结果格式

安装水压传感器

注意

  1. 为了保证接口的密闭性,需要安装防水垫片并在螺丝口缠绕适量的生料带;
  2. 由于压力传感器所涉压力一般较大,所以使用时应做好一定的防护措施;

疑难解答

更多问题及有趣的应用,请访问论坛

更多

DFshopping_car1.png DFRobot商城购买链接