Soil Moisture Sensor using Analog Input - Solved

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
LisaM
Normal user
Posts: 513
Joined: 11 Apr 2017, 18:29

Re: Soil Moisture Sensor using Analog Input - Solved

#31 Post by LisaM » 23 Jun 2017, 18:51

Ton_vN wrote: 23 Jun 2017, 18:17 @LisaM
SH1x is not really I2C: hardware interface yes, but protocol no.
See https://cdn.sparkfun.com/datasheets/Sen ... eet_V5.pdf
See also https://www.letscontrolit.com/wiki/index.php/SHT1X, although not clear what wire to be connected to what GPIO.
In that perspective also curious which colourcoding the chinese manufactureres apply for the interface-wiring.
Somebody with experience and hints on that aspect?
https://www.letscontrolit.com/wiki/index.php/SHT1X
https://www.adafruit.com/product/1298
http://blogs.helsinki.fi/greenhouseproj ... wiring.png
If nothing works, i'll adapt the code... ;)

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Soil Moisture Sensor using Analog Input - Solved

#32 Post by Shardan » 23 Jun 2017, 19:53

You may also use newer generations of the SHT. SHT2X uses I2C.
The sensor itself is the same as with SHT1x, but with a I2C interface.
For a programmer It shouldn't be too difficult to adapt code of one of the existing Hum/Temp sensors.
I'd try the SI7021 - it uses a SHT21........

Shardan
Regards
Shardan

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

Re: Soil Moisture Sensor using Analog Input - Solved

#33 Post by Ton_vN » 18 Jul 2017, 16:02

Received an SHT11 in watertight enslosure, with 4 wires peeping out (without any documentation).
SHT11_sensor
SHT11_sensor
SHT11.png (218.87 KiB) Viewed 31537 times
From descriptions at AliExpress I deduct that following colourcoding might apply:
  • brown = VCC
    black = GND
    yellow = Data
    blue = CLK
Viewing the 'standard' I2C-interface at ESP(Easy) I deduct that following data-interface applies:
  • yellow to GPIO4/SDA
    blue to GPIO5/SCL
Wire-coding confirmed by the results as described in my message of 21 August, but not the assumption for the application of GPIO!
Last edited by Ton_vN on 21 Aug 2017, 19:49, edited 3 times in total.

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

Re: Soil Moisture Sensor using Analog Input - Solved

#34 Post by Ton_vN » 21 Aug 2017, 16:30

:oops: This message just demonstrates how much time you can spend by a wrong starting assumption and/or wrong information .......

Found time to connect the received SHT11.
To avoid conflicts with the OLED on 'real' I2C (and in fact no choice, because then GPIO4+GPIO5 not made available for selection), similar to I2C at GPIO04 and GPIO05, start with SCL/SCK= D6/GPIO12 at 1st GPIO and SDA = D7/GPIO13 at 2ndGPIO
Under tab 'Devices/Edit' selected SHT1X, set PullUp and set Enabled, and then the 'Devices'-display shows values.
So far OK, but apparently missmatch with the 'standard' driver-software for SHT1X, because I get the display below, while I expect something like (at this moment) approx. 24 degreesC and 55%RH. The displayed values remain fixed regardless of changes in the environment.
In hindsight, these values are displayed if no sensor is connected and ESPEasy has the settings mentioned above ..........

ESP8266+ESPEAsyMega+SHT11+GPIOSet
ESP8266+ESPEAsyMega+SHT11+GPIOSet
Knipsel_ESP8266F_170821.JPG (66.39 KiB) Viewed 31541 times
If the result is not as expected, you look in detail & experiment ......
Putting the device-data&clock on GPIO04+GPIO05 and performing I2C-scan does not yield results => device is not I2C [as to be expected]
Opening the sensor-head does not help to get info, because the sensor-pcb is nicely shielded&coated.
SHT11_opened
SHT11_opened
IMG_SHT11_Open.jpg (33.87 KiB) Viewed 31524 times
Looking at the interface-side, I left the SHT-device hardware connected to D6 and D7, but did not set the GPIOs in ESPEasy:
then you get the result below (again with 'frozen' values).
ESP8266+ESPEasyMega+SHT11+GPIOnotSet
ESP8266+ESPEasyMega+SHT11+GPIOnotSet
Knipsel_ESP8266F_170821A.JPG (61.31 KiB) Viewed 31530 times
Exchanging the wires on D6 and D7 has no results, hence certainly not the remedy .......

Then another idea popped-up ......
Switch SDA = yellow = D7/GPIO13 to 1st GPIO and SCL= blue = D6/GPIO12 to 2nd GPIO
:D That is the correct/working setting!
But the opposite of the information in the Wiki!
=> Careful conclusions
1) lack of colourcoding for the cable => a lot of effort to find out the operational configuration
2) WEMOS & SHT11 can accept/survive quite a lot of molesting .....

ESP8266+ESPEasyMega+SHT11+reversedGPIO
ESP8266+ESPEasyMega+SHT11+reversedGPIO
Knipsel_ESP8266F_170821B.JPG (63.65 KiB) Viewed 31513 times
Last edited by Ton_vN on 07 Mar 2020, 19:25, edited 3 times in total.

karmacoma
New user
Posts: 1
Joined: 28 Feb 2020, 23:36

Re: Soil Moisture Sensor using Analog Input - Solved

#35 Post by karmacoma » 28 Feb 2020, 23:43

Got a Good result ! and solve my probleme !

using Json to update Domoticz Humidity device must be :

http://ip:port/json.htm?type=command&param=udevice&idx=IDX&nvalue=HUMVALUE&svalue=HUM;HUM_STAT

http://ip:port/json.htm?type=command&param=udevice&idx=IDX&nvalue=HUMVALUE&svalue=0 is allowed too

my probleme was ESPEasy send :

http://ip:port/json.htm?type=command&param=udevice&idx=IDX&nvalue=0&svalue=HUMValue (the analogique value, saw this using Domoticz MQTT)

on R38 code i made this change on _C001

previous was :

case SENSOR_TYPE_SINGLE: // single value sensor, used for Dallas, BH1750, etc
url += F("&svalue="); //value from analogique was sending as the svalue
url += UserVar[event->BaseVarIndex];
break;

and now is :

case SENSOR_TYPE_SINGLE: // single value sensor, used for Dallas, BH1750, etc
url += F("&nvalue="); // now analogique value is send as the nvalue who has to been updated for a HUMDITY sensor
url += UserVar[event->BaseVarIndex];
break;

et voila :
Capture.JPG
ATTACHMENTS
Capture.JPG
Hi There,

I wonder where were you placing the script, and since I'm a newbie, I would like to have more details about this

Thaks a lot!
Oscar

Post Reply

Who is online

Users browsing this forum: No registered users and 71 guests