Soil Moisture Sensor Module

  • Soil Moisture Sensor Module
Below you can see the corresponding code :
An example of a project for the soil moisture sensor
//author:danny van den brande, arduinosensors.nl. BlueCore Tech.
//This code is created as a example on how to build a automatic watering plant system with a servo. 
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>

//Most common adresses PCF8574 = 0x20, PCF8574A = 0x38,PCF8574AT = 0x3F 
//PCF8574T = 0x27   
#define I2C_ADDR          0x27   
#define BACKLIGHT_PIN      3
#define En_pin             2
#define Rw_pin             1
#define Rs_pin             0
#define D4_pin             4
#define D5_pin             5
#define D6_pin             6
#define D7_pin             7

int servoPin = 9;
int SensorPin = A0; 
int SensorValue;

Servo myservo;  
int pos = 90;   

LiquidCrystal_I2C      lcd(I2C_ADDR, En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()
 {
    Serial.begin(9600);
    pinMode(SensorPin, INPUT);
    lcd.begin (16,2);
    
    lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
    lcd.setBacklight(HIGH);
    lcd.print(" BlueCore Tech  "); 
    lcd.setCursor(0,1); 
    lcd.print("Moisture sensor   "); 
 
    delay(5000);
    
    lcd.clear();
    myservo.attach(servoPin); 
       
 }
 
void loop() 
{
  
  SensorValue = analogRead(SensorPin);
  Serial.println (SensorValue);
  lcd.setCursor(0,0);
  
  lcd.print("  Vochtigheid ");
  
  lcd.setCursor(0,4);
  lcd.print("");

  lcd.print(SensorValue/10.6);
  
  delay(2000);
  lcd.setCursor(0,4);
  lcd.clear();
  
  lcd.setCursor(0,4);
      
  lcd.print(SensorValue/10.6);
  
  if(analogRead(1)<550) { pos = 180; }
  else { pos = 60 ;}                        
  myservo.write(pos);                
  delay(15);
  
}

Write a review

Please login or register to review

Soil Moisture Sensor Module

  • Webwinkel Keurmerk en klantebeoordelingen

  • 14 dagen bedenktijd 
  • Verzendkosten voor eigen rekening
  • Product Code: RobotDynSoil
  • Availability: 19
  • 2.49€

  • Ex Tax: 2.06€

Similar Products

Linear Hall Magnetic Sensor Module

Linear Hall Magnetic Sensor Module

Below the corresponding code:int Led = 13 ;/ / define LED Interface int buttonpin = 3; / / define t..

2.36€ Ex Tax: 1.95€

Reed Switch Module

Reed Switch Module

Below the corresponding code:int Led = 13 ;/ / define LED Interface int buttonpin = 3; / / define t..

2.36€ Ex Tax: 1.95€

Analog Temp Sensor Module

Analog Temp Sensor Module

Below the corresponding code:#include <math.h>  int sensorPin = A5; // select the input ..

2.36€ Ex Tax: 1.95€

3 Color LED Module RGB

3 Color LED Module RGB

Below the corresponding code://KY016 3-color LED module int redpin = 11; // select the pin for the ..

2.36€ Ex Tax: 1.95€