Upload
bruno-goncalves
View
166
Download
2
Embed Size (px)
Citation preview
Soil Moisture Sensor Soil Hygrometer Detection ModuleSoil Moisture Sensor Soil Hygrometer Detection Module
Features:
o Brand new and high quality.
o This is a simple water sensor, can be used to detect soil moisture.
o Module Output is high level when the soil moisture deficit,or output is low.
o Can be used in module plant waterer device, and the plants in your garden no need people to
manage.
o Operating voltage: 3.3V~5V.
o Dual output mode,analog output more accurate.
o A fixed bolt hole for easy installation.
o With power indicator (red) and digital switching output indicator (green).
o Having LM393 comparator chip, stable.
o Panel PCB Dimension: 3cm x 1.5cm.
o Soil Probe Dimension: 6cm x 3cm.
o Cable Length: 21cm.
Interface Description(4-wire):
o VCC: 3.3V-5V.
o GND: GND.
o DO: digital output interface(0 and 1).
o AO: analog output interface.
Instructions for Use:
o Soil moisture module is most sensitive to the ambient humidity is generally used to detect the
moisture content of the soil.
o Module to reach the threshold value is set in the soil moisture, DO port output high, when the the
soil humidity exceeds a set threshold value, the module D0 output low.
o The digital output D0 can be connected directly with the microcontroller to detect high and low by
the microcontroller to detect soil moisture.
o The digital outputs DO shop relay module can directly drive the buzzer module, which can form a
soil moisture alarm equipment.
o Analog output AO and AD module connected through the AD converter, you can get more precise
values of soil moisture.
Arduino Code:
// Soil Moisture Sensor Hygrometer example code// Code author: aafent. This code is copy free, if you want please mention the author's name and/or the site//Interface Description (4-wire)//VCC: 3.3v-5v//GND: GND//DO: Digital output interface (0 and 1) threshold taken from potentiometer//AO: Analog output interface
const int moistureAO = 1;const int moistureDO = 31;
int AO = 0;int DO = 0;int tmp = 0;
void setup (){ Serial.begin(9600); Serial.println("Soil moisture sensor"); pinMode(moistureAO, INPUT); pinMode(moistureDO, INPUT);}
void loop (){ tmp=analogRead( moistureAO ); if ( tmp != AO ) { AO=tmp; Serial.print("A="); Serial.println(AO); } tmp=digitalRead( moistureDO ); if ( tmp != DO ) { DO=tmp; Serial.print("D="); Serial.println(DO); } delay (1000);
}
int sensorPin = A0; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
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);
}
Multi sensors:
int sensorPinA = A0; // select the input pin for the potentiometer
int sensorValueA = 0; // variable to store the value coming from the sensor
int sensorPinB = A1;
int sensorValueB = 0;
int sensores = 0;
void setup() {
// declare the ledPin as an OUTPUT:
Serial.begin(9600);
}
void loop() {
// read the value from the sensor:
sensorValueA = analogRead(sensorPinA);
delay(1000);
Serial.print("sensor A = " );
Serial.println(sensorValueA);
sensorValueB = analogRead(sensorPinB);
delay(1000);
Serial.print("sensor B = " );
Serial.println(sensorValueB);
sensores= (sensorValueB + sensorValueA)/2;
Serial.print("sensores = " );
Serial.println(sensores);
}