BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Soil moisture sensor wuestion

Hello. I’ve just made my first plant monitor using Blynk. I’ve installed a soil moisture sensor and I’ve alresdy ordered a small water pump so I can water the plant with Blynk.

I have a question regarding the soil moisture sensor, as I’ve seen there’s quite a few people here using Blynk for simillar projects. The sensor displays 100% percent when not in soil or when it’s in dry soil (i filled a cup with dirt and tested it). I also filled another cup with dirt and put some water in it, the sensor displays ~60%. Are these values correct? Shouldn’t it be the other way around? Like 0% when in dry soil. In the screenshot above the sensor is located in a pot about 20-30 centimeters in size and about 20 cm in diameter that I’ve watered about 3 days ago. Thank you

What code are you using to read the moisture sensor?

map function

sensorValue = analogRead(sensorPin);
  sensorValue = map(sensorValue, 0, 1023, 1023, 0);
  sensorValuePercent = (sensorValue / 1023) * 100;
  Serial.print (String ("Bodenfeuchte ist : ") + sensorValue = analogRead(sensorPin));
  Blynk.virtualWrite(V7, sensorValue);

It works with the amp function, thanks. I’d also like to calibrate the sensor. I know 0% is when it’s out of soil, but when should it be 100%? When compeltely submerged in water? Also, is the calibration done by changing the values inside the map function?

Here’s the code for my main function:

void val(){
  analogRead(sensorpin);
  n = analogRead(sensorpin);
  int reverse = map(n, 0, 1023, 1023, 0);
  Blynk.virtualWrite(V0, reverse);
}

calibrate it however you like, it’s analog.

all you care about is when to switch on the pump anyways?

so you personally need to decide when that returned sensor voltage is - so you should ensure the sensor is most reliable around that point

do graphing - log readings over time and see where it gets too dry (according to the species you are intending to water - all plants require different waterings).

@Dave1829 I’d also like to know the real value of the soil moisture, not just when to water it. I’ve read online that the suitable moisture for my plant is about 25%… maybe taking some soil from it and completely watering it down to calibrate the higher value? The lower value seems right

real value?

in what? molecules of H2O per cubic millimetre?

what is you metric?

you will still only be able to know the real value by experimentation - even then your value will only be accurate if you only use exactly the same soil for all of your plants.

if this is a school project - sounds like a fun way to do some null-hypotheses? but if you are just trying to ensure you don’t kill your plant(s) by underwatering it - you just need to get it close and play with it after that…

(or do a long term experiment to determine actual water content.)

Real as in matching other legit soil moisture sensors data… but I don’t own one nor do I plan on buying one😂

do you have an example?

all sensors require calibration, how do they calibrate theirs?

I meant something like this

image

Here you go…
https://www.edaphic.com.au/soil-water-compendium/soil-moisture-sensor-calibration/

Have fun!

Pete.

that’s easy, calibrate it with that device!

those cost like 2 bucks on ebay - maybe buy a few and take the mean of them…