Ks0049 keyestudio Soil Humidity Sensor: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
 
(24 intermediate revisions by the same user not shown)
Line 1: Line 1:
<br>
==Introduction==
==Introduction==
This is a simple soil humidity sensor aims to detect the soil humidity. If the soil is in lack of water, the analog value output by the sensor will decrease, otherwise, it will increase. If you use this sensor to make an automatic watering device, it can detect whether your botany is thirsty to prevent it from withering when you go out. Using the sensor with Arduino controller makes your plant more comfortable and your garden smarter.  
This is a simple soil humidity sensor aims to detect the soil humidity. <br>
 
If the soil is in lack of water, the analog value output by the sensor will decrease; otherwise, it will increase.  
The soil humidity sensor module is not as complicated as you might think, and if you need to detect the soil in your project , it will be your best choice.
If you use this sensor to make an automatic watering device, it can detect whether your botany is thirsty to prevent it from withering when you go out. <br>
 
Using the sensor with Arduino controller makes your plant more comfortable and your garden smarter.  
The sensor is set with two probes inserted into the soil, then with the current go through the soil, the sensor will get resistance value by reading the current changes between the two probes and convert such resistance value into moisture content. The higher moisture (less resistance), the higher conductivity the soil has. 
The soil humidity sensor module is not as complicated as you might think, and if you need to detect the soil in your project, it will be your best choice.<br>
 
The surface of the sensor have undergone metallization process to prolong its service life. Insert it into the soil and then use the AD converter to read it. With the help of this sensor, the plant can remind you: I need water. 
<br>[[File:491.png|500px|frameless|thumb]]<br>


The sensor is set with two probes inserted into the soil, then with the current go through the soil, the sensor will get resistance value by reading the current changes between the two probes and convert such resistance value into moisture content. <br>
The higher moisture (less resistance), the higher conductivity the soil has.  <br>
Insert it into the soil and then use the AD converter to read it. With the help of this sensor, the plant can remind of you: I need water.
 
<br>[[File:KS0049.jpg|500px|frameless|thumb]]<br>


<br>
==Specification==
==Specification==
*Power Supply Voltage: 3.3V or 5V
* Power Supply Voltage: 3.3V or 5V
*Working Current: ≤ 20mA
* Working Current: ≤ 20mA
*Output Voltage: 0-2.3V (When the sensor is totally immersed in water, the voltage will be 2.3V) 5V power supply,the higher humidity, the higher the output voltage
* Output Voltage: 0-2.3V (When the sensor is totally immersed in water, the voltage will be 2.3V) the higher humidity, the higher the output voltage
*Packaging : Electrostatic bag sealing
* Sensor type: Analog output
*Sensor Type: Analog output
* Interface definition: Pin1- signal, Pin2- GND, Pin3 - VCC  
*Interface Definition: Pin1- signal, pin2- GND, pin3 - VCC  
* Packaging : Electrostatic bag sealing
*Service life: About one year (gold-plated surface for enhancing conductivity and  corrosion resistance )
*Module Size: 20X60mm


<br>
==Connection Diagram ==
==Connection Diagram ==
<br>[[File:0049.png|700px|frameless|thumb]]<br>


<br>[[File:492.png|500px|frameless|thumb]]<br>  
<br>


==Sample Code ==
==Sample Code 1 ==
Upload the code 1 to check the analog value on the monitor <br>


<pre>
<pre>
Line 30: Line 36:
  # Example code for the moisture sensor
  # Example code for the moisture sensor
  # Connect the sensor to the A0(Analog 0) pin on the Arduino board
  # Connect the sensor to the A0(Analog 0) pin on the Arduino board
 
  # the sensor value description
  # the sensor value description
  # 0  ~300     dry soil
  # 0  ~300     dry soil
  # 300~700     humid soil
  # 300~700     humid soil
  # 700~950     in water
  # 700~950     in water
*/
*/
 
