G1/2 Water Flow Sensor (SEN-HZ21WA) [S135]
https://www.youtube.com/watch?v=NLIilod1J9E
*GitHub : https://github.com/rdiot/rdiot-s135.git
* Specs
Mini. Wokring Voltage: DC 4.5V
Max. Working Current: 15mA (DC 5V)
Working Voltage: DC 5V~24V
Flow Rate Range: 1~30L/min
Load Capacity: ≤10mA (DC 5V)
Operating Temperature: ≤80℃
Liquid Temperature: ≤120℃
Operating Humidity: 35%~90%RH
Water Pressure: ≤1.75MPa
Storage Temperature: -25~+ 80℃
Storage Humidity: 25%~95%RH
* Content
- Connect
Red ---- 5V
Yellow ----- P10k(5V) ----- D2
Black ----- GND
- Key Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // LCD2004
volatile int NbTopsFan; //measuring the rising edges of the signal
int Calc;
int hallsensor = 2; //The pin location of the sensor : D2
void rpm () //This is the function that the interupt calls
{
NbTopsFan++; //This function measures the rising and falling edge of the hall effect sensors signal
}
void setup()
{
Serial.begin(9600);
pinMode(hallsensor, INPUT);
attachInterrupt(0, rpm, RISING); //and the interrupt is attached
}
void loop()
{
NbTopsFan = 0; //Set NbTops to 0 ready for calculations
sei(); //Enables interrupts
delay (1000); //Wait 1 second
cli(); //Disable interrupts
Calc = (NbTopsFan * 60 / 7.5); //(Pulse frequency x 60) / 7.5Q, = flow rate in L/hour
Serial.print (Calc, DEC); //Prints the number calculated above
Serial.println (" L/hour");
}
'2) Sensor > Water' 카테고리의 다른 글
Water Level Sensor v1.0 [S094] (0) | 2016.09.07 |
---|---|
Raindrops Detection Sensor Modue (FC-37) [S072] (0) | 2016.09.07 |
Water Level Sensor [S028] (0) | 2016.09.07 |