3.3-5V
3.3-5V
<20mA
0-100%
1%
5%
-20C to 80C
30mm x 20mm
5g
Applications
Monitor soil moisture levels to optimize irrigation and reduce water consumption.
Track soil moisture levels in natural environments to study climate change or monitor ecosystem health.
Integrate the Soil Moisture Sensor Module into IoT projects, such as smart gardens or agricultural monitoring systems.
Package Contents
25 x Soil Moisture Sensor Modules
25 x Electrode probes
1 x User Manual
The user manual provides detailed instructions for using the Soil Moisture Sensor Module, including wiring diagrams, datasheets, and example code for popular microcontrollers.
Soil Moisture Sensor Module (Pack of 25) DocumentationOverviewThe Soil Moisture Sensor Module is a widely used IoT component for measuring the moisture level in soil. It is commonly used in agricultural, horticultural, and gardening applications to monitor and control soil conditions. This module is designed to be easy to use and integrate into various projects.Technical SpecificationsOperating Voltage: 3.3V - 5V
Output Voltage: 0-3.3V (analog) or 0-1023 (digital)
Sensing Range: 0-100% soil moisture
Accuracy: 10% soil moisture
Interface: Analog or Digital (optional)
Dimensions: 35mm x 15mm x 10mm
Weight: 5gPinoutThe Soil Moisture Sensor Module has three pins:VCC (Red): Power supply (3.3V - 5V)
GND (Black): Ground
OUT (Yellow): Analog output (0-3.3V) or Digital output (0-1023)Code Examples### Example 1: Basic Analog Reading (Arduino)Connect the Soil Moisture Sensor Module to an Arduino board as follows:VCC to Arduino's 5V pin
GND to Arduino's GND pin
OUT to Arduino's Analog Input pin (A0)Use the following code to read the soil moisture level:
```c++
const int moisturePin = A0; // Analog input pinvoid setup() {
Serial.begin(9600);
}void loop() {
int moistureValue = analogRead(moisturePin);
float moisturePercentage = map(moistureValue, 0, 1023, 0, 100);
Serial.print("Soil Moisture Level: ");
Serial.print(moisturePercentage);
Serial.println("%");
delay(1000);
}
```
This code reads the analog output from the sensor, maps it to a 0-100% scale, and prints the result to the serial monitor.### Example 2: Digital Output with ESP32 (MicroPython)Connect the Soil Moisture Sensor Module to an ESP32 board as follows:VCC to ESP32's 3.3V pin
GND to ESP32's GND pin
OUT to ESP32's Digital Input pin (GPIO 17)Use the following code to read the soil moisture level:
```python
import machine
import timemoisture_pin = machine.Pin(17, machine.Pin.IN)while True:
moisture_value = moisture_pin.value()
if moisture_value == 1:
print("Soil is dry")
else:
print("Soil is wet")
time.sleep(1)
```
This code uses the ESP32's digital input pin to read the output from the sensor. If the output is high (1), the soil is dry; if it's low (0), the soil is wet.### Example 3: IoT Automation with Raspberry Pi (Python)Connect the Soil Moisture Sensor Module to a Raspberry Pi as follows:VCC to Raspberry Pi's 3.3V pin
GND to Raspberry Pi's GND pin
OUT to Raspberry Pi's Analog Input pin (GPIO 18)Use the following code to read the soil moisture level and automate watering:
```python
import RPi.GPIO as GPIO
import timeGPIO.setmode(GPIO.BCM)
moisture_pin = 18
GPIO.setup(moisture_pin, GPIO.IN)while True:
moisture_value = GPIO.input(moisture_pin)
if moisture_value == 0:
print("Soil is dry, watering...")
# Trigger watering mechanism (e.g., relay module)
time.sleep(10) # Water for 10 seconds
else:
print("Soil is wet, no need to water")
time.sleep(60) # Check every 1 minute
```
This code uses the Raspberry Pi's analog input pin to read the output from the sensor. If the soil is dry, it triggers a watering mechanism (e.g., a relay module) to water the plants.Note: These examples are for illustrative purposes only and may require modifications to suit your specific project requirements. Ensure you follow proper safety precautions when working with electronics and IoT components.