capacitive soil moisture sensor v1.2 again

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Dick60
Normal user
Posts: 242
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

capacitive soil moisture sensor v1.2 again

#1 Post by Dick60 » 30 Apr 2022, 14:48

I tried to get this device working on an esp8266 and an esp32 (preferable) but did not had any sucees in it. I use the ESPEasy_binaries27042022 and connected the soil moister sensor to the 5v, Gnd and an Analog port (in my case on the esp32 pen nr 25 (ADC2-ch8). Also put the sensor in some soil. No messurement are visible. I did not activate the oversampling or the calibration. I tries to put an formula in it ((%value%-350)/(800-350)*100) as mentioned in an old post but also no result. Any suggestions to give this project a push?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: capacitive soil moisture sensor v1.2 again

#2 Post by TD-er » 30 Apr 2022, 16:00

First, see: https://espeasy.readthedocs.io/en/lates ... ty-and-adc
Do not use an analog input connected to ADC2 when you also use WiFi.

Second, what resistors do you use to get the measured voltage between 0 and 3V3?
See: https://randomnerdtutorials.com/esp32-a ... duino-ide/

Dick60
Normal user
Posts: 242
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: capacitive soil moisture sensor v1.2 again

#3 Post by Dick60 » 30 Apr 2022, 17:02

I switched to the esp8266 because it is more convinient for me to test the sensor. I use A0 port and connected a 10k potmeter to 3.3vplus, to the GND and in the middle to A0. Als paralel to the potmeter I connected the Sensor. Turning the Potmeter I see a change in messurments but putting the sensor in the wet soil, no difference is messured. Any idea?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: capacitive soil moisture sensor v1.2 again

#4 Post by TD-er » 30 Apr 2022, 17:59

I assume it is similar to this one:

Image

Are you sure about the connected pins?
Can you measure a voltage over the analog output pin on the sensor when keeping it dry and putting it in wet soil (or a wet paper towel wrapped around the sensor)

Dick60
Normal user
Posts: 242
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: capacitive soil moisture sensor v1.2 again

#5 Post by Dick60 » 30 Apr 2022, 18:19

Image
it is like tris one

Ton_vN
Normal user
Posts: 300
Joined: 21 Oct 2016, 15:20
Location: Hengelo (Ov)/ NL
Contact:

Re: capacitive soil moisture sensor v1.2 again

#6 Post by Ton_vN » 30 Apr 2022, 18:35

@Dick60,

In your message of 17:02, I read
Als paralel to the potmeter I connected the Sensor. Turning the Potmeter I see a change in messurments but putting the sensor in the wet soil, no difference is messured.
Don't parallel connect, because then you only see the potmeter which probably is 'more powerful' than the sensor-output!
It should be:
either potmeter,
or sensor, like in your latest message.

Dick60
Normal user
Posts: 242
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: capacitive soil moisture sensor v1.2 again

#7 Post by Dick60 » 30 Apr 2022, 18:39

I tested like my last picture, with ONLY the Sensor. In that case I see no difference between the messurements in the wet soil and the dry soil. It is a nem sensor and tested also a second sensor withthe sam result. I think it isnt working with the ESPeasy firmware.

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: capacitive soil moisture sensor v1.2 again

#8 Post by Ath » 30 Apr 2022, 19:52

Dick60 wrote: 30 Apr 2022, 17:02 Turning the Potmeter I see a change in messurments
Dick60 wrote: 30 Apr 2022, 18:39 I think it isnt working with the ESPeasy firmware.
Your first statement proves that your second statement is incorrect.

I'd have a good look at that sensor again, and use a multi-meter to see if the output voltage actually changes between wet and dry measurement.
/Ton (PayPal.me)

Dick60
Normal user
Posts: 242
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: capacitive soil moisture sensor v1.2 again

#9 Post by Dick60 » 30 Apr 2022, 21:26

I did some mesurements on the sensor and the spare sensor. I used my multimeter and connected the senser to 5v and mut my multimeter on the data line of the sensor and the plus (later the gnd) but there is no difference between wet soil and dry soil. No voltage change discovered during these mesurements.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: capacitive soil moisture sensor v1.2 again

#10 Post by TD-er » 30 Apr 2022, 21:40

What voltage do you measure (between out and GND) ?
Maybe it improves when you add a small resistor over the output and GND?
Not sure how the internal circuit does work, but typically they charge a capacitor. But if it doesn't get discharged it will slowly increase to the charge voltage (e.g. 5V) without any significant change in voltage due to soil humidity changes.

Dick60
Normal user
Posts: 242
Joined: 11 Feb 2018, 17:35
Location: The Netherlands

Re: capacitive soil moisture sensor v1.2 again

#11 Post by Dick60 » 30 Apr 2022, 22:01

unfortunately no better news, also with a small resister, no change between the two messurments. I will try an external power source instead of the 5v of my ESP8266.

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: capacitive soil moisture sensor v1.2 again

#12 Post by manjh » 04 Jul 2022, 18:39

I got this to work, hardware is straightforward.
But I am struggling with the formula....

My upper value (dry) is 419.
Lower value (immersed in water) is 53.
Meaured value is somewhere in between.

I have been breaking my head on how to map the measured value into a moisture percentage..... any ideas?

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: capacitive soil moisture sensor v1.2 again

#13 Post by manjh » 04 Jul 2022, 21:41

manjh wrote: 04 Jul 2022, 18:39 I got this to work, hardware is straightforward.
But I am struggling with the formula....

My upper value (dry) is 419.
Lower value (immersed in water) is 53.
Meaured value is somewhere in between.

I have been breaking my head on how to map the measured value into a moisture percentage..... any ideas?
I think I found the formula ;) :
(419-%value%)/(419-53)*100
Where 419 is the upper value (dry) and 53 the lower (immersed).

Haldi_2
Normal user
Posts: 53
Joined: 24 Aug 2020, 18:10

Re: capacitive soil moisture sensor v1.2 again

#14 Post by Haldi_2 » 24 Jul 2022, 19:20

manjh wrote: 04 Jul 2022, 18:39 I have been breaking my head on how to map the measured value into a moisture percentage..... any ideas?
Uhm... it's an Analog input right?
Just use Two Point Calibartion?
del.jpg
del.jpg (24.08 KiB) Viewed 9151 times

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: capacitive soil moisture sensor v1.2 again

#15 Post by TD-er » 24 Jul 2022, 21:29

I don't think it is a linear relation between voltage and what you're measuring.
The formula suggested in the post before yours can be entered in the formula field at the bottom of the task.

manjh
Normal user
Posts: 516
Joined: 08 Feb 2016, 11:22

Re: capacitive soil moisture sensor v1.2 again

#16 Post by manjh » 25 Jul 2022, 12:45

Haldi_2 wrote: 24 Jul 2022, 19:20
manjh wrote: 04 Jul 2022, 18:39 I have been breaking my head on how to map the measured value into a moisture percentage..... any ideas?
Uhm... it's an Analog input right?
Just use Two Point Calibartion?
del.jpg
Where can this be entered?

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: capacitive soil moisture sensor v1.2 again

#17 Post by obod0002c » 10 Dec 2022, 11:18

has one meanwhile been able to successfully use this kind of sensor and could share the howto/settings?

I'm trying it with a DFRobot FireBeetle, sensor connected to 3V3, GND and A0.

Device: Analog input - internal
Analog Pin: Hall Effect
Att: 11dB
Oversampling: Use Current Sample

When switching to ADC1 ch0 / GPIO-36, which should be the better approach as far as I understand it, I don't get any reading but 0.00.

The settings in the device's tab is most probably the wrong one, but at least I'm receiving a reading, one that jumps from one value to a 'not correlated' one unfortunately

I set also the 'Two Point Calibration'.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: capacitive soil moisture sensor v1.2 again

#18 Post by TD-er » 10 Dec 2022, 12:14

Which pin on the ESP32 are you using?
There isn't a pin called "A0" on the ESP32. That's the analog pin on an ESP8266.
Also better use "oversampling" as it takes a number of samples and averages it.

When using a multimeter, what voltage do you measure between the analog output of the sensor and GND?

Oh and uncheck the two-point calibration for now, as its default values are 0->0.0 and 0->0.0
Thus if you have not updated those values to something sensible, you will always get 0 as output.

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: capacitive soil moisture sensor v1.2 again

#19 Post by obod0002c » 10 Dec 2022, 14:34

The DFR FireBeetle really has a pin named A0 / IO36 (top left)
DFR_FB.jpg
DFR_FB.jpg (763.01 KiB) Viewed 6352 times
When switching to ADC 1 / ch0 I'm receiving 136,5mV with all pins connected to the ESP.

I had set 500 to represent for 0% and 1 for 100% - now it's deactivated.

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: capacitive soil moisture sensor v1.2 again

#20 Post by Ath » 10 Dec 2022, 14:52

Ah, yes, DF-Robot is doing a lot of things a little bit different than usual. The A0..An/D0..Dn pin numbers are originally introduced on the Arduino boards, and also numbered like that on the Wemos D1 mini, but for ESP32 this confusing numbering scheme (no linear match to GPIO pins) was dropped. Except by DF-Robot, it seems :(.
/Ton (PayPal.me)

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: capacitive soil moisture sensor v1.2 again

#21 Post by obod0002c » 11 Dec 2022, 13:47

With the interval set to 60sec, I'll receive the following data from this sensor in the soil with no watering for approx. a day:
moisture.jpg
moisture.jpg (51.5 KiB) Viewed 6304 times

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: capacitive soil moisture sensor v1.2 again

#22 Post by TD-er » 11 Dec 2022, 13:58

Is this with "oversampling" enabled?
Maybe you should also add a small (100nF) capacitor over the analog pin and GND on the ESP.

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: capacitive soil moisture sensor v1.2 again

#23 Post by obod0002c » 11 Dec 2022, 14:04

oversampling active, yes.

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: capacitive soil moisture sensor v1.2 again

#24 Post by obod0002c » 14 Dec 2022, 16:55

looking a lot better and I believe I have to accept the relatively small deviations now ..
104condensator.png
104condensator.png (38.12 KiB) Viewed 6189 times

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: capacitive soil moisture sensor v1.2 again

#25 Post by obod0002c » 15 Dec 2022, 18:40

well well well, not really reliable (changed interval to 15min meanwhile) ..
notrel.jpg
notrel.jpg (76.72 KiB) Viewed 6124 times

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests