Categories
TUTORIALS

Controlling water pump based on air temperature and humidity

Overview

In this tutorial, we will be using an Arduino Uno microcontroller to control the activation and deactivation of a water pump via a relay module based on temperature and humidity readings from a DHT11 sensor. When the temperature and/or humidity exceed a certain threshold, the Arduino will activate the water pump to regulate the environment and deactivate automatically when conditions are met. This project is useful for use cases such as automating the watering of plants or regulating the humidity levels in a room or greenhouse.

Components Required
Components Introduction
How does the water pump work?

The Gikfun DC 3V 5V Micro Submersible Mini Water Pump is a small device that uses a motor to drive an impeller or rotor, which moves water through the pump’s inlet and outlet ports. When the pump is turned on, the impeller creates a low-pressure area at the inlet, which sucks water into the pump and then pushes it out through the outlet at a higher pressure. The pump is submersible, meaning it can be fully submerged in water without damage, and is powered by a 3V or 5V DC power supply

Why use the power supply module?

The load rated current of the water pump is 0.18A while the Arduino pin could supply a maximum of 40mA. So, connecting the water pump directly to a UNO R3 board digital output is not recommended as the pump may require more power than the board can handle. Attempting to do so could potentially cause damage to the board. To prevent this, it is advisable to use a power supply module to provide the necessary power to the pump. In addition, the left and right voltage output can be configured independently.

Why use the relay?

The relay was used in this project to control the activation and deactivation of the water pump based on the temperature and humidity readings from the DHT11 sensor. Using a relay to control the water pump provides a safer and more efficient way to operate the system compared to directly connecting the water pump to the Arduino Uno. The relay module acts as a switch that isolates the low-voltage microcontroller circuit from the high-voltage water pump circuit, ensuring safe and reliable operation.

Circuit Diagram
  1. Place the power supply module on the breadboard.
    • The negative pin (-) on the module lines up with the blue line (-) on the breadboard
    • The positive pin (+) lines up with the red line (+)
  2. Use two M-M wires to connect Arduino Uno to the breadboard.
    • GND to the blue line (-)
    • 5V to the red line (+).
  3. Connect the DHT11 sensor to the Arduino Uno.
    • GND to the blue line (-)
    • VCC to the red line (+)
    • Data to your defined digital pin on Arduino (in my case it is digital pin 2)
  4. Wire up the relay module to the Arduino Uno
    • Relay module + to the red line (+)
    • Relay module – to the blue line (-)
    • Relay module S to your defined digital pin on Arduino for the relay circuit (in my case it is digital pin 10)
    • Relay module NO (Normally Open) to the positive terminal of the water pump
    • Relay module COM (Common) to the positive terminal of the power supply (use the opposite side from the Arduino)
    • The negative terminal of the water pump to the negative terminal of the power supply (use the opposite side from the Arduino)
Code

Before uploading the code: Make sure you install the dht_nonblocking library to use the sensor. The temperature and humidity in my testing environment are around 23°C and 50%. So, we will set the temperature threshold as 25°C and the humidity threshold as 65% for demonstration purposes in this tutorial. The exact thresholds for applications depend on the use case where the thresholds could be more extreme values.

Demo
The pump is activated when the temperature is greater than 25 degree celsius.
Sources

Elegoo Super Starter Kit for Uno, Lesson 11 DHT11 Temperature and Humidity Sensor

Controlling submersible pump with Arduino

How to connect DC motor with relay || control with Arduino

One reply on “Controlling water pump based on air temperature and humidity”

Leave a Reply

Your email address will not be published. Required fields are marked *