theyosh / TerrariumPI

Home automated terrarium/aquarium or other enclosed environment with a Raspberry Pi
https://terrarium.theyosh.nl
GNU General Public License v3.0
414 stars 100 forks source link

Soil humidity sensor #133

Closed JohnnyB1989 closed 6 years ago

JohnnyB1989 commented 6 years ago

Hi,

thanks for your great great work. Love it!

I was wondering if you could implement a setting for a sensor that checks the humidity of the soil.

Like the YL-69 (https://www.amazon.de/YL-69-Feuchtigkeitssensor-Hygrometer-Bodenfeuchte-oder/dp/B00QHENH3K)

Thanks and keep on,

Johnny

theyosh commented 6 years ago

Hi,

this is possible, but it depends how you want to use it.

This is a sensor that when digital connected it will only switch from wet to dry and back. So no information about how wet.

In analog modus, and therefore you need more hardware like http://rasp.io/analogzero/. Then you can read out a value between 0 and 100%. But this is not directly the moisture value. So then measure the resistance, and at a certain value, you have to conclude it is to dry.

Third, the device itself has also a resistor which can be tweaked so that it will light up when to dry. But this will also affect the data in the software. This will change the resistor value.

So, could you explain how you want to use it? Because of my experience with those sensors, is that reading them out analog, does not really give value information. You are only able to see when in the future it will get to dry based on historical values. But you will never get the real actual value.

And keep in mind, they are cheap, and will wear out in 6 - 12 months is my experience

Aapjes94 commented 6 years ago

This is exactly what I use the SHT2x sensor for, which is already supported, see #84.

JohnnyB1989 commented 6 years ago

Hi,

it would be okay, if the sensor tells when the soil is dry at a specific point, which I could adjust by how deep the sensor is in the soil. If the sensor gives a signal a switch is turned on for x seconds, so that the pump and the amount of water can be adjusted by the time.

Aapjes94 commented 6 years ago

That should be okey. You’ll have to check a bit to see what RH values will be considered dry and wet. Within this software the SHT2X is under the humidity setting. That means you can use the environment tab to control the soil moisture via a relay and pump.

Aapjes94 commented 6 years ago

Okey, I hope you haven't ordered them yet. The ones I ordered at least weren't any good. One corroded and the other one shorted within a day.

BashSer commented 6 years ago

They all rust and only way to use them is turn on only for measurment or reduce acidity. Because if they all time turn on - electricity passes through "acid" soil and rust is formed.

P.S. I heard that sensor made of two nails :D

Aapjes94 commented 6 years ago

I was using something like this which I was expecting to actually be able to leave in the soil.

theyosh commented 6 years ago

I will add this sensor for moisture. But it will take some more time unfortunately. I do have those sensors at home, so I can do some testing

theyosh commented 6 years ago

Hmmm.... sensor is not working well... does not change in state after almost a week... :( And the plant is getting dryer for sure

JohnnyB1989 commented 6 years ago

Thank you so much, I will give it a try!

theyosh commented 6 years ago

Ok, figured out that calibrating this sensor is a bit trail and error. So I got it working now a bit better. But still not sure how stable it will be. Extra info about saving your sensor can be read here: https://github.com/theyosh/TerrariumPI/wiki/Hardware#moisture-ytxx-in-dgital-modus

theyosh commented 6 years ago

Found alternative sensors: https://wemakethings.net/chirp/ I got one running now, and looks promising. As they say that a stand alone version can run up to 1 year on a single battery. That would imply also slow or no degradation of the device

Aapjes94 commented 6 years ago

I know it's only been two weeks, but how is the Chirp holding up? I've been postponing ordering another SHTxx sensor and the chirp sounds promising.

theyosh commented 6 years ago

Not that good... It looks like I do not get it stable somehow. Not sure what it is. Could be to long cables. Bad soldering from my part. So I just started testing with a second one. Bought 4 of them :)

Code is working, but I do not get is stable right now somehow

Natrixz commented 6 years ago

Maybe moisture on/over the soldering? Try coating it :) Conformal coating seems to work wonders on my humidity sensors Edit: DONT coat the holes for humidity sensing

Aapjes94 commented 6 years ago

Natrixz, What sensors are you using?

Natrixz commented 6 years ago

I use these: https://taaralabs.eu/1-wire-humidity-temperature-sensor/ With the HIH-5031 and conformal coating. (Basically coat everything except the small hole) and shrink wrap it. Aditionally you could put hot glue inside the shrink wrap but i thought that was over-doing it lol

theyosh commented 6 years ago

These can also be coated, but then I mis the light sensor: https://www.tindie.com/products/miceuz/i2c-soil-moisture-sensor/

Now I have some duck tape around the soldering.... ;)

Natrixz commented 6 years ago

Why? You could just not coat the light sensor (conformal is clear coating btw) or just order the rugged version?:P or just coat the contacts? Lol

dasolan commented 6 years ago

Maybe MiFlora is an alternative? Its a Bluetooth sensor for 11 Euro at Ali, it detects moisture, lux, temperature and ec (conductivity). Librarys still existing on git.

theyosh commented 6 years ago

@dasolan I am afraid it will not supported. The MiFlora library is Python 3.X only. And my software is python 2.7 only still. So that is not compatible....

Also, it requires an extra bluetooth dongle, because the Pi does not have Bluetooth LTE onboard. (Maybe Pi3 does). So this is currently a bit to much right now to support

Hmm found this: https://github.com/marcelrv/miflora/blob/master/miflora.py That is python 2.x

theyosh commented 6 years ago

@dasolan Created a new issue #156 . So then I can close this issue

theyosh commented 6 years ago

I am closing this issue because the original hardware is supported and working

oldmanbluntz commented 1 year ago

Sorry to comment on a closed issue, but i didn't want to open a new issue for a quick question. Using the YL-69 through an MCP3008, how do you go about reading multiple YL-69 sensors as separate sensors through the ADC, or do you need one MCP3008 per sensor?