Introduction: SOIL MOISTURE SENSOR : ARDUINO

About: An educational blog for engineering students in providing information on electronics projects, Arduino projects, Engineering projects, circuits & Ideas

Soil moisture sensor is another type of sensor which is widely used now a days. It is used in nurseries or for home automation of check the right time to water the soil during farming.

It is easy to use and can be hooked to any micro-controller for the project or to make some stuff with it. There are more advanced sensors available in the market, the one which I am using is the easily available and easy to use.

Step 1: DESCRIPTION

Soil moisture sensor is a sensor which is built out of LM393 ic a two probes a variable resistor to trim the values of range of the value given by the sensor to the micro-controller.

Sensor also has an on board Power led and also an on board Status led which will blink whenever the sensor senses the moisture in the soil.

Probes act as variable resistors which then according to the resistance value gives out the output.

*NOTE:- THESE VALUES CAN BE CHANGED BY TRIMMING THE POTENTIOMETER AVAILABLE ON THE PCB OF THE SENSOR.

This sensor gives the output of both type ANALOG and DIGITAL. Difference b/w analog and digital signal is that in the digital signal only high state or low state is given but in the analog signal values b/w 0-1023 is given which is more suitable for condition in the code.

Step 2: SCHEMATIC DIAGRAM

Step 3: FEATURES

  • Water sensitivity is high
  • Easy to use
  • Adjustable value
  • Both type of signal out is available
  • Low price

NOTE:- The value of sensor depends upon the amount of water in the soil the value can be variable for salty and tap water.

  • Can be used in automated watering system
  • Nurseries
  • Offices
  • Personal gardens

Step 4: PINOUT

Step 5: COMPONENTS

  • Any micro-controller preferably Arduino Uno for beginners.
  • A led
  • A soil sensor
  • A breadboard
  • Jumper wires
  • 1kohm resistor

Step 6: CIRCUITING

First take the power lines onto the bread board from micro-controller VCC/5v-->+ line and GND--> - line.

Then connect the sensor on to the bread board and connect power to the sensor from powerlines using jumper wires.

Now connect A0 PIN OF SENSOR TO MICROCONTROLLER ANALOG PIN A0 and D0 PIN OF SENSOR TO DIGITAL(PIN 13) OF THE MICROCONTROLLER.

Now connect a led to the breadboard – wire to gnd and + wire to analog pin A1 of the microcontroller.

Step 7: CODE

//put this code in the ide of arduino from this line

//note:- this code is for analog value

int sensor=A0; //initializing the analog pin

int led=A1; // initializing buzzer pin

int value;

void setup(){

Serial.begin(9600);

pinMode(sensor, INPUT); // assing the pin mode type of the pin as input or output

pinMode(led, OUTPUT);

}

void loop(){

value=analogRead(sensor); //reading the valus from the sensor

value=map(value,0,1023,0,255); // mapping the value from 0 to 1023 b/w 0 to 255

digitalWrite(led, value); // switching the buzzer on or off by the mapped value

}

For digital value

//put this code in the ide of arduino from this line

//note:- this code is for digital value

int sensor_digital=13; // initializing the digital pin

int led=3;

int value;

void setup(){

Serial.begin(9600);

pinMode(sensor_digital, INPUT);

pinMode(led, OUTPUT);

}

void loop(){

value=digitalRead(sensor_digital); // reading the digital dat from the sensor

digitalWrite(led, value); // switching buzzer on or off

}

Step 8: WORKING

As the code starts it initializes the pin to which the sensor sense its data then the microcontroller waits for the data to be received as soon as the data is received it then check the condition and forwards the value to switch on or off the led.

If the soil has less water than the threshold value then according to the condition in the code it will do the following task.

Step 9: PCB DESIGNING

Now we have got the PCB design and it’s time to order the PCB’s.

For that, you just have to go to JLCPCB.com, and click on “QUOTE NOW” button.

JLCPCB are also sponsor of this project. JLCPCB (ShenzhenJLC Electronics Co., Ltd.), is the largest PCB prototype enterprise in Chinaand a high-tech manufacturer specializing in quick PCB prototype and small-batch PCB production. You can order a minimum of 5 PCBs for just $2.

To get the PCB manufactured, upload the gerber file you downloaded in the last step. Upload the.zip file or you can also drag and drop the gerber files.

After uploading the zip file, you’ll see a success message at the bottom if the file is successfully uploaded.You can review the PCB in the Gerber viewer to make sure everything is good. You can view both top and bottom of the PCB.

After making sure our PCB looks good, we can now place the order at a reasonable price. You can order 5 PCBs for just $2 but if it’s your first order then you can get 10 PCBs for $2.

To place the order, click on “SAVE TO CART” button.

My PCBs took 2 days to get manufactured and arrived within a week using DHL delivery option. PCBs were well packed and the quality was really good.

*NOTE:- If you need pcb gor this project than contact me or write me in the comment.