1

I am working with an Arduino Mega, a 12V micro air pump, and a MP3V5050 air pressure sensor. The sensor outputs an analog voltage depending on the pressure reading in an inflatable member. I'd like to turn on the micro air pump when the pressure is too low and turn off the pump when the pressure exceeds a determined threshold (exact pressure ranges are currently undetermined).

I have been looking for similar tutorials but this is my first experience working with Arduinos and most existing tutorials are either sensing or pump control, not both. I only have minor coding experience with MATLAB, so any help with this is appreciated. Thank you!

Elizabeth
  • 11
  • 1

1 Answers1

2

So you basically want a hysteresis control for the air pump.

const int lowerLimit;//fill in as needed
const int upperLimit;

void loop(){
    int pressure = readPressureSensor();
    if(pressure < lowerLimit) turnPumpOn();
    if(pressure > upperLimit) turnPumpOff();

}

The helper functions I used should be easy to implement based on the tutorials you found.

ratchet freak
  • 3,267
  • 1
  • 13
  • 12