Page 4
Under the supervision of Seeed Technology Inc., this manual has been compiled and published which covered the latest product description and specification. The content of this manual is subject to change without notice.
1. Introduction This Moisture Sensor can be used to detect the moisture of soil or judge if there is water around the sensor, let the plants in your garden reach out for human help. They can be very easy to use, just insert it into the soil and then read it.
5. Usage 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 deficits, the sensor output value will decrease. You can know whether a plant needs water or not by observing the results that the sensor outputs. The following sketch demonstrates a simple application of sensing the moisture of the soil.
void setup() { // declare the ledPin as an OUTPUT: Serial.begin(9600); void loop() { // read the value from the sensor: sensorValue = analogRead(sensorPin); delay(1000); Serial.print("sensor = " ); Serial.println(sensorValue); here Upload the code, please click if you do not know how to upload. ...
Page 11
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) * one side pin (either one) to ground * the other side pin to +VCC * LED anode (long leg) attached to RED_LED...
Page 12
#define ON HIGH /* led on */ #define OFF /* led off */ #define _handle_led(x) digitalWrite(BLINK_LED, x) /* handle led */ /* Global Varibles */ TM1637 tm1637(CLK, DIO); /* 4-digital display object */ int analog_value = 0; /* varible to store the value coming from rotary angle sensor */ int8_t bits[4] = {0};...
4.Navigate to the demos' directory: 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)
Need help?
Do you have a question about the Grove Moisture Sensor and is the answer not in the manual?
Questions and answers