3.3V to 5V
3.3V to 5V
<5mA
+ Analog | 0-3.3V |
+ Digital | I2C (up to 400kHz) |
0-100% FS
0.1% FS
0.1% FS
<1 second
-20C to 85C
-40C to 125C
35mm x 15mm x 10mm (L x W x H)
Applications
Agriculture and Horticulture
Environmental Monitoring
Irrigation Systems
Smart Farming and Precision Agriculture
Research and Development
Weather Stations and Climate Monitoring
Wiring and Pinout
The module has a 4-pin interface with the following pinout |
VCC (3.3V to 5V)
GND
Analog Output (0-3.3V)
SCL (I2C Clock)
Certifications and Compliance
The Soil Moisture Sensor Module complies with relevant industry standards and regulations, including RoHS and CE.
Soil Moisture Sensor Module Documentation
Overview
The Soil Moisture Sensor Module is a digital sensor designed to measure the moisture level in soil. It is a popular IoT component used in smart gardening, agriculture, and environmental monitoring applications. This module provides a simple and accurate way to detect soil moisture, allowing for automated irrigation control and optimal water management.
Technical Specifications
Operating Voltage: 3.3V - 5V
Operating Current: 10mA - 30mA
Soil Moisture Measuring Range: 0-100%
Accuracy: 10%
Output: Digital (HIGH/LOW)
Interface: Digital GPIO
Connection Diagram
The Soil Moisture Sensor Module typically has 4 pins:
VCC: Connect to a power source (3.3V - 5V)
GND: Connect to ground
DOUT: Connect to a digital GPIO pin on the microcontroller
VOUT: Not used (optional analog output)
Code Examples
### Example 1: Basic Soil Moisture Monitoring using Arduino
In this example, we will use an Arduino Uno board to read the soil moisture level and display it on the serial monitor.
```c
const int soilMoisturePin = 2; // Connect DOUT to digital pin 2
void setup() {
Serial.begin(9600);
pinMode(soilMoisturePin, INPUT);
}
void loop() {
int soilMoisture = digitalRead(soilMoisturePin);
if (soilMoisture == HIGH) {
Serial.println("Soil is dry");
} else {
Serial.println("Soil is wet");
}
delay(1000);
}
```
### Example 2: Automated Irrigation Control using Raspberry Pi (Python)
In this example, we will use a Raspberry Pi to read the soil moisture level and trigger an irrigation system when the soil is dry.
```python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
soilMoisturePin = 17 # Connect DOUT to GPIO 17
GPIO.setup(soilMoisturePin, GPIO.IN)
while True:
if GPIO.input(soilMoisturePin) == 1:
print("Soil is dry. Triggering irrigation...")
# Add code to trigger the irrigation system (e.g., using a relay module)
else:
print("Soil is wet. No need to irrigate.")
time.sleep(60) # Check soil moisture every 60 seconds
```
### Example 3: IoT-based Soil Moisture Monitoring using ESP32 and Wi-Fi (MicroPython)
In this example, we will use an ESP32 board to read the soil moisture level and send the data to a cloud-based IoT platform using Wi-Fi.
```python
import machine
import urequests
soilMoisturePin = 32 # Connect DOUT to GPIO 32
adc = machine.ADC(machine.Pin(soilMoisturePin))
wifi_ssid = "your_wifi_ssid"
wifi_password = "your_wifi_password"
def send_data(moisture_level):
url = "https://your_iot_platform.com/api/data"
headers = {"Content-Type": "application/json"}
data = {"soil_moisture": moisture_level}
response = urequests.post(url, headers=headers, json=data)
response.close()
while True:
moisture_level = adc.read()
if moisture_level > 500: # Adjust the threshold value as needed
print("Soil is dry.")
else:
print("Soil is wet.")
send_data(moisture_level)
time.sleep(300) # Send data every 5 minutes
```
Note: In this example, replace "your_wifi_ssid" and "your_wifi_password" with your Wi-Fi network credentials, and "https://your_iot_platform.com/api/data" with your IoT platform's API endpoint.