Note
Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook! Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Why Join?
- Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
- Learn & Share: Exchange tips and tutorials to enhance your skills.
- Exclusive Previews: Get early access to new product announcements and sneak peeks.
- Special Discounts: Enjoy exclusive discounts on our newest products.
- Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.
👉 Ready to explore and create with us? Click [|link_sf_facebook|] and join today!
In this lesson, you'll learn how to control a centrifugal pump with an Arduino Uno R3 or R4 and an L9110 motor control board. You'll discover how to set up and program the Arduino to start the pump in one direction, run it for a specific duration, and then stop it. This hands-on experience is ideal for beginners and offers fundamental insight into managing motor operations and understanding output controls in Arduino projects.
In this project, we need the following components.
It's definitely convenient to buy a whole kit, here's the link:
Name | ITEMS IN THIS KIT | LINK |
---|---|---|
Universal Maker Sensor Kit | 94 | |link_umsk| |
You can also buy them separately from the links below.
Component Introduction | Purchase Link |
---|---|
Arduino UNO R3 or R4 | |link_Uno_R3_buy| |
:ref:`cpn_pump` | - |
:ref:`cpn_l9110` | - |
- Arduino UNO R3 or R4
- :ref:`cpn_pump`
- :ref:`cpn_l9110`
Two pins are defined for controlling the motor, specifically
motorB_1A
andmotorB_2A
. These pins will connect to the L9110 motor control board to control the direction and speed of the motor.const int motorB_1A = 9; const int motorB_2A = 10;
Configuring the pins and controlling the motor:
- The
setup()
function initializes the pins asOUTPUT
which means they can send signals to the motor control board. - The
analogWrite()
function is used to set the motor speed. Here, setting one pin toHIGH
and the other toLOW
makes the pump spin in one direction. After a 5-second delay, both pins are set to 0, turning off the motor.
void setup() { pinMode(motorB_1A, OUTPUT); // set pump pin 1 as output pinMode(motorB_2A, OUTPUT); // set pump pin 2 as output analogWrite(motorB_1A, HIGH); analogWrite(motorB_2A, LOW); delay(5000);// wait for 5 seconds analogWrite(motorB_1A, 0); // turn off the pump analogWrite(motorB_2A, 0); }
- The