ทำความรู้จักกับ Sensor water flow

IOT - Internet of things
ไอโอที (IoT) หมายถึงเครือข่ายของวัตถุ อุปกรณ์ พาหนะ สิ่งปลูกสร้าง และสิ่งของอื่นๆ ที่มีวงจรอิเล็กทรอนิกส์ ซอฟต์แวร์ เซ็นเซอร์ และการเชื่อมต่อกับเครือข่าย ฝังตัวอยู่ และทำให้วัตถุเหล่านั้นสามารถเก็บบันทึกและแลกเปลี่ยนข้อมูลได้

Moderator: mindphp, ผู้ดูแลกระดาน

Patipat
PHP Super Hero Member
PHP Super Hero Member
โพสต์: 996
ลงทะเบียนเมื่อ: 10/06/2019 10:12 am

ทำความรู้จักกับ Sensor water flow

โพสต์ที่ยังไม่ได้อ่าน โดย Patipat »

วันนี้จะมานำเสนอการประยุกต์ใช้เซนเซอร์วัดอัตราการไหลของน้ำ (Water Flow Sensor) โดยต่อร่วมกับไมโครคอนโทรลเลอร์ NodeMCU(ESP8266) เพื่อตรวจสอบและวัดการไหลของน้ำ ความรู้ที่ได้นี้ สามารถนำไปประยุกต์ใช้ได้เช่น อาจจะนำไปประยุกต์ตรวจสอบค่าน้ำ หรือ ตรวจสอบน้ำว่าสถานะของน้ำปิด หรือ เปิด หรืออาจจะนำไปประยุกต์ใช้กับโปรเจคใหญ่ๆ ได้ใน Smart home , Smart fram ได้เลย คำนวณค่าน้ำได้ในแต่ล่ะ วัน, เดือน, หรือปี ได้ สามารถนำไปแสดงค่าบน Smart phone ได้
ศึกษาเพิ่มเติมเกี่ยวกับ Intenet of thing
ส่วนนี้เป็น ตัว Sensor water flow
Selection_999(023).png
Selection_999(023).png (75.05 KiB) Viewed 2157 times
ของที่ต้องเตรียม
1. Sonsor water flow
2. สายไฟจั๊มเล็ก
3. bread board
4. บอร์ด NodeMCU(esp8266)

ทำการเขียนโค๊ดลงโปรแกรม Arduno IDE ขั้นตอนการติดตั้งArduino IDE
ตัวอย่าง โค๊ด

โค้ด: เลือกทั้งหมด

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
Kor ma di kub. :)
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 31