Difference between revisions of "Moisture Sensor"

From ITEAD Wiki
Jump to: navigation, search
(Demo)
(Download)
Line 104: Line 104:
  
 
==Download==
 
==Download==
 +
[ftp://imall.iteadstudio.com/Electronic_Brick/IM121017001/DS_IM121017001.pdf Datasheet for Moisture Sensor]
 +
 +
[ftp://imall.iteadstudio.com/Electronic_Brick/IM121017001/SCH_IM121017001.pdf Schematic for Moisture Sensor]
 +
 +
[ftp://imall.iteadstudio.com/Electronic_Brick/IM121017001/DEMO_IM121017001.zip Demo code for Moisture Sensor]
  
 
==Useful Links==
 
==Useful Links==

Revision as of 07:45, 27 May 2014

Overview

Soil moisture sensor.jpg

Electronic brick of soil moisture sensor is mainly used to detect the moisture content in the soil. The control board can get the moisture value or threshold in the soil via analog or digital pins.

Features

1. Plug and play, easy to use. Compatible with the mainstream 2.54 interfaces and 4-Pin Grove interfaces in the market.

IM121017001_2.jpg

2. With use of M4 standard fixed holes, compatible with M4-standard kits such as Lego and Makeblock.

IM121017001_3.jpg

3. With switch to shift between analog and digital output. Able to read the specific soil moisture information (analog) or the over-wet or over-dry soil information according to the threshold (digital). The adjustable potentiometer is used to set the moisture threshold.

IM121017001_4.jpg

4. With hysteresis comparator circuit for more stable digital output voltage.

IM121017001_5.jpg

Specifications

PCB size 71.65mm X 24.00mm X 1.6mm
Working voltage 3.3 or 5V DC
Operating voltage 3.3 or 5V DC
Compatible interfaces .54 3-pin interface and 4-pin Grove interface(1)(2)

Note 1: D for digital output port, A for analog output port, S for analog/digital output port ( defined according to the switch), V and G for voltage at the common collector and ground respectively

Note 2: When setting as analog output, output range is 0-3.3V or 0-5V according to the working voltage; when setting as digital output, output is 0/3.3V or 0/5V according to the working voltage.

Electrical Characteristics

Parameter Min. Typical Max. Unit
Working voltage 2.1 5 5.5 VDC
Analog output voltage(VCC=5V) 0 Vout 5 V
Digital output voltage(VCC=5V) 0 - 5 V
Working current(VCC=5V) - 5 - mA
Threshold hysteresis ΔUth - VCC*0.09 - V

Hardware

IM121017001_6.jpg

Switch and indicator

1. Regulating of threshold voltage:

The threshold voltage is a voltage for comparison. When the soil moisture value read by the sensor is above the threshold value, a low level (0V) will be digitally output; when the soil moisture value read by the sensor is below the threshold value, a high level (3.3V or 5V) will be digitally output. In this way, the digital pin can be used directly to read the current soil moisture value to see if it is above the threshold or not. The threshold voltage can be regulated by simply twisting the potentiometer which is shown in Figure 1., and it increases by rotating to left side and decreases by rotating to right side.

IM121017001_7.jpg

2. Switch to shift between analog and digital output

For 4-pin Grove interface, this switch makes no sense.

For S pin in 2.54mm 3-pin interface, it outputs analog signals when switch is pushed to A terminal and digital signals when pushed to D terminal. When there is analog signal output, it can read the specific soil moisture value; when there is digital signal output, it can only indicate whether the soil moisture value is above threshold value or not.

Demo

1. Push the snap switch of sensor to analog output, connect S port to A0 port of Arduino board, and we will use the following program to read the analog value of soil and send it to computer for display via the serial port.

 int ASignal = A0;
 void setup() {
 Serial.begin(9600);
 }


 void loop() {
 int sensorValue = analogRead(ASignal);
 Serial.println(sensorValue);
 }

2. Push the snap switch of sensor to digital output, connect S port to D2 port of Arduino board, and we will use the following program to read the digital value of soil and send the threshold to computer for display .

 int DSIGNAL = 2;
 void setup() 
 {
 Serial.begin(9600);
 pinMode(DSIGNAL, INPUT);
 }

 void loop() 
 {
 int DsignalState = digitalRead(DSIGNAL);
 Serial.println(DsignalState);
 delay(100);      
 }

Download

Datasheet for Moisture Sensor

Schematic for Moisture Sensor

Demo code for Moisture Sensor

Useful Links