Stuck in "easy" project: PCF8591 and Moisture sensors

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Dynalon
Normal user
Posts: 12
Joined: 26 Jun 2020, 18:36

Stuck in "easy" project: PCF8591 and Moisture sensors

#1 Post by Dynalon » 07 Jan 2021, 19:42

Hello everybody,

I am stuck with an (actually very easy) project. To be honest, I am a beginner, so please do not shout on me, if I made just a dumb mistake.

I just want to run 4 "Capacitive Soil Moisture Sensors 2.0" with a D1 Mini (Git Build: mega-20200608, normal build 4m1m) and a PCF8591 module (not just the single chip) including brightness sensor and thermometer.
Image
Image
Unfortunately the tutorial/wiki https://www.letscontrolit.com/wiki/inde ... P_Connexio is very short and in difference to other articles not answering my questions:

How do I connect everything?
The capacitive Soil sensors have Following connectors
GND
VCC (3.3-5V)
Aout

On the PCF8591 there is

AOUT
AIN0
AIN1
AIN2
AIN3

and on the other side of the module i get;
SCL
SDA
GND
and VCC (3.3-5)

So this was my suggestion now:

Every Sensor is connected:
VCC = 3.3V (on D1 mini)
GND = GND
AOUT to AIN0 - AIN3 on the PCF8591

And the PCF8591 to my D1 Mini:
SCL = D1
SDA = D2
GND = GND
and VCC = 3.3V


So far so good (or already wrong?)

Now configured the ESPEasy Software:

Code: Select all

Device:	  Analog input - PCF8591 ❔ ℹ
Name:	  PlantSensor1
Enabled:	  yes
Sensor
Port:	          0
Data Acquisition
Send to Controller (until now not)
Interval:	[sec]       1
And this is what I got:
Analog input - PCF8591

Code: Select all

PlantSensor1	I2C		
SDA: 4
SCL: 5	
Analog:
96.00
I always get only this one value and it never changes!
Actually I expected to get 4 values for Moisture, plus one for Temperature and one for brightness (or at least the 4 moisture values).
Can anyone explain me what I forgot to do or did wrong?

Please do not refer to this article, I did not get it.
What is a domoticz device page? How do I set up?
Why do I not see any IDX/Var? my ESPEasy looks different than this, there is no more IDX:
Image

Thank you very much for your help!!!
Attachments
Unbenannt.jpg
Unbenannt.jpg (102.67 KiB) Viewed 17813 times

mrwee
Normal user
Posts: 225
Joined: 31 Aug 2016, 12:52

Re: Stuck in "easy" project: PCF8591 and Moisture sensors

#2 Post by mrwee » 07 Jan 2021, 23:35

Hi,

Can't help you with how you get things connected, but I can just say that I didn't manage to get good results with the moisture sensor. It didn't seem to match the actual moisture very well, and despite calibration it didn't really seem to work that well. Maybe it was just my setup, I don't know. Been looking for alternative, but have not found any :(

Dynalon
Normal user
Posts: 12
Joined: 26 Jun 2020, 18:36

Re: Stuck in "easy" project: PCF8591 and Moisture sensors

#3 Post by Dynalon » 08 Jan 2021, 16:52

Hello MrWee,

thank you fot this hint. Which sensors did you use? The capacitive one or the standard one with the 2 Metal plate contacts?

For me it doesn't need to be accurate, it is meant to remind to water the plants before they are dying. Some of them are after 4 days dry like dust, while others are still wet after 2 weeks. I just want to be reminded when one of them gets too dry...

mrwee
Normal user
Posts: 225
Joined: 31 Aug 2016, 12:52

Re: Stuck in "easy" project: PCF8591 and Moisture sensors

#4 Post by mrwee » 08 Jan 2021, 18:41

Dynalon wrote: 08 Jan 2021, 16:52 Hello MrWee,

thank you fot this hint. Which sensors did you use? The capacitive one or the standard one with the 2 Metal plate contacts?

For me it doesn't need to be accurate, it is meant to remind to water the plants before they are dying. Some of them are after 4 days dry like dust, while others are still wet after 2 weeks. I just want to be reminded when one of them gets too dry...
I used the one you posted a picture of (V2.0 sensor). My issue is that I calibrated it to return a value between 0-100 (dry -> 100% wet), but the value doesn't quite seem to correspond to how the soil feels.
My initial idea was to start watering in the morning, if e.g. measurement was e.g. 50. But when I start watering it doesn't increase very much.

Dynalon
Normal user
Posts: 12
Joined: 26 Jun 2020, 18:36

Re: Stuck in "easy" project: PCF8591 and Moisture sensors

#5 Post by Dynalon » 11 Jan 2021, 14:10

Ok, thats weird. Perhaps Water is just running through your pot to the bottom below the sensor?

