ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Building an Arduino controlled pump

Updated on May 8, 2013

This tutorial explains how to control a pump with an Arduino board. It covers building the container and making a capable circuit that controls the pump. The code is also provided and explained.

You will need:

  • An Arduino Board, for this tutorial I will use a breadboard implementation.
  • IRF530 transistor (or equivalent).
  • 9V voltage source.
  • 1N4004 diode.
  • 3.3k resistor.
  • A breadboard.
  • Power Jack
  • A pump motor (you may get one in car supply stores).
  • A plastic container (soda bottle).
  • A hose.*
  • Sealing glue.
  • Circuit soldering equipment.
  • Wires.

The materials are shown to the right.

*Note: This hose must be small to fit in the small nozzle of the pump.

Full picture of the implementation.
Full picture of the implementation.

Procedure

The above picture shows the complete implementation of the arrangement. This implementation is divided into three parts which connect to each other.

  1. Make the pump container.
  2. Build the circuit.
  3. Write the code.

1N4004 soldered to the terminals of a pump.
1N4004 soldered to the terminals of a pump.

Make the pump container

  1. Take the bottle and make two holes. One must be large enough to fit the large nozzle of the pump. The other must be small to fit the hose.
  2. Take the hose and glue it directly to the small nozzle of the pump. Make sure to seal it tight, or you will have water leakage.
  3. Now solder the 1N4004 diode to the pump terminals. Pump motors accept DC current so there is no polarity involved. The diode will make sure the current doesn't flow back and damage the circuit or the motor. Take notice of the connection as you make it, the negative side of the diode (the one with the bar) should be connected to the positive terminal of the pump. Positive terminals are usually marked with a red wire.
  4. Glue the large end of the pump (this is the fluid intake end) and glue it tightly to the large hole of the container. There must be a free end of the hose, glue that one to the small hole of the container.

The final product should look like the picture below.

Picture of the finished container.
Picture of the finished container.
Circuit for a pump connected to an IRF530 and controlled by a PWM signal.
Circuit for a pump connected to an IRF530 and controlled by a PWM signal.
Power jack, green is high and purple low.
Power jack, green is high and purple low.
IRF530, pins marked.
IRF530, pins marked. | Source

Build the circuit

In order to make the circuit make sure you have all of the following:

  • 1 IRF530 Transistor.
  • 1 3.3k Resistor.
  • A DC power jack
  • A breadboard
  • Various wires
  • An Arduino Board.

The circuit schematic is shown to the right.

The breadboard connections should be made per the following procedure:

  1. Connect the power jack to the side rows of the breadboard. The positive end should be connected to the outermost row and the negative to a common ground, like the other row.
  2. Connect the IRF530 to wherever it fits. Take note of the name of each pin as the function and connection is different for each. Place the transistor so that you may read its name; in the schematic the transistor is named. The center pin is the drain in the schematic it is the uppermost pin. The left pin is the gate in the schematic it is the center pin. The right pin is the source this is the bottom pin in the schematic.
  3. The gate (left) has two connections: the resistor is connected here and send to ground, the other connection is the Arduino, connect it to a Digital Pin marked as PWM.
  4. The drain is connected to the negative (black wire) terminal of the pump.
  5. The source is connected to ground.
  6. The positive terminal (red wire) of the motor must be connected to the outermost row of the breadboard, so that it is connected to the power jack's positive end.

The end product is shown in the following picture. In a breadboard the side rows are not connected to the inner rows, so a wire is used as a bridge between nodes, this is used to make a single wire through the board.

Complete circuit for the control of a pump with an Arduino. The green wire at the left is to be connected to Arduino Digital Pin 9. The side green and purple wires to the right are connected to the power jack.
Complete circuit for the control of a pump with an Arduino. The green wire at the left is to be connected to Arduino Digital Pin 9. The side green and purple wires to the right are connected to the power jack.

Write the code

The following is required in order to complete this section:

  • Arduino Software (Download)
  • A computer
  • Arduino Board
  • An USB cable

This implementation works by sending a pulse signal that changes in intensity to the pump. The effective voltage in the motor terminals is determined by the signal strength. The higher the voltage in the motor the stronger it pumps the water; by modulating the strength of the signal the intensity of the motor is controlled. This modulation is made by the Arduino board which generates a PWM, a controllable voltage signal.

The following code uses Digital Pin 9 to output a PWM, the codes varies the signal to send a different low voltage to the motor. This makes the motor change its strength. The code is based in the "Fade" example included in the Arduino Software package.

Arduino Pump Code

/*
 Pump Fade
 
 This example shows how to increase and decrease the
 intensity of a pump as a function of time. In effect
 it's similar to the LED fading sequence but for a motor.
 
 This example code is in the public domain.
 Adapted from Basic/Fade example.
 */

int motor = 9;     //Must be PWM pin, goes to motor (gate)      
int intensity = 0; //Actual tension: 12 -(255-intensity)*5/255   
int crease = 3;  //Changes motor intensity 

void setup()  { 
  pinMode(motor, OUTPUT);
} 
void loop()  { 
  analogWrite(motor, intensity);  //Writes PWM to the motor    
  intensity = intensity + crease; 
  if (intensity == 0 || intensity == 255) {
    crease = -crease ;  //Increase to decrease due to line 21
  }     
  delay(3000); //Making this too small can damage the motor                            
}

Load the code into the board and connect it to the green wire in the circuit. The pump should slowly change intensity until it reaches a maximum then it must flow back. Try changing the crease variable to obtain different intensity intervals. The following video shows the pump working at small intervals. It skips in intensity until it reaches a maximum and then back until it turns off.

Ending comments

This concludes the tutorial. All comments are welcomed below.

Comments

    0 of 8192 characters used
    Post Comment

    • profile image

      cgarcia12357 2 years ago

      what a good article!!