M5Stack Watering Unit with Moisture Sensor and Pump
M5Stack Watering Unit with Moisture Sensor and Pump
The M5Stack Watering Unit with Moisture Sensor and Pump is a comprehensive IoT-based solution designed for automated watering and soil moisture monitoring applications. This module combines a high-precision moisture sensor, a water pump, and a microcontroller-based control system, making it an ideal choice for smart gardening, agriculture, and environmental monitoring projects.
| The M5Stack Watering Unit with Moisture Sensor and Pump is capable of |
| Specification | Description |
| --- | --- |
| Moisture Sensor Measurement Range | 0-100% |
| Moisture Sensor Accuracy | 3% |
| Water Pump Flow Rate | 1.5L/min |
| Water Pump Pressure | 1.5bar |
| Microcontroller | ESP32 |
| Connectivity | Wi-Fi, Bluetooth |
| Power Input | 5V (Li-ion battery charging) |
| Dimensions | 54mm x 54mm x 25mm |
| Weight | 120g |
| Operating Temperature | -20C to 85C |
| Storage Temperature | -40C to 125C |
CE, FCC, and RoHS certified
Complies with relevant safety and environmental regulations
1-year limited warranty
Dedicated customer support and technical assistance
Comprehensive documentation and tutorials available
M5Stack Watering Unit with Moisture Sensor and PumpThe M5Stack Watering Unit with Moisture Sensor and Pump is a compact, all-in-one IoT device designed for automating plant watering and monitoring soil moisture levels. This device combines a high-accuracy moisture sensor, a built-in water pump, and a modular design, making it an ideal solution for smart gardening and agriculture applications.Hardware Specifications:Microcontroller: ESP32 (dual-core 32-bit LX6 microprocessor)
Moisture Sensor: High-accuracy capacitive sensor with a range of 0-100% relative humidity
Water Pump: DC 3-6V, 100mA, with a maximum lift of 1.5m
Power Supply: USB-C (5V, 2A)
Communication: Wi-Fi, Bluetooth 4.2
Operating Temperature: -20C to 60C
Dimensions: 54mm x 54mm x 25mmSoftware Libraries and Dependencies:To use the M5Stack Watering Unit with Moisture Sensor and Pump, you will need to install the following libraries and dependencies:M5Stack Library (for ESP32 microcontroller)
WiFi Library (for Wi-Fi connectivity)
BLE Library (for Bluetooth Low Energy connectivity)Code Examples:### Example 1: Basic Soil Moisture Monitoring and WateringThis example demonstrates how to use the M5Stack Watering Unit to monitor soil moisture levels and automatically water plants when the soil becomes too dry.```c++
#include <M5Stack.h>
#include <WiFi.h>#define MOISTURE_SENSOR_PIN 36 // Pin for moisture sensor
#define PUMP_PIN 27 // Pin for water pumpvoid setup() {
// Initialize serial communication
Serial.begin(115200);// Initialize M5Stack
M5.begin();// Initialize moisture sensor
pinMode(MOISTURE_SENSOR_PIN, INPUT);// Initialize water pump
pinMode(PUMP_PIN, OUTPUT);
}void loop() {
int moistureLevel = analogRead(MOISTURE_SENSOR_PIN);
moistureLevel = map(moistureLevel, 0, 4095, 0, 100);Serial.print("Soil Moisture Level: ");
Serial.print(moistureLevel);
Serial.println("%");if (moistureLevel < 30) {
// Water plants if soil moisture level is below 30%
digitalWrite(PUMP_PIN, HIGH);
delay(5000); // Water for 5 seconds
digitalWrite(PUMP_PIN, LOW);
}delay(1000); // Check soil moisture level every 1 second
}
```### Example 2: Remote Soil Moisture Monitoring and Watering Control via Wi-FiThis example demonstrates how to use the M5Stack Watering Unit to monitor soil moisture levels remotely via Wi-Fi and control the water pump using a remote web interface.```c++
#include <M5Stack.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <ESPAsyncWebServer.h>#define MOISTURE_SENSOR_PIN 36 // Pin for moisture sensor
#define PUMP_PIN 27 // Pin for water pump// Replace with your Wi-Fi credentials
const char ssid = "your_wifi_ssid";
const char password = "your_wifi_password";AsyncWebServer server(80);void setup() {
// Initialize serial communication
Serial.begin(115200);// Initialize M5Stack
M5.begin();// Initialize moisture sensor
pinMode(MOISTURE_SENSOR_PIN, INPUT);// Initialize water pump
pinMode(PUMP_PIN, OUTPUT);// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to Wi-Fi...");
}
Serial.println("Connected to Wi-Fi");
Serial.println("Starting web server...");server.on("/", HTTP_GET, [](AsyncWebServerRequest request) {
request->send(200, "text/html", "<html><body><h1>Soil Moisture Level: " + String(analogRead(MOISTURE_SENSOR_PIN)) + "%</h1><form action=""/water""><input type=""submit"" value=""Water Plant""></form></body></html>");
});server.on("/water", HTTP_GET, [](AsyncWebServerRequest request) {
digitalWrite(PUMP_PIN, HIGH);
delay(5000); // Water for 5 seconds
digitalWrite(PUMP_PIN, LOW);
request->send(200, "text/html", "<html><body><h1>Plant watered successfully!</h1></body></html>");
});server.begin();
}void loop() {
// Update soil moisture level on web page
server.handleClient();
delay(1000);
}
```Note: These examples are for illustrative purposes only and may require modifications to suit specific use cases and applications. Always ensure proper calibration and testing of the M5Stack Watering Unit with Moisture Sensor and Pump before deploying it in real-world scenarios.