void setup(){
void setup(){
 
 
  Serial.begin(57600);
  Serial.begin(57600);
 
}
 
void loop(){
void loop(){
 
  Serial.print("Moisture Sensor Value:");
  Serial.print("Moisture Sensor Value:");
  Serial.println(analogRead(0)); 
  Serial.println(analogRead(0)); 
  delay(100);
  delay(100);
}</pre>
}
</pre>
 
<br>
==Connection 2==
<br>[[File:Ks0049-1-1.jpg|800px|frameless|thumb]]<br>
 
<br>
'''Introduction to the pins of LCD1602:'''<br>
* GND: a pin that connects to ground <br>
* VCC: a pin that connects to a +5V power supply <br>
* SDA: a pin that connects to analog port A4 for IIC communication <br>
* SCL: a pin that connects to analog port A5 for IIC communication <br>
 
<br>
 
==Sample Code 2 ==
<pre>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display
 
void setup() {
  lcd.init();                      // initialize the lcd
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("Value:");
}
void loop() {
  int sensorValue = analogRead(A0); // read A0 data and assign to sensorValue
  if(sensorValue<10)
  {
  lcd.setCursor(6,0);
  lcd.print(sensorValue);
  lcd.setCursor(7,0);
  lcd.print("    ");
  }
  if(sensorValue<100)
  {
  lcd.setCursor(6,0);
  lcd.print(sensorValue);
  lcd.setCursor(8,0);
  lcd.print("    ");
  }
  if(sensorValue>99)
  {
  lcd.setCursor(6,0);
  lcd.print(sensorValue);
  }
  if(sensorValue<301)
  {
  lcd.setCursor(0,1);
  lcd.print("dry soil      ");
  }
  if((sensorValue>300)&&(sensorValue<501))
  {
  lcd.setCursor(0,1);
  lcd.print("humid soil  ");
  }
    if(sensorValue>500)
  {
  lcd.setCursor(0,1);
  lcd.print("in water      ");
  }
  delay(200);
}
</pre>
 
<br>
If upload the code 2, you will see the result as below:<br>
<br>[[File:Ks0049-2.png|600px|frameless|thumb]]<br>
 
<span style=color:red> Remember you can adjust the contrast by turning the potentiometer on the back if you can’t make out the words clearly. <br>
<br>[[File:Lcd 1602.png|600px|frameless|thumb]]<br>
 
 
<br>


==Resources ==
==Resources ==


'''Video'''
* '''Video'''<br>
http://video.keyestudio.com/ks0049/
 
*'''Get the Libraries of Wire and LiquidCrystal_I2C''' <br>
https://fs.keyestudio.com/KS0049


http://www.keyestudio.com/wp/2016/05/ks0049-keyestudio-soil-humidity-sensor/


'''Datasheet'''


http://www.keyestudio.com/files/index/download/id/1463713701/
 
 
 
<br>


==Buy from ==
==Buy from ==
'''Official Website'''


http://www.keyestudio.com/keyestudio-soil-humidity-sensor-for-arduino.html
*[https://www.keyestudio.com/free-shipping-keyestudio-soil-humidity-sensor-for-arduino-p0126.html '''Official Website''']
 
*[https://www.amazon.com/keyestudio-Soil-Humidity-Sensor-Arduino/dp/B0177SIDMY/    '''Amazon store''']


'''Amazon Store'''
*[https://www.aliexpress.com/store/product/Free-shipping-Soil-moisture-sensor-Moisture-sensor-for-Arduino-automatic-watering-system-with-demo-code/1452162_2051297944.html?spm=2114.12010612.8148356.27.52862462ZM2AO8  '''aliexpress store''']


https://www.amazon.com/keyestudio-Soil-Humidity-Sensor-Arduino/dp/B0177SIDMY/ref=sr_1_1?ie=UTF8&qid=1480300463&sr=8-1&keywords=keyestudio+Soil+Humidity+Sensor+for+Arduino


[[Category: Sensor]]
[[Category: Sensor]]

Latest revision as of 14:09, 7 January 2021


Introduction

This is a simple soil humidity sensor aims to detect the soil humidity.
If the soil is in lack of water, the analog value output by the sensor will decrease; otherwise, it will increase. If you use this sensor to make an automatic watering device, it can detect whether your botany is thirsty to prevent it from withering when you go out.
Using the sensor with Arduino controller makes your plant more comfortable and your garden smarter. The soil humidity sensor module is not as complicated as you might think, and if you need to detect the soil in your project, it will be your best choice.

The sensor is set with two probes inserted into the soil, then with the current go through the soil, the sensor will get resistance value by reading the current changes between the two probes and convert such resistance value into moisture content.
The higher moisture (less resistance), the higher conductivity the soil has.
Insert it into the soil and then use the AD converter to read it. With the help of this sensor, the plant can remind of you: I need water.  
thumb


Specification

  • Power Supply Voltage: 3.3V or 5V
  • Working Current: ≤ 20mA
  • Output Voltage: 0-2.3V (When the sensor is totally immersed in water, the voltage will be 2.3V) the higher humidity, the higher the output voltage
  • Sensor type: Analog output
  • Interface definition: Pin1- signal, Pin2- GND, Pin3 - VCC
  • Packaging : Electrostatic bag sealing


Connection Diagram


thumb


Sample Code 1

Upload the code 1 to check the analog value on the monitor

/*
  # Example code for the moisture sensor
  # Connect the sensor to the A0(Analog 0) pin on the Arduino board
  # the sensor value description
  # 0  ~300     dry soil
  # 300~700     humid soil
  # 700~950     in water

*/
void setup(){
 
  Serial.begin(57600);
} 
void loop(){
  Serial.print("Moisture Sensor Value:");
  Serial.println(analogRead(0)); 
  delay(100);
}


Connection 2


thumb


Introduction to the pins of LCD1602:

  • GND: a pin that connects to ground
  • VCC: a pin that connects to a +5V power supply
  • SDA: a pin that connects to analog port A4 for IIC communication
  • SCL: a pin that connects to analog port A5 for IIC communication


Sample Code 2

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup() {
  lcd.init();                      // initialize the lcd 
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("Value:");
}
void loop() {
  int sensorValue = analogRead(A0); // read A0 data and assign to sensorValue
  if(sensorValue<10)
  {
  lcd.setCursor(6,0);
  lcd.print(sensorValue);
  lcd.setCursor(7,0);
  lcd.print("    ");
  }
  if(sensorValue<100)
  {
  lcd.setCursor(6,0);
  lcd.print(sensorValue);
  lcd.setCursor(8,0);
  lcd.print("    ");
  }
  if(sensorValue>99)
  {
  lcd.setCursor(6,0);
  lcd.print(sensorValue);
  }
   if(sensorValue<301)
  {
  lcd.setCursor(0,1);
  lcd.print("dry soil       ");
  }
  if((sensorValue>300)&&(sensorValue<501))
  {
  lcd.setCursor(0,1);
  lcd.print("humid soil   ");
  }
     if(sensorValue>500)
  {
  lcd.setCursor(0,1);
  lcd.print("in water       ");
  }
  delay(200);
}


If upload the code 2, you will see the result as below:

thumb

Remember you can adjust the contrast by turning the potentiometer on the back if you can’t make out the words clearly.

thumb



Resources

  • Video

http://video.keyestudio.com/ks0049/

  • Get the Libraries of Wire and LiquidCrystal_I2C

https://fs.keyestudio.com/KS0049





Buy from