Until now I tried it with one sensor and a glass of water, with a definition for 0 % and 100 %. This worked nicely (of course, juming from 0 to 100 and back doesn't mean, that 50% value is accurate, but the first tries looked promising). Just the thing is: I do not want to use 7 D1 Minis with 7 Powercables and 7 Batteries, if I can do this with 2 devices, too.

Isn't there anybody who can explain me???

toki73
Normal user
Posts: 12
Joined: 16 Dec 2020, 10:05

Re: Stuck in "easy" project: PCF8591 and Moisture sensors

#6 Post by toki73 » 22 Jan 2021, 09:59

Hi, i try to connect the Moisture 2.0 Sensor on Wemos D1 mini. Wich analog Device I have to use. I used the A0 Pin, VCC 3,3 and GND. I get only a fixed value. Ist 'analog' or analog PCF8591 the correct Device?

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

Re: Stuck in "easy" project: PCF8591 and Moisture sensors

#7 Post by TD-er » 22 Jan 2021, 10:46

A0 is a pin on the ESP board itself.
N.B. if you want to use that pin, you need to use a build which does NOT have "VCC" in the file name. (those are meant to measure the voltage appllied to the ESP)

How do you have this sensor connected?
What voltage (relative to GND) is present on the pin of the sensor you like to measure?

toki73
Normal user
Posts: 12
Joined: 16 Dec 2020, 10:05

Re: Stuck in "easy" project: PCF8591 and Moisture sensors

#8 Post by toki73 » 22 Jan 2021, 11:17

I used the VCC-Bin and the VCC from the Wemos

Wich analog Sensor Setting I have to use?

I connected the the Sensor fromm Wmemos with VCC3,3, GND, A0. The Board is connected via USB Power Cable

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

Re: Stuck in "easy" project: PCF8591 and Moisture sensors

#9 Post by TD-er » 22 Jan 2021, 12:12

You have to use a bit which has NO "Vcc" in the bin name.
Otherwise you will measure the 3v3 supplied to the ESP.

Thus:
- Measure something on pin A0 => NO VCC!
- Measure supplied 3v3 voltage on the ESP => Use "VCC" build.

toki73
Normal user
Posts: 12
Joined: 16 Dec 2020, 10:05

Re: Stuck in "easy" project: PCF8591 and Moisture sensors

#10 Post by toki73 » 22 Jan 2021, 13:08

Ich used: ESP_Easy_mega_20210114_test_beta_ESP8266_4M1M.bin

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

Re: Stuck in "easy" project: PCF8591 and Moisture sensors

#11 Post by TD-er » 22 Jan 2021, 13:56

That build should be able to measure voltage on the A0 pin.
For that you need to use the "Analog input - internal" plugin.

The ESP8266 ADC pin input voltage range is 0 to 1V if you’re using the bare chip.
However, most ESP8266 development boards come with an internal voltage divider, so the input range is 0 to 3.3V.
See: https://randomnerdtutorials.com/esp8266 ... h-nodemcu/

toki73
Normal user
Posts: 12
Joined: 16 Dec 2020, 10:05

Re: Stuck in "easy" project: PCF8591 and Moisture sensors

#12 Post by toki73 » 22 Jan 2021, 14:12

Thanks a lot!
I use the Analog-input internal - now the value changes if I put the sensor in the water
I understand not realy the difference btw. the analog Plugins

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

Re: Stuck in "easy" project: PCF8591 and Moisture sensors

#13 Post by TD-er » 22 Jan 2021, 14:33

The "Analog Internal" one is as its name suggests, the analog to digital converter inside the ESP.

The other "Analog" plugins are meant for other chips with an analog to digital converter which can be connected to the ESP.
Most of those allow for higher resolution and/or more inputs.

dmesseng
New user
Posts: 1
Joined: 28 Jun 2024, 17:01

Re: Stuck in "easy" project: PCF8591 and Moisture sensors

#14 Post by dmesseng » 28 Jun 2024, 17:31

I did this project using ESP32 (ESP32 Devkit, ESP32s, ESP32d) in Micropython and then again in Arduino (cpp).
In both cases, the behavior was the same for the Capacitive Moisture Sensor v2.0 connected with the PCF8591 ADC DAC converter.
The inputs to the PCF8591 are VCC-->3.3v, GRD-->GRD, SCL--> I2C SCL(GPIO22), SDA-->I2C SDA(GPIO21)
In each case the PCF8591 only recognized the Capacitive Moisture Sensor on AIN2. I observed that the Capacitive sensor did not operate on the other analog inputs.
Having the Capacitvie sensor on AIN2 had consistent readings accross ESP32 models and each of the ten capacitive sensors I have.
The High value when not inserted in anything (just air) was 203 +/-2 and the Low value inserted in a cup of water up to the high line was 90 +/-2.
I took a core of dirt from my lawn (since I am controlling the watering with an ESP32), placed it in a cup and began testing. The results were highly predictive and I consider the percentage to be sufficient to control the amount of time my sprinkler runs. The formula for the percentage is 100*((high-adc_value)/(high-low).
I send the values to my server service I host (using the WIFI station mode) and then use the value when asserting the sprinkler time as an adjusted percentage of each zone.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest