G1/4 유량 센서 -YF-S402B
(G1/4 Water Flow Sensor -YF-S402B)
개요
- 본 제품은 G1/4 유량 센서 -YF-S402B입니다.
- 물이나 액체의 흐름을 측정하는 프로젝트에 필요한 센서로, 물이나 액체의 흐름을 측정하는데 사용합니다.
- 본 센서는 수도관이나 액체를 전달하는 관에 위치하여 얼마나 많은 액체가 통과하였는지를 측정합니다.
- 이를 위해서 센서내에는 자석이 붙어 있는 휠이 있고, 다른 쪽 플라스틱 튜브에는 hall effect magnetic 센서가 있어 얼마나 휠이 회전하였는지를 알수 있습니다.
- 센서의 케이블은 3선이며 빨강(5-15VDC), 검정(그라운드), 노랑(hall effect pulse output)색입니다.
- 센서 출력에서 펄스를 카운트하여 쉽게 액체 흐름을 트랙킹할 수 있습니다.
- 유량센서의 출력 펄스는 물이 흐른 양에 비례합니다.
- 펄스 주파수 = Flow * 38입니다. 만약 출력 주파수가 72이라면 유량은 72/38 = 2(L/min) 입니다.
- 아두이노와 같은 마이크로컨트롤러와 아래와 같이 연결합니다.
특징
Connect PE pipe: 6mm
Color :white
Flow rate : 0.3~6 L/min (Flow pressure Must start up turn the turbine running)
Flow Pulse: F(Hz)=(38xQ) L/min +/- 3 %
Max. Working Current : 15mA (DC5 V)
Min. Working Voltage: DC 4.5V
Working Voltage:DC 5V~15V
Load Capacity: =10 mA (DC 5 V)
Pressure :0.8mPa
Operating Working Temperature :
0 Degree centigrade to +60 Degree centigrade
Accuracy :+- 3%
wire connection : RED : + ; Black : - ; Yellow : NPN signal Pulse output.
문서
- 센서의 VCC- 5V, Gnd - Gnd, SIG를 아두이노 핀 2번에 연결합니다.
- 아래의 아두이노 코드를 아두이노에 업로드하고 테스트합니다.
volatile int NbTopsFan; //measuring the rising edges of the signal
int Calc;
int hallsensor = 2; //The pin location of the sensor
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
}
// The setup() method runs once, when the sketch starts
void setup() //
{
pinMode(hallsensor, INPUT); //initializes digital pin 2 as an input
Serial.begin(9600); //This is the setup function where the serial port is initialised,
attachInterrupt(0, rpm, RISING); //and the interrupt is attached
}
// the loop() method runs over and over again,
// as long as the Arduino has power
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 / 38); //(Pulse frequency x 60) / 38Q, = flow rate in L/hour
Serial.print (Calc, DEC); //Prints the number calculated above
Serial.print (" L/hour\r\n"); //Prints "L/hour" and returns a new line
}