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 

      3 years ago

      what a good article!!

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://hubpages.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)