它裝在熱水器進水端,用于檢測進水流量,當水通過水流轉子組件時,磁性轉子轉動并且轉速隨著流量變化而變化,霍爾傳感器輸出相應脈沖信號,反饋給控制器,由控制器判斷水流量的大小,進行調控。
1 紅 IN 接正極
2 黃 OUT 信號輸出線
3 黑 GND 接負極
以1L/min的流速為列,就是7.5 * 1* 60就等于流過1升水輸出的脈沖個數
電壓:3.5-24VDC,電流不能超過10mA,流完一升水輸出450個脈沖
即頻率計算= 常數7.5 * 單位流量(L/min) * 時間(秒)
流量范圍:1-30L/min
YS-201.jpg (72.88 KB, 下載次數: 85)
下載附件
2021-1-6 14:55 上傳
Arduino源程序如下:
- EFFECT HALL FLOWMETER
- TECHNICAL DETAILS
- Electrical:
- Working Voltage: 5 to 18VDC
- Max current draw: 15mA @ 5V
- Working Flow Rate: 1 to 30 Liters/Minute
- Working Temperature range: -25 to 80°C
- Working Humidity Range: 35%-80% RH
- Maximum water pressure: 2.0 MPa
- Output duty cycle: 50% +-10%
- Output rise time: 0.04us
- Output fall time: 0.18us
- Flow rate pulse characteristics:
- Flow rate: 1 pulse/s = 7.5 L/min
- Acumulated volume: 1 Liter = 450 pulses
- maximum pulse frequency: 30 L/min-> 225 imp/s -> min period 4.44 ms (delta 0.1 L/min->0.015 ms)
- 5 L/min-> 37.5 imp/s-> period 26.66 ms (delta 0.1 L/min->0.523 ms)
- minimun pulse frequency: 1 L/min-> 7.5 imp/s -> max period 133.3 ms (delta 0.1 L/min->12.1 ms)
- Durability: minimum 300,000 cycles
- Mechanical:
- 1/2" NPS nominal pipe connections, 0.78" outer diameter, 1/2" of thread
- Size: 2.5" x 1.4" x 1.4"
- v02 Add LCD display
- The circuit:
- * LCD RS pin to digital pin 12
- * LCD Enable pin to digital pin 11
- * LCD D4 pin to digital pin 10
- * LCD D5 pin to digital pin 9
- * LCD D6 pin to digital pin 8
- * LCD D7 pin to digital pin 7
- * LCD R/W pin to ground
- * 10K resistor:
- * ends to +5V and ground
- * wiper to LCD VO pin (pin 3)
- */
- #include "PulseSensor.h"
- #include <LiquidCrystal.h>
- //#define PulseGen A0 //Pulse generate 5KHz, A0
- #define LED13 13
- #define REFRESH_INTERVAL 1000 // refresh time, 1 second
- #define WRITE_INTERVAL 2000 // values send to serial port, 2 seconds (2 * 1000)
- #define PULSE_PIN 2 // see external interrupt pins available on your Arduino.
- #define HotSwitch 4 // control the heater switch on/off
- #define PULSES_2_LITERS 450 // coefficient conversion from pulses to liters
- #define PULSES_SEC_2_LITERS_MINUTE 7.5 // (450/60) coefficient conversion pulses/second from to liters/minute
- PulseSensor flowmeter; // instance to collect data
- //variables to process and send values
- //int RA0flag = 0;
- //int fireNumber = 0;
- float flowRate;
- float maxRate;
- float minRate;
- float acumFlow;
- float lastAcumFlow;
- boolean firstData;
- boolean Fireflag;
- //unsigned long previousMillis = 0;
- //unsigned long currentMillis = 0;
- LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
- /*
- ISR(TIMER1_OVF_vect)
- {
- TCNT1 = 0X85ED; // time 2s, 1s = 0XC2F6;
- RA0flag = 1; // - RA0flag;
- }
- */
- void setup()
- {
- /*
- cli(); //Turn off global interrupt
- TCCR1A = 0; //Register A is configured with PWM. Here we only use the timing function. In fact, it does not need to be configured
- TCCR1B = (1 << CS12) | (1 << CS10); //Register B is used to configure the timing function. Now it is configured with 1024 frequency division
- TCNT1 = 0X85ED; //The initial value of the counter,time 2s, 1s = 0XC2F6; TCNT1= 0XFFFF - 1 / (1024 *(1/16000000))= 0xFFFF –0x3D09=0XC2F6
- TIMSK1 = (1 << TOIE1); //Overflow interrupt enable
- sei(); //Turn on global interrupt
- */
- pinMode(HotSwitch, OUTPUT);
- pinMode(LED13, OUTPUT);
- lcd.begin(16, 2);
- lcd.print("Flowrate = ");
- lcd.setCursor(0, 1);
- lcd.print("litre/second");
- //Serial.begin(9600);
- //delay(1000);
- flowmeter.begin(PULSE_PIN, REFRESH_INTERVAL, PULSES_SEC_2_LITERS_MINUTE, PULSES_2_LITERS);
- //Serial.println("time(s), average flowrate(l/min), max rate, min rate, volume(liters)");
- //Serial.println("Realtime flowrate(litre/second)");
- firstData = false;
- Fireflag = false;
- flowRate = 0;
- maxRate = 0;
- minRate = 0;
- acumFlow = 0;
- digitalWrite(LED13, LOW);
- //tone(PulseGen, 5000);
- }
- void loop()
- {
- //sei();
- if (flowmeter.available())
- {
- flowRate = flowmeter.read();
- //Serial.println(flowRate);
- //lcd.setCursor(0, 1); //Setup LCD display
- //lcd.print(flowRate); //Display flowRate value
- /*
- if (!firstData) {
- if (maxRate < flowRate) maxRate = flowRate;
- if (minRate > flowRate) minRate = flowRate;
- }
- else {
- maxRate = flowRate;
- minRate = flowRate;
- firstData = false;
- }
- */
- if (!Fireflag) //Wait for flow enable
- {
- if (flowRate > 2.00)
- {
- digitalWrite(HotSwitch, HIGH);
- Fireflag = true;
- lcd.setCursor(0, 1); //Setup LCD display
- lcd.print(flowRate); //Display flowRate value
- }
- //if (flowmeter.available())
- //{
- //flowRate = flowmeter.read();
- //}
- }
- }
- if (Fireflag) //Wait for flow disable
- {
- /*
- currentMillis = millis();
- if (currentMillis - previousMillis >= WRITE_INTERVAL) {
- if (RA0flag)
- {
- previousMillis = currentMillis;
- RA0flag = 0;
- acumFlow = flowmeter.readAcum();
- //flowRate = (acumFlow - lastAcumFlow) * 60 * 1000 / WRITE_INTERVAL; //average flowrate
- lastAcumFlow = acumFlow;
- firstData = true;
- */
- //Serial.print(currentMillis / 1000);
- //Serial.print(",");
- /*
- Serial.print(flowRate);
- Serial.print(",");
- Serial.print(maxRate);
- Serial.print(",");
- Serial.print(minRate);
- Serial.print(",");
- Serial.println(acumFlow);
- */
- if (flowRate <= 0.00)
- {
- digitalWrite(HotSwitch, LOW);
- Fireflag = false;
- }
- /*
- if (acumFlow > 9000000.00) //9E+6, Floating-point numbers can be as large as 3.4028235E+38 and as low as -3.4028235E+38.
- {
- flowmeter.resetAcum();
- }
- */
- //}
- }
- }
復制代碼
51hei.png (6.01 KB, 下載次數: 100)
下載附件
2021-1-6 16:01 上傳
所有資料51hei提供下載:
flowmeter_v20201223.zip
(4.75 KB, 下載次數: 37)
2021-1-6 14:55 上傳
點擊文件名下載附件
|