Ifm flowsensor to arduino

It's not a real accurate device.
At 0.2 LPM the error is +/- 0.266 LPM, which means that if you are actually measuring 0.2 the real flow could be anywhere between -0.066 and 0.466. At 50 LPM the error is +/- 4.25 LPM

i used this but in pipe no flow still showing me values in minus -1.2 mls to 6 mls

// Define the analog input pin (for sensor's voltage output)
const int sensorPin = A0;  // Connect the sensor output to A0

// Flow rate parameters for SM7050 (4-20mA to 0.2-50 LPM conversion)
const float minVoltage = 0.88;  // Voltage corresponding to 0.2 LPM
const float maxVoltage = 4.4;   // Voltage corresponding to 50 LPM

void setup() {
  // Initialize Serial Monitor for debugging
  Serial.begin(9600);
  Serial.println("Starting flow rate measurement...");
}

void loop() {
  // Read the analog value from the sensor
  int sensorValue = analogRead(sensorPin);
  
  // Convert the sensor value (0-1023) to a voltage (0-5V)
  float voltage = sensorValue * (5.0 / 1023.0);
  
  // Compute the flow rate using the given formula
  float flowRateLPM = (14.148 * voltage) - 12.25;
  
  // Convert flow rate from LPM (liters per minute) to mL/s (milliliters per second)
  float flowRateMLsec = flowRateLPM * 1000.0 / 60.0;  // 1 LPM = 1000 mL / 60 seconds
  
  // Print the flow rate in mL/s to the Serial Monitor
  Serial.print("Flow Rate: ");
  Serial.print(flowRateMLsec);
  Serial.println(" mL/s");
  
  // Add a small delay for readability (1 second)
  delay(1000);  // Update every 1 second
}

It's not a real accurate device.
At 0.2 LPM the error is +/- 0.266 LPM, which means that if you are actually measuring 0.2 the real flow could be anywhere between -0.066 and 0.466. At 50 LPM the error is +/- 4.25 LPM

thats why i am getting - value even there is no flow in real ?

Yes

i used this but in pipe no flow still showing me values in minus -1.2 mls to 6 mls

That makes sense. Any flow below about 0.5 could show a negative value, which means real flows below 0.5 cannot be measured

Maybe this sensor was not the best choice for you application.

Hi, @js13ropa
How are you testing your flow sensor?

Can you draw a diagram or post some pics ofy our test arrangement.

When you have zero flow, you still have a constant head of water connected to the input of the sensor.
How are you measuring the actual flow to calibrate the sensor?

Thanks.. Tom.... :grinning: :+1: :coffee: :australia:

If you are trying to measure low flow rates like below 1LPM then that sensor was not a good choice.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.