Mini Air Pump Error

Hello,

I am currently working on a masters project where I am using an inflatable material that will inflate more rapidly when no one is detected and then once someone in detected the inflation will return to a more calm state (similar to that of a calming heartrate) I am using mini air pumps and an IR sensor to control this. I borrowed a code and set up the breadboard, but having trouble getting the air pumps to turn on. I will post the code and the circuit below. In the circuit diagram it shows A10 but however in my breadboard setup I used A5 as reflected in the code. Does anyone know why the air pumps are not bring activated?

// Include Libraries
#include "Arduino.h"
#include "Pump.h"


// Pin Definitions
#define IRPROXIMITY_PIN_VOUT	A5
#define VACCUMPUMP_1_PIN_COIL1	2
#define VACCUMPUMP_2_PIN_COIL1	3



// Global variables and defines

// object initialization
Pump vaccumpump_1(VACCUMPUMP_1_PIN_COIL1);
Pump vaccumpump_2(VACCUMPUMP_2_PIN_COIL1);


// define vars for testing menu
const int timeout = 10000;       //define timeout of 10 sec
char menuOption = 2;
long time0;
int sensorpin = 0;                 // analog pin used to connect the sharp sensor
int val = 0;  

// Setup the essentials for your circuit to work. It runs first every time your circuit is powered with electricity.
void setup() 
{
    // Setup Serial which is useful for debugging
    // Use the Serial Monitor to view printed messages
    Serial.begin(9600);
    while (!Serial) ; // wait for serial port to connect. Needed for native USB
    Serial.println("start");
    
    
     menuOption = menu();
    
}

// Main logic of your circuit. It defines the interaction between the components you selected. After setup, it runs over and over again, in an eternal loop.
void loop() 
{

      val = analogRead(sensorpin);       // reads the value of the sharp sensor
      Serial.println(val);            // prints the value of the sensor to the serial monitor
      delay(400); 
    
    if(val > 30)
    {
               if(menuOption = '2') {
              // Vacuum Pump - 12V #1 - Test Code
              // The water pump will turn on and off for 2000ms (4 sec)
               vaccumpump_1.on(); // 1. turns on
              delay(2000);       // 2. waits 500 milliseconds (0.5 sec).
              vaccumpump_1.off();// 3. turns off
              delay(2000);       // 4. waits 500 milliseconds (0.5 sec).
              menuOption = '3';

            }
              else if(menuOption = '3') {
                   // Vacuum Pump - 12V #2 - Test Code
              // The water pump will turn on and off for 2000ms (4 sec)
              vaccumpump_2.on(); // 1. turns on
              delay(2000);       // 2. waits 500 milliseconds (0.5 sec).
              vaccumpump_2.off();// 3. turns off
              delay(2000);       // 4. waits 500 milliseconds (0.5 sec).
              menuOption = '2';
    
             }
    } else {




   if(menuOption = '2') {
    // Vacuum Pump - 12V #1 - Test Code
    // The water pump will turn on and off for 2000ms (4 sec)
    vaccumpump_1.on(); // 1. turns on
    delay(2000);       // 2. waits 500 milliseconds (0.5 sec).
    vaccumpump_1.off();// 3. turns off
    delay(2000);       // 4. waits 500 milliseconds (0.5 sec).
    menuOption = '3';

    }
    else if (menuOption = '3') {
    // Vacuum Pump - 12V #2 - Test Code
    // The water pump will turn on and off for 2000ms (4 sec)
    vaccumpump_2.on(); // 1. turns on
    delay(2000);       // 2. waits 500 milliseconds (0.5 sec).
    vaccumpump_2.off();// 3. turns off
    delay(2000);       // 4. waits 500 milliseconds (0.5 sec).
    menuOption = '2';

    }
      
}

             

    
    if (millis() - time0 > timeout)
    {
        menuOption = menu();
    }
    
}



// Menu function for selecting the components to be tested
// Follow serial monitor for instrcutions
char menu()
{

    Serial.println(F("\nWhich component would you like to test?"));
    Serial.println(F("(1) Infrared Proximity Sensor Long Range - Sharp GP2Y0A02YK0F"));
    Serial.println(F("(2) Vacuum Pump - 12V #1"));
    Serial.println(F("(3) Vacuum Pump - 12V #2"));
    Serial.println(F("(menu) send anything else or press on board reset button\n"));
    while (!Serial.available());

    // Read data from serial monitor if received
    while (Serial.available()) 
    {
        char c = Serial.read();
        if (isAlphaNumeric(c)) 
        {   
            
            if(c == '1') 
    			Serial.println(F("Now Testing Infrared Proximity Sensor Long Range - Sharp GP2Y0A02YK0F - note that this component doesn't have a test code"));
    		else if(c == '2') 
    			Serial.println(F("Now Testing Vacuum Pump - 12V #1"));
    		else if(c == '3') 
    			Serial.println(F("Now Testing Vacuum Pump - 12V #2"));
            else
            {
                Serial.println(F("illegal input!"));
                return 0;
            }
            time0 = millis();
            return c;
        }
    }
}

Start by running the motors from their own power lines. Don't run them through the board.

I can't see how the pump motors are buffered.
Which motor drivers are you using?

I am using 4.5V mini air pumps

But how are you buffering them?
An I/O pin can't drive a motor directly, so what device is between the I/O pin and the motor?


Hopefully this image helps, I am new to arduino so I am not sure what you mean by buffering?

You also don't have a resistor in between the board output and the FET gate.

An I/O pin has an absolute maximum rating of 40mA.
The spec says the pump motor draws 600mA.

See the problem?

(I can't see your schematic, and your photo is too small to see on my phone)

Confirm you are using a separate external 5v power supply for the motors.

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