How to appropriately connect the FS1012-1002-C01-LQ to a Opamp and to the arduino?

Hello, I recently acquired the FS1012-1002-C01-LQ flow rate sensors for my thesis experimentation setup and I have been having troubles with the output voltage readings in my Arduino. I was wondering if I could be helped with this. I will provide more information. My experimental setup consists on 2 12V DC water pumps and the 2 flow rate sensors to monitor the flow rate these pumps are supplying and I plan to create a simple P-controller using the information of the sensors on flow rate to control the speed of the motor through voltage. In my circuit I have two things going on. The first part of the circuit, consists on having a N-type MOSFET transistor that is used to control the amount of voltage i am supplying to the 12V DC motors and I am using PWM to control the gate of the transistor. The second part of my circuit I have these FS1012-1002-C01-LQ flow rate sensors connected to an Opamp named Opa244 and I am using the single ended circuit (using the non inverting configuration) with the TP2 since I only want to measure fluid. Here I share my circuit configuration.

The problem that I am having is the following:

1. The arduino is reading nonsense values when reading the voltage at the Opamp output but when I disconnect the ground of the arduino that is connected to the transistor circuit, the voltage values that the arduino is reading gets "fixed" and reads a constant value. What is even more strange is that if i send a signal to the gate of the transistor, the voltage readings of the sensor lowers as if there is flow passing by but because the ground is disconnected from the arduino to the transistor circuit the motors do not activate therefore no flow is actually. happening.

2. In the diagram, I use 2 1K ohm resistors for the Opamp circuit but it is just an illustration. I am wondering what is the best way to set the Gain if the behavior of the sensor is not fully linear as from 0 to 0.1 SLPM it has a different slope than from 0.1 to 1 SLMP. Initially I set a gain of 50x because the range that I will be operating is from 0 to 0.1 SLPM but any tips on how to appropriately find the correct gain is also much appreciated. 

I tried connected a grounding cable to both the transistor circuit and Opamp and I still get the same result of nonsense voltage readings. I also tried using a different power source than the arduino 5V to power both the sensor and Opamp and still the same.

This is my first time using Opamps so I am still learning how to use them. In theory it seems simple enough but I am having these issues that I do not know how to solve. If more information is needed please let me know.

Here is my code and the spreadsheet of the Opamp.

//Motor 1 digtal pins

int motor1_Controlpin = 3;

//Motor 2 digtal pins

int motor2_Controlpin = 5;

//pulsation delay
int Motor_1_delayTime = 25;
int Motor_2_delayTime = 25;


//Voltage reading
int readPin = A0;
int readBits1;
float Volt1 = 0;
int PrintdelayTime = 50;


void setup() {
  // put your setup code here, to run once:

  pinMode(readPin, INPUT);
  Serial.begin(9600);

  pinMode(motor1_Controlpin, OUTPUT);
 
  pinMode(motor2_Controlpin, OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:

  readBits1 = analogRead(readPin);
  Volt1 = (5./1023.) * readBits1;
  Serial.println(Volt1);
  delay(PrintdelayTime);
  
  analogWrite(motor1_Controlpin, 70); // analogWrite (pin, 0) = 0V i.o.w off! 
  delay(Motor_1_delayTime);
  analogWrite(motor1_Controlpin, 0); // analogWrite (pin, 0) = 0V i.o.w off! 
  delay(Motor_1_delayTime);// analogWrite (pin, 255) = 12V i.o.w max speed!

  analogWrite(motor2_Controlpin, 90); // analogWrite (pin, 0) = 0V i.o.w off! 
  delay(Motor_2_delayTime);
  analogWrite(motor2_Controlpin, 0); // analogWrite (pin, 0) = 0V i.o.w off! 
  delay(Motor_2_delayTime);// analogWrite (pin, 255) = 12V i.o.w max speed!
  
  
}

 

  • Hi KO!

    Thank you for the request. Your request in our Renesas Flow sensor is very valuable to us. We have acknowledged your request; we are working on that and very soon we will give you update regarding this.

    Regards:

    Raja.

  • Hi,

    I have gone through your circuit schematic, and I have marked some changes in your schematic please do that changes and share the latest results with us so that I could better understand sensor behaviors in more detail and one more thing I observed that you told initially you set the gain 50, Can you please tell me how you can set the gain 50 using same resistance value that you have used in opamp?

    The FS1012 requires a full amplification circuit and microcontroller for most applications. Depending on your flow range, you will need to set the amplification properly, scaling the FS1012 output to your full flow range. Apart from that, you can also conduct another setup without using the opamp and observed the reading and after you connect opamp and measured those reading and also share those reading with us so that I would understand the sensor behavior in better way.

     

    Regards:

    Raja.

  • Greetings Raja, 

    Thank you for the reply. I made a mistake when making the circuit schematic, I indeed connected the arduino 5V into the circuit just like you mentioned. I tried connecting the extra ground just as you mentioned and I still get the same uncontrolled readings. I will show you what happens when I connect the ground of the arduino to the circuit.

    When I turn on the motor to push the fluid, the readings do not change and stays doing this. What is more strange is that when I use a multimeter to measure the voltages, the multimeter outputs 4.30 when there is no flow and around 3.8V when there is flow. 

    In regards to the gain. In the circuit diagram I placed two of the same resistors but it was just to illustrate how I am setting up the circuit. The way I am setting a gain of 50 is by placing resistors in series that connect from the Vout of the Opamp. Since the gain in the non inverse Opamp is measured by 1+R1/R2. In this case R1 would be the one connected directly to the Vout. I set a gain of 50 because the range that I want to use from to sensor is 0 to 0.1SLMP. I wanted to set that at 0.1SLPM the arduino would read 5V minus the 0.70V that the sensor takes. 

    Kind Regards,

  • Hi,

    Thank you for the response. I am working on your issue just give some time, meanwhile I have attached application notes please go through that and check your Arduino codes with the reference one and please let me know if the problem persists.

    /cfs-file/__key/communityserver-discussions-components-files/291/Application-Note_5F00_User-Guide-for-FS1012-Flow-Sensor-with-Arduino-Uno.docx

    Regards:

    raja.