This Moisture Senor can be used for detecting the moisture of soil or judge if there is
water around the sensor, let the plant in your garden able to reach out for human’s
help when they are thirsty. This sensor is very easy to use, you can just simply insert
in into the soil and read the data. With this sensor, you can make a small project that
can let the plant send a message to you like ” I am thirsty now, please feed me some
water.”
Features
• Soil moisture sensor based on soil resistivity meansurement
• Easy to use
• 2.0 cm X 6.0 cm grove module
Tip
More details about Grove modules please refer to Grove System
Specification
Item
Condition
Min
Typical
Max
Unit
Voltage
-
3.3 - 5 V Current
- 0 -
35
mA
Sensor in dry soil
Sensor in water
Output Value
Sensor in humid
soil
Application Ideas
• Botanical Gardening
• Moisture Sensoring
• Consistency Measurement
Usage
0
300<700>
300
-
700
950
-
With Arduino
This is a summary of the moisture sensor which can be used to detect the moisture
of the soil. When the soil moisture deflicits, the sensor output value will decrease.
You can know whether a plant needs water or not by observing the result that the
sensor output. The following sketch demostrates a simple application of sensoring
the moisture of the soil.
• Connect this module to one of analog port of A0 of Grove - Base Shieldwith 4 pin
• Plug Grove - Base Shield into the Arduino Seeeduino and connect Arduino to PC
The hardware installation as is shown as below:
Grove cable, and then insert the sensor into the soil or plase it in anywhere you
want.
via an USB cable.
Note
This sensor isn’t hardened against contaimination or exposure of the control circuitry
to water and may be prone to electrolytic corrosion across the probes, so it isn’t well
suited to being left in place or used outdoors.
•Copy and paste the code below to a new Arduino Sketh
// Test code for Grove - Moisture Sensor
int sensorPin = A0; //select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor7
void setup() {
// declare the ledPin as an OUTPUT:
Serial.begin(9600);
}
voidloop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
Serial.print("sensor = " );
Serial.println(sensorValue);
delay(1000);
}
• Upload the code, please clickhere if you don’t know how to upload.
• The result in different condition after open the serial monitor
With TI LaunchPad
Taking care of your plants(Moisture Sensor)
The following sketch demonstrates a simple application of sensing the moisture in
soil.With this, you can know whether your plant needs water or not by observing the
result from the output of the sensor
/*
Moisture-Sensor
The following sketch demonstrates a simple application of sensing
the moisture of the soil. You can know whether a plant needs water
or not by observing the results that the sensor outputs.
The circuit:
* Moisture-Sensor attached to pin 24 (J6 plug on Grove Base BoosterPack)
intanalog_value = 0; /* varible to store the value coming from rotary angle
sensor */
int8_t bits[4] = {0}; /* array to store the single bits of the value */
/* the setup() method runs once, when the sketch starts */
void setup() {
/* Initialize 4-digital display */
tm1637.init();
tm1637.set(BRIGHT_TYPICAL);
/* declare the red_led pin as an OUTPUT */
pinMode(BLINK_LED, OUTPUT);
}
/* the loop() method runs over and over again */
voidloop() {
analog_value = analogRead(MOISTURE_PIN); /* read the value from the sensor */
/* if the value is smaller than threshold, turn on led */
if(analog_value < THRESHOLD_VALUE) {
_handle_led(ON);
} else {
_handle_led(OFF);
}
memset(bits, 0, 4); /* reset array when we use it */
for(int i = 3; i >= 0; i--) {
/* get single bits of the analog value */
bits[i] = analog_value % 10;
analog_value = analog_value / 10;
tm1637.display(i, bits[i]); /* display by 4-digital display */
}
delay(200);
}
With Raspberry Pi 1. You should have got a Raspberry Pi and a grove pi or grove
pi+ 2. You should have completed configuring development environment, otherwise
follow here. 3. Connection - Plug the sensor to grove pi socket A0 by using a grove
cable 4. Navigate to the demo’s direc tor y.
cd yourpath/GrovePi/Software/Python/
To see the code
nano grove_moisture_sensor.py # "Ctrl+x" to exit #
import time
import grovepi
# Connect the Grove Moisture Sensor to analog port A0
# SIG,NC,VCC,GND
sensor = 0
while True:
try:
print grovepi.analogRead(sensor)
time.sleep(.5)
except KeyboardInterrupt:
break
except IOError:
print "Error
1. Run the demo
sudo python grove_moisture_sensor.py
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.