![]() I would like to point out that the atmega328p is equipped with Input CaPture hardware (ICP1) which can improve the time measurement. AthulSNair has shown an Interrupt method, which is most likely what you want to do. Most are not very accurate because that requires machining the turbine and the flow cross-section precisely. How much accuracy you want will determine how you will measure the pulse times, and if you need to calibrate the flow meter. There is no harm with a low flow rate, but the readings may start to go wrong at about 10% of the rated max. ![]() The meter should say what the max flow is, I advise not going much over it. Fast flows may cause turbulence and even damage the turbine. ![]() At slow flow, some may partly bypass the turbine and not cause it to move enough to accurately measure the flow. Each pulse represents a volume of the fluid if operating within the sensors range. ![]() When it passes the sensor a pulse is made. Serial.print (" L/hour\r\n") //Prints "L/hour" and returns a new lineįlow sensors have historically sensed a metal turbine, or sometimes a magnet connected to a turbine or paddle wheel. Serial.print (Calc, DEC) //Prints the number calculated above NbTopsFan = 0 //Set NbTops to 0 ready for calculationsĬalc = (NbTopsFan * 60 / 7.5) //(Pulse frequency x 60) / 7.5Q, = flow rate the loop() method runs over and over again, Serial.begin(9600) //This is the setup function where the serial port isĪttachInterrupt(0, rpm, RISING) //and the interrupt is attached PinMode(hallsensor, INPUT) //initializes digital pin 2 as an input The setup() method runs once, when the sketch starts NbTopsFan++ //This function measures the rising and falling edge of the Void rpm () //This is the function that the interupt calls Int hallsensor = 2 //The pin location of the sensor Volatile int NbTopsFan //measuring the rising edges of the signal Code adapted by Charles Gantt from PC Fan RPM code written by Crenn http:/ Serial.print( node.// reading liquid flow rate using Seeeduino and Water Flow Sensor from do something with data if read is successful Result = node.readHoldingRegisters(m_startAddress, m_length) communicate with Modbus slave ID 2 over Serial (port 1) use Serial (port 0) initialize Modbus communication baud rate Please help out to solve this problem i am stuck at this from very long. Pins DE and RE are connected to arduino pin 3 for transmitting and receiving.All and other connections are also made perfectly like grounding and 5v to max485 from arduino.īut i can find why the code can't read the value and print on serial monitor instead of that it displays "err" message on serial monitor which means no response from meter. On other side of max485 D1 pin is connected to arduino pin tx1 and max485 R0 pin is connected to arduino pin Rx1. The negative pin of meter's rs485 is connected to the MAx485 pin B. The positive pin of meter's rs 485 is connected to the max 485 pin A. Hi, I want to read the water flow from meter basically which is water meter and has a rs 485 on meter backside which i have connected to arduino mega 2560 through another MAX485.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |