New to Arduino: Digital Flow meter controller input , PWM output

Hello all,

I am interested in using an Arduino Pro Mini to provide engine control for my senior design project. I am purchasing a small flow meter that has a digital output that is communicated through I2C (which I am unfamiliar with), and based on that airflow reading I want to send a PWM output to a servo on a needle valve to control fuel flow to the engine. I was planning to use an analog signal as my control input, but was limited by my teams low range of airflow. My question is whether this is a reasonable goal to achieve or if this can even be done with I2C. I have read online and in the forums that this controller is I2C compatible and can read I2C compatible sensors, so I am more concerned with after retrieving digital values and how to use them to control my PWM output. Any feedback and guidance would be greatly appreciated. Thanks!

I think you need to look at the specifics of that sensor vis-a-vis I2C. The Arduino wire library is a sort of “generic” I2C solution, but even then some devices need more specific I2C support on top of that.

Once you have the data out of it, it’s just a variable and you can do what you like with that, like command a servo to go to a certain position.

Along the lines of (very) pseudo code, where you would first have set a threshold that means something to you:

If mySensor > threshold
send servo to some position
else,
send servo to some other position.

Servos are easy to control; there’s a library and you just send it to a degree position. If you want finer control, you can define the width of the pulse in microseconds with a different command. Servo library takes care of the 50Hz repeat pulse that servos require to hold position.