Stufin
Home Quick Cart Profile

Soil Moisture Sensor Module

Buy Now

Operating Voltage

3.3V to 5V

Operating Current

<5mA

Output Signal

+ Analog0-3.3V
+ DigitalI2C (up to 400kHz)

Measurement Range

0-100% FS

Accuracy

0.1% FS

Resolution

0.1% FS

Response Time

<1 second

Operating Temperature

-20C to 85C

Storage Temperature

-40C to 125C

Dimension

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.

Pin Configuration

  • Soil Moisture Sensor Module Documentation
  • Pin Description:
  • The Soil Moisture Sensor Module has a total of 4 pins, which are used to power the sensor, read the analog output, and connect to a digital output (optional). Below is a detailed description of each pin:
  • Pin 1: VCC (Power Supply)
  • Function: Provides power to the sensor module
  • Recommended Voltage: 3.3V to 5V DC
  • Description: This pin connects to the positive terminal of the power supply. Ensure the voltage level is within the recommended range to avoid damaging the sensor.
  • Pin 2: GND (Ground)
  • Function: Provides a ground connection to the sensor module
  • Description: This pin connects to the negative terminal of the power supply or the ground plane of the circuit. A solid ground connection is essential for proper sensor operation.
  • Pin 3: OUT (Analog Output)
  • Function: Provides an analog output signal proportional to the soil moisture level
  • Description: This pin outputs a voltage signal that varies between 0V and VCC, depending on the soil moisture level. The output voltage can be read using an analog-to-digital converter (ADC) or a microcontroller with an analog input.
  • Pin 4: DOUT (Digital Output) - Optional
  • Function: Provides a digital output signal indicating high or low soil moisture levels (optional)
  • Description: This pin is only used if the digital output feature is enabled on the sensor module. The digital output is typically an active-low signal, where a logic low (0V) indicates high soil moisture and a logic high (VCC) indicates low soil moisture.
  • Connecting the Pins:
  • To connect the Soil Moisture Sensor Module to a microcontroller or other circuits, follow these steps:
  • 1. Power Supply:
  • Connect Pin 1 (VCC) to a 3.3V or 5V DC power supply.
  • Ensure the power supply is stable and can provide enough current to power the sensor module.
  • 2. Ground:
  • Connect Pin 2 (GND) to the negative terminal of the power supply or the ground plane of the circuit.
  • 3. Analog Output:
  • Connect Pin 3 (OUT) to an analog input on a microcontroller or an ADC module.
  • Use a suitable voltage divider or signal conditioning circuitry, if necessary, to adjust the output voltage to match the input range of the microcontroller or ADC.
  • 4. Digital Output (Optional):
  • If the digital output feature is enabled, connect Pin 4 (DOUT) to a digital input on a microcontroller.
  • Use a pull-up resistor (e.g., 10 k) to connect Pin 4 to VCC, if necessary, to ensure a stable digital output signal.
  • Important Notes:
  • Ensure the sensor module is properly connected to the soil or growing medium to obtain accurate moisture readings.
  • Avoid applying voltage to the sensor module beyond the recommended range to prevent damage.
  • Use a suitable cable or connector to connect the pins, taking care to avoid crossing or shorting the connections.

Code Examples

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.