How to use the ‘Plantmate DC 5V to 3.3V, 5V, 6.6-12.6V converter & Water Comparator Module’ to control the ‘Plantmate DC 6.6V Mini Water Pump with Water Sensor Plate’ with an Arduino UNO board.

In this project, we show how to use the ‘Plantmate DC 5V to 3.3V, 5V, 6.6-12.6V converter & Water Comparator Module’ to control the ‘Plantmate DC 6.6V Mini Water Pump with Water Sensor Plate’ with an Arduino UNO board.

What’s the goal of this project?

We are going to use this module to stop the water pump from running when the water sensor detects there is no water and start running when the water sensor detects there is water.

Hardware:

  1. Plantmate DC 5V to 3.3V, 5V, 6.6-12.6V converter & Water Comparator Module
  2. Plantmate DC 6.6V Mini Water Pump with Water Sensor Plate
  3. Arduino UNO board
  4. Jumper wires
Plantmate Converter & Water Comparator ModulePlantmate DC 6.6V Mini Water Pump with Water Sensor PlateArduino UNO boardJumper wires

Tools:

  1. Soldering iron
  2. Multimeter (option)
Soldering ironMultimeter

Software:

Arduino IDE V1.6.5 or later.
Download link: https://www.arduino.cc/en/software

Get Things Ready:

Solder the 6 pins to the module pinholes if need.
Connect the USB-C to a 5V power supply, set the output voltage to 6.6V by turning the potentiometer counterclockwise all the way. If you have a multimeter make sure the output voltage is 6.6V   Disconnect the USB-C power supply.
Connect the Jumper Cap on the 5V jumper pinhead while using a 5V MCU.
Use the jumper wires to wire the Module and the Arduino UNO board.

1. Pin 5 to UNO 5V
2. Pin 3 to UNO D3
3. Pin 2 to UNO A2
4. Pin 1 to UNO GND

1. Use the Arduino UNO USB cable to connect with your computer;

2. Connect the water pump to the mini-USB adapter on the module board;

3. Connect the USB-C to the power supply.
Open the IDE program on your computer, make sure the Board and the Port on your IDE ->Tools drop-down menu are correct;

4. Copy the codes below and upload them to your Arduino UNO.
/* 
 * 6V6 Water Pump & Sensor with Arduino UNO PIN connection:
 * pin connection see: https://www.arduino.cc/en/Reference/Wire
 * 1. Pin 5 to UNO 5V
 * 2. Pin 3 to UNO D3
 * 3. Pin 2 to UNO A2
 * 4. Pin 1 to UNO GND :-)
 */

/* Setting:
 * 
==========================================================================================================
==========================================================================================================
*/
int noWaterValue= 370;         //Replace this value with the value from your pump sensor when it is on air dry.

int loopTime=5000;             //Time in microsecond for the pump run period, 5000=5 seconds, change it to what your prefer.

int pwm=255;                   // Value from 0-255, Hight = 255, LOW = 0 (OFF)

int offset = 10;                // Water sensor offset. adjust this number if need.

/*
============================================================================================================
============================================================================================================
*/
 
#define waterSensor A2         // pin that water senosor sends data to Analog pin A2.
#define control 3              // pin that controls the pump speed to Digital pin 2.
 
void setup() {   
  pinMode(waterSensor, INPUT);
  pinMode(control, OUTPUT);
  digitalWrite(control, 0);
  
  Serial.begin(9600);
  
}

void loop() {
 
 int sensorVal = analogRead(waterSensor);
 
 Serial.print("Water Sensor Value: "); Serial.println(sensorVal); // print out water sensor value to monitor.
 
   if(sensorVal < noWaterValue - offset ) {
      analogWrite(control,pwm);     // Turn the pump on at pwm speed.
      delay(loopTime);              // Pump keeps on til this period end then continue the loop.
      }
     else{
          analogWrite(control,0);    // Turn the pump off.
          delay(1000);               // Wait for 1000 ms or 1 second then continue the loop
          }
 }
 
After you upload the codes above, don’t put the water pump into the water yet. Leave the water pump in the air dry.  

On the right-top corner of your IDE, click the ‘Serial Monitor’.  

You will see something like this picture in your pop-up window.  

Write down this ‘Water Sensor Value’ for the next step.  

Close the ‘Serial Monitor’ window.  
Now, replace the ‘noWaterValue’ with the value from the prior step on your IDE and upload it to your Arduino again.

Finally, if you put the water pump into the water now, the water pump should run for 5 seconds and stop for 1 second and go on. If the water pump is not in the water, the water pump will stop running.

Summary

The water comparator in this module actually is a capacitive sensor, it detects water without the probes’ contact with water directly and there is no DC current flowing which causes electrolysis of the sensor probes. There are many advanced benefits compared to resistive sensors.

You can use this module and water pump for your own project purpose. The water pump will stop running once it detects there is no water. You can control the water pump speed by sending a different voltage to pin 3. If you connect it with a LED light, a speaker even a wi-fi module, you will get a notification by these options.

This module can handle up to a 12.6V water pump, and DIY the water sensor probes quite easily.

We see many application scenarios on these devices.

The END!

Leave a Reply

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