

The Soil Moisture Sensor2p is a device designed to measure the volumetric water content in soil. It provides real-time data that can be used for irrigation management, plant health monitoring, and agricultural automation. This sensor is ideal for applications such as smart gardening, greenhouse automation, and environmental monitoring systems. Its simple design and ease of integration make it suitable for both hobbyists and professionals.








| Pin Name | Description |
|---|---|
| VCC | Power supply pin. Connect to 3.3V or 5V DC. |
| GND | Ground pin. Connect to the ground of the power supply or microcontroller. |
| OUT | Output pin. Provides an analog voltage proportional to soil moisture level. |
Wiring the Sensor:
Placement in Soil:
Reading the Output:
// Example code to read soil moisture levels using the Soil Moisture Sensor2p
// and display the results on the Serial Monitor.
const int sensorPin = A0; // Analog pin connected to the sensor's OUT pin
int sensorValue = 0; // Variable to store the sensor reading
void setup() {
Serial.begin(9600); // Initialize serial communication at 9600 baud
pinMode(sensorPin, INPUT); // Set the sensor pin as an input
}
void loop() {
sensorValue = analogRead(sensorPin); // Read the analog value from the sensor
float voltage = sensorValue * (5.0 / 1023.0); // Convert to voltage (5V system)
// Map the sensor value to a percentage (0% to 100%)
int moisturePercent = map(sensorValue, 0, 1023, 0, 100);
// Print the results to the Serial Monitor
Serial.print("Soil Moisture Level: ");
Serial.print(moisturePercent);
Serial.println("%");
delay(1000); // Wait for 1 second before taking the next reading
}
No Output or Incorrect Readings:
Fluctuating Readings:
Corrosion of Probes:
Q: Can this sensor be used in hydroponics?
A: No, this sensor is designed for soil-based applications and may not provide accurate readings in water or nutrient solutions.
Q: How do I calibrate the sensor?
A: Measure the sensor's output in dry soil and fully saturated soil. Use these values to map the sensor's readings to a percentage scale.
Q: Can I use this sensor with a 3.3V microcontroller?
A: Yes, the sensor operates at both 3.3V and 5V, making it compatible with most microcontrollers.
By following this documentation, you can effectively integrate the Soil Moisture Sensor2p into your projects and ensure reliable performance.