loading

What we are going to make is a Arduino moisture sensor with YL-69 sensor which work based on a resistance between the two "blades". It will give us values between 450-1023 so we need to map it to get the percentage value, but we well get to this later. So lets begin.

Step 1: Gathering Parts

You neet to gather:

1. LCD 16x2 (White in my case)

2. Potentiometer 47k Ohm (or smaller, I only had that one, but you can also use 10-20k and it should be just fine)

3. Cables, a lot of cables

4. Prototype board

5. Arduino Uno / Arduino Pro mini (with programmer)

6. Power supply (9V battery for example)

7. Moisture sensor (for ex. YL-69)

Step 2: Connect LCD

Connect the LCD with the cables to arduino as it's shown on a shematic. Do not forget the potentiometer.

Step 3: Connect Moisture Sensor

Connect the moisture sensor board VCC pin to + rail of the prototype board and GND pin to ground. (I connected to the second ground on the arduino board)

Moisture sensor data pin need to be connected to A0 (in case of YL-69 its the last of 4 pins) on arduino board.

Step 4: Code

// Author: W. Marczak
#include <LiquidCrystal.h>
// include the LCD library
LiquidCrystal lcd(12, 11, 7, 6, 5, 4);
// Set pins as 12,11,7,6,5,4. It might be different for your LCD, check the producer catalog
int potPin = A0; //input pin
int soil=0;
void setup() {
lcd.begin(16, 2);
// lcd rows and columns
lcd.print("Humidity");
// title of sorts
Serial.begin(9600);
}
void loop() {
// map the values
int soil = analogRead(potPin) ;
soil = constrain(soil, 485, 1023);
soil = map(soil, 485, 1023, 100, 0);
lcd.setCursor(0, 1);
//display final numbers
lcd.print(soil);
//print the percent symbol at the end
lcd.print("%");
//wait 0.1 seconds
delay(75);
//wipe the extra characters
lcd.print(" ");
delay(1);
}

Step 5: Add the Power Supply

Add the proper power supply (5-9V should be fine) and set the contrast of your LCD with the potentiometer. Also set the potentiometer on the YL-69 moisture sensor if the red light on the small board is not on. What you should get is as its shown on the picture, but instead of Wilgotnosc you ll get "Humidity", as Humidity is wilgnotność in my language. Check if the sensor is working properly with a cup of water.

<p>I have made this project and it works brilliantly! Thank you for this</p>
<p>I made this one, but my LCD is shining super bright. Adjusting the pot meter (10K) has the only effect that small white blocks appear, nothing like your pictures.</p><p>Connections are checked 5 times, and 3 other times by another person. </p><p>Do you have any advice?</p>
Can u attach the picture of your lcd?
<p>I also have this problem.</p>
<p>Ah, now I got it to work. I moved pin D5 (on the display) to another pin on the breadboard, in the same row, though.</p>
<p>Great instructions, really enjoyed this build.</p>
<p>Polak!!!!!</p>
<p>https://www.instructables.com/id/Have-a-Bumper-Crop-With-Moisture-Sensors-and-ARDUI/</p>
<p>Great work there! My idea was based on taking short measurments and taking the probe out of the soil and off from the power, since i made it just to standarize the soil moisture for my plants in different conditions of growth (im currently doing a studies of germination of pulsatilla in different &quot;mediums&quot;(soil, sand, both in dark and exposed to fitotrone lamps light). To obtain my goal i need to have more or less the same moisture level of different &quot;mediums&quot;. Thanks for improving my idea, you just gave me an idea how to even make it better since a short measurments with plugged moisture sensing device to power might be the trick which i needed to also add a simple water pump which will add some water to the &quot;mediums&quot; if the sensor will give a low values. Also the next idea you gave me is to get a SD card shield and dump the measurments on the SD and make a monthly graphs. So again thanks for the improvments and next ideas:)</p>
<p>Wait a long time to refresh your display, otherwise you &quot;de galvanise&quot; your probes.</p><p>putting constant current through probes is like a chemical or electrochemical delamination process.</p><p>If probes are immersed in an aqueous solution (the soil). The metal on the probes dissolve in the electrolytic process.</p><p>To make your probes last, keep this process to a minimum.</p><p> A longer delay is suggested as the circuit does not need to test every second.</p><p>I use galvanised 6 mm thick bolts A2-70 or A4-70 as probes together with the cheap chinese sensor.</p><p>If the probes are magnetic, they contain iron and are not of good quality.</p><p>5 minutes x60x1000 = 5*60*1000</p><p>delay(5*60*1000);// =5 minutes</p>
<p>I need to make one of these for my indoor plants. A lot of them are pretty sensitive to moisture levels.</p>
<p>For example VH400 from Vegetronix. It main adventage is that it does not corrode over time. However it costs like 20 low cost YL-69's. For most of the plants YL-69 should be good enough, but remember it will corode over time. If your plants arent very sensitive and only pretty sensitive YL-69 should work, but keep it in mind that you might want to change the probe sometime since it will corrode a bit.</p>
<p>Then i also suggest to buy a more expensive moisture sensore, since those cheap chinese ones might not be good enough. Also take a look on the sensors which work is not based on a resistance, since the resistance depends from various of conditions (temp. for ex.) and might not work well enough. </p>

About This Instructable

13,710views

37favorites

License:

More by WojciechM3:Soil Moisture Sensor (LCD, RTC, SD Logger, Temperature) Arduino LCD soil moisture sensor 
Add instructable to: