Introduction: Make a Soil Moisture Meter With the Help of Arduino

Picture of Make a Soil Moisture Meter With the Help of Arduino

I am an academician in Faculty of Agriculture. We have a lot of experiments in field and measure some parameters that are constraint to do. One of the compulsory measurement is determining of soil moisture. Estimation of soil moisture as using soil sampler is more accurate measurement, but need to so much labor and time. So I decided to make a soil moisture meter with the aid of arduino and soil moisture sensor. I hope it will be useful for you.

Make it yourself

Sincerely..

Step 1: What You Need For?

Picture of What You Need For?

Inventory:

- Arduino Uno R3

- Arduino IDE

- multimeter

- Breadboard and jumper cables

- soldering equipment

- dremel with part of spiral and drill bit

- calipers, pliers, tweezers, screwdriver, cutter (knife, scissors)

- lighter

- hot glue gun

Consumables:

- Plastic box (dimensions about 13 x 7 x 5 cm)

- Attiny85 micro controller (DIP socket) and suitable 8 pin DIP socket

- 74HC595 (8-bit shift register, DIP socket)

- Single side copper plate (dimensions about 30 x 50 mm)

- 15 x male header 180 degree

- 8 x male header 90 degree

- 2 x 10K resistor (1/4 watt)

- 20 x female to female jumper cables (approx. 18 cm)

- LM393 Soil Moisture Sensor

- 16x2 alphanumeric LCD

- push button

- switch button

- LM7805 (5v regulator)

- 12v A23 battery and holder

- USB male and female sockets

- stripboard

Step 2: Creating a Controller of Sensor

Picture of Creating a Controller of Sensor

You can see above diagram of controller that contains of Attiny85 and 74HC595. You can also directly print it to copper plate by using PCB design (see below) as well as use strip-board. There are so many instructables how to make PCB.

Be patient, do it carefully and sensitively.

Step 3: Code to Attiny85 for Measuring

Picture of Code to Attiny85 for Measuring

Check your Arduino IDE. If there is no Attiny85 in the cards, you need to update it and introduce with Attiny85.

1- Get the Arduino ISP codes from examples due to we use Arduino Uno as programmer.

2- Adjust the programmer as AVRISP mkII

3- Upload the sketches to Arduino Uno

4- Wiring the pins as following:

Attiny85 Pin 2 --> Arduino Uno Pin 13

Attiny85 Pin 1 --> Arduino Uno Pin 12

Attiny85 Pin 0 --> Arduino Uno Pin 11

Attiny85 Pin Reset --> Arduino Uno Pin 10

Attiny85 VCC --> Arduino Uno +5V

Attiny85 GND --> Arduino Uno GND

*** Connect 10uF electrolytic capacitor between Reset and GND in Arduino Uno, otherwise it always reset Arduino Uno.

5- Select Attiny85 as your card and adjust programmer as Arduino as ISP.

6- Upload sketch as follows:

#include <liquidcrystal595.h>
LiquidCrystal595 lcd(0,1,2);    // datapin, latchpin, clockpin
int sensor_pin=3;
int battery_pin=4;
int measure_btn_pin=4;
int measure_buttonState=0;
int measure_lastButtonState=0;
int lcd_initiating=0;
int measurement_value;
float battery_level; 
float ks;
float battery_level_percentage;
void setup()
{
	pinMode(battery_pin, OUTPUT);
	pinMode(measure_btn_pin, INPUT);
    	lcd.begin(16,2);            
    	lcd.clear();
}
void loop()
{
    battery_level=1024-analogRead(battery_pin); 
	ks=battery_level/1024.0; 
    	///////// Measure Button////////////////////////////
    	measure_buttonState=digitalRead(measure_btn_pin);
	if(measure_buttonState != measure_lastButtonState)
	{
	if(measure_buttonState ==1){
	measurement_value = round(analogRead(sensor_pin)/ks);
	lcd.clear();
	lcd.setCursor(0,0);
	lcd.print("%Nem:");
	lcd.print(measurement_value);
	lcd.display();
	}
	delay(50);
	}
	measure_lastButtonState=measure_buttonState;
	if(lcd_initiating==0)
	{
		lcd.setCursor(0,0);
		lcd.print("NemOlcer");
		lcd.setCursor(0,1);
		lcd.print("Bat:%");
		lcd.print(battery_level_percentage);
    		lcd_initiating=1;
	}
}

Step 4: Prepare to Plastic Box

Picture of Prepare to Plastic Box

You can arrange differently to the slot of LCD display, push button, switch button and USB socket.

1- Draw a rectangular for LCD slot and cut it by using spiral.

2- Make a hole for push button and a rectangular for switch button via dremel.

3- Lastly, perform a slot for USB female socket by dremel.

4- Be sure edges of slots are clean appropriate mounting.

Step 5: Performing Some Components

Picture of Performing Some Components

It depends on you what you use. I used small pieces of strip-board.

1- I have preferred 12V A23 battery and LM7805 (5V regulator) due to A23 battery is the smallest one. You can see pin out of LM7805 above. I didn't have A23 battery slot and made one of them for myself.

2- Prepare push button in order to use with jumper cables.

3- Solder USB female socket to strip-board. We will use it as data collector from sensor.

4- We had already have component that read the conductivity between legs then transfer it to our micro controller.

5- Connect USB male socket and sensor leg to cables.

Step 6: Mounting All of the Components to Plastic Box

Mounting components is need a lot of steps and I don't wanna do images and data crowd in my instructable. So it is easier and suitable to demonstrate it by preparing a video.

Do it yourself..

Regards..

Comments

About This Instructable

2,784views

52favorites

License:

Bio: I have always were person who wanna invent something that related with my job. So I discovered to Arduino and my life has been changed ... More »
More by JeoleX:How to make A23 (23AE) Battery Holder for your tiny projectsNIHUR Meatballs in Tomato SaucePCB Spider (Holder) for Your Project
Add instructable to: