ESP32 C3 Super Mini - Control Pump

Learn how to control a 12V water pump with the ESP32 C3 Super Mini using a relay module. This tutorial walks you through the wiring, code, and quick steps to automate pump control for DIY projects.

In this tutorial, you'll learn:

ESP32 C3 Super Mini - Controls Pump

Hardware Preparation

1×ESP32 C3 Super Mini
1×USB Cable Type-A to Type-C (for USB-A PC)
1×USB Cable Type-C to Type-C (for USB-C PC)
1×Relay
1×12V Pump
1×Vinyl Tube
1×12V Power Adapter
1×Breadboard
1×Jumper Wires
1×Optionally, DC Power Jack

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of 12V Pump

A 12V pump is a small electric water pump that runs on 12V DC power and is commonly used for DIY water circulation projects.

  • Operating Voltage: 12V DC
  • Power Consumption: Typically 3-5W
  • Flow Rate: Varies by model (usually 1-3 liters per minute)
  • Perfect for: Aquariums, irrigation systems, coffee machines, and automated beverage dispensers
  • Beginner-Friendly: Simple two-wire connection makes it easy to control with ESP32 C3 Super Mini

Pump Pinout

ESP32 C3 Super Mini Pump Pinout
image source: diyables.io

The 12V pump has two connection wires for easy hookup:

  • Negative (-) wire (black): Connect to the negative terminal of 12V DC power supply
  • Positive (+) wire (red): Connect to the positive terminal of 12V DC power supply

How to Control Pump using ESP32 C3 Super Mini

The ESP32 C3 Super Mini controls the pump by switching power through a relay module.

  • The pump requires 12V DC power to operate
  • ESP32 C3 Super Mini cannot directly power the pump (only provides 3.3V logic)
  • A relay acts as an electronic switch controlled by the ESP32 C3 Super Mini
  • When ESP32 sends a HIGH signal, the relay closes and powers the pump
  • When ESP32 sends a LOW signal, the relay opens and stops the pump
  • This setup protects the ESP32 C3 Super Mini from high voltage/current
  • Learn more in our ESP32 C3 Super Mini - Relay tutorial

Wiring Diagram between ESP32, Relay and Pump

Follow this diagram to connect the ESP32 C3 Super Mini, relay module, and 12V pump together.

  • Note: Always disconnect power before wiring components
  • Note: Double-check polarity on the pump and power adapter before connecting
The wiring diagram between ESP32 C3 Super Mini Pump

This image is created using Fritzing. Click to enlarge image

ESP32 C3 Super Mini Pin Relay Module Pin
D7 IN
GND GND
3.3V VCC
Relay Module Terminal Connection
COM 12V Power Adapter (+) Positive
NO Pump (+) Red Wire
Ground Connections Connection
12V Power Adapter (-) Pump (-) Black Wire

ESP32 C3 Super Mini - Pump Code

This code section shows how to program the ESP32 C3 Super Mini to control the pump automatically.

What the code does:

  • Sets up D7 as the relay control pin
  • Turns the pump ON for 4 seconds
  • Turns the pump OFF for 4 seconds
  • Repeats the ON/OFF cycle continuously
  • Prints pump status to Serial Monitor
/* * This ESP32 C3 Super Mini code was developed by newbiely.com * * This ESP32 C3 Super Mini code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-c3/esp32-c3-super-mini-controls-pump */ #define RELAY_PIN D7 // The ESP32 C3 SuperMini pin connected to the pump the via the relay // The setup function runs once on reset or power-up void setup() { // initialize digital pin as an output. pinMode(RELAY_PIN, OUTPUT); } // The loop function repeats indefinitely void loop() { digitalWrite(RELAY_PIN, HIGH); // turn on pump 4 seconds delay(4000); digitalWrite(RELAY_PIN, LOW); // turn off pump 4 seconds delay(4000); }

Detailed Instructions

  • New to ESP32 C3 Mini? Complete our Getting Started with ESP32 C3 Mini tutorial first to set up your development environment.
  • Prepare Your Environment: Follow the ESP32 C3 Super Mini setup tutorial to configure Arduino IDE
  • Wire the Components: Connect the relay, pump, and power adapter following the wiring diagram above
  • Connect ESP32: Plug the ESP32 C3 Super Mini into your computer using the USB Type-C cable
  • Open Arduino IDE: Launch the Arduino IDE software on your computer
  • Select Your Board: Choose ESP32 C3 Super Mini from the board menu and select the correct COM port
  • Upload the Code: Copy the code above, paste it into Arduino IDE, and click the Upload button
  • Open Serial Monitor: Click the Serial Monitor icon (set baud rate to 9600) to view pump status
  • Observe the Pump: Watch the pump turn ON and OFF every 4 seconds automatically
  • Pro Tip: Use a clear vinyl tube so you can easily see water flowing when the pump activates

Line-by-line Code Explanation

The above ESP32 C3 Super Mini code contains line-by-line explanation. Please read the comments in the code!

Serial Monitor Output

Open the Serial Monitor to see the pump control status in real-time:

Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32C3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32C3 Dev Module' on 'COM15')
New Line
9600 baud
The pump is ON The pump is OFF The pump is ON The pump is OFF The pump is ON The pump is OFF
Ln 11, Col 1
ESP32C3 Dev Module on COM15
2

Applications and Project Ideas

This ESP32 C3 Super Mini pump control setup can be used in many exciting DIY automation projects:

  • Automated Aquarium: Control water circulation and filtration systems on a timer
  • DIY Irrigation System: Water your plants automatically based on soil moisture or schedule
  • Coffee Machine Automation: Build a programmable espresso or drip coffee maker
  • Cocktail Dispenser: Create an automated bartender for parties and events
  • Fountain Controller: Program decorative water fountain patterns and timing
  • Hydroponic System: Manage nutrient solution circulation for indoor gardening

Video Tutorial

Watch the video below for a visual walkthrough of this project.

Challenge Yourself

Take your ESP32 C3 Super Mini pump control project to the next level with these challenges:

  • Easy: Modify the code to change the ON/OFF timing intervals to 10 seconds each
  • Easy: Add an LED indicator that lights up whenever the pump is running
  • Medium: Add a push button to manually start/stop the pump independent of the timer
  • Medium: Use a soil moisture sensor to activate the pump only when soil is dry
  • Advanced: Create a web interface to control the pump remotely via WiFi using the ESP32's built-in connectivity
  • Advanced: Build a complete irrigation system with multiple pumps controlled by different schedules

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!