ทำความรู้จักกับ Sensor water flow
Posted: 24/06/2019 6:42 pm
วันนี้จะมานำเสนอการประยุกต์ใช้เซนเซอร์วัดอัตราการไหลของน้ำ (Water Flow Sensor) โดยต่อร่วมกับไมโครคอนโทรลเลอร์ NodeMCU(ESP8266) เพื่อตรวจสอบและวัดการไหลของน้ำ ความรู้ที่ได้นี้ สามารถนำไปประยุกต์ใช้ได้เช่น อาจจะนำไปประยุกต์ตรวจสอบค่าน้ำ หรือ ตรวจสอบน้ำว่าสถานะของน้ำปิด หรือ เปิด หรืออาจจะนำไปประยุกต์ใช้กับโปรเจคใหญ่ๆ ได้ใน Smart home , Smart fram ได้เลย คำนวณค่าน้ำได้ในแต่ล่ะ วัน, เดือน, หรือปี ได้ สามารถนำไปแสดงค่าบน Smart phone ได้
ศึกษาเพิ่มเติมเกี่ยวกับ Intenet of thing
ส่วนนี้เป็น ตัว Sensor water flow ของที่ต้องเตรียม
1. Sonsor water flow
2. สายไฟจั๊มเล็ก
3. bread board
4. บอร์ด NodeMCU(esp8266)
ทำการเขียนโค๊ดลงโปรแกรม Arduno IDE ขั้นตอนการติดตั้งArduino IDE
ตัวอย่าง โค๊ด
การต่อวงจร
- IN สายสีแดง ต่อกับขั้ว +
- OUT สายสีเหลืองต่อกับ สัญญาณ
- สายสีดำต่อกับขั้ว -
ผลที่ได้คือ น้ำไหล xx ลิตร / ชั่วโมง
**สามารถนำไปประยุกต์ใช้ได้ต่อในโปรเจคใหญ่ ๆนะครับ
อ้างอิง : http://rtnakm.com/2017/12/17/water-flow-sensor-fs300a/
อ้างอิง : http://www.arduino.codemobiles.com/product/125/%E0%B9%80%E0%B8%8B%E0%B8%99%E0%B9%80%E0%B8%8B%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%A7%E0%B8%B1%E0%B8%94%E0%B8%AD%E0%B8%B1%E0%B8%95%E0%B8%A3%E0%B8%B2%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%84%E0%B8%AB%E0%B8%A5%E0%B8%82%E0%B8%AD%E0%B8%87%E0%B8%99%E0%B9%89%E0%B8%B3-water-flow-sensor-flowmeter-hall-water-control-1-30l-min-2-0mpa-flow-fl
อ้างอิง : https://www.9arduino.com/article/69/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99-code-water-flow-sensor-%E0%B8%81%E0%B8%B1%E0%B8%9A-arduino
ศึกษาเพิ่มเติมเกี่ยวกับ Intenet of thing
ส่วนนี้เป็น ตัว Sensor water flow ของที่ต้องเตรียม
1. Sonsor water flow
2. สายไฟจั๊มเล็ก
3. bread board
4. บอร์ด NodeMCU(esp8266)
ทำการเขียนโค๊ดลงโปรแกรม Arduno IDE ขั้นตอนการติดตั้งArduino IDE
ตัวอย่าง โค๊ด
Code: Select all
volatile int NbTopsFan; //measuring the rising edges of the signal
int Calc;
int hallsensor = 5;
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(5, 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 / 7.5); //(Pulse frequency x 60) / 7.5Q, = 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
}
- IN สายสีแดง ต่อกับขั้ว +
- OUT สายสีเหลืองต่อกับ สัญญาณ
- สายสีดำต่อกับขั้ว -
ผลที่ได้คือ น้ำไหล xx ลิตร / ชั่วโมง
**สามารถนำไปประยุกต์ใช้ได้ต่อในโปรเจคใหญ่ ๆนะครับ
อ้างอิง : http://rtnakm.com/2017/12/17/water-flow-sensor-fs300a/
อ้างอิง : http://www.arduino.codemobiles.com/product/125/%E0%B9%80%E0%B8%8B%E0%B8%99%E0%B9%80%E0%B8%8B%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%A7%E0%B8%B1%E0%B8%94%E0%B8%AD%E0%B8%B1%E0%B8%95%E0%B8%A3%E0%B8%B2%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%84%E0%B8%AB%E0%B8%A5%E0%B8%82%E0%B8%AD%E0%B8%87%E0%B8%99%E0%B9%89%E0%B8%B3-water-flow-sensor-flowmeter-hall-water-control-1-30l-min-2-0mpa-flow-fl
อ้างอิง : https://www.9arduino.com/article/69/%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B9%83%E0%B8%8A%E0%B9%89%E0%B8%87%E0%B8%B2%E0%B8%99-code-water-flow-sensor-%E0%B8%81%E0%B8%B1%E0%B8%9A-arduino