Author Topic: [Working] Z-wave soil moisture sensor based on Fibaro RGBW module  (Read 188 times)

Offline kwieto

  • Full Member
  • ***
  • Posts: 128
  • Karma: +3/-5
[Working] Z-wave soil moisture sensor based on Fibaro RGBW module
« on: September 05, 2017, 05:20:34 pm »
I finally have some time to play with the idea of combining Fibaro RGBW-441 module with an Arduino soil moisture sensor to make it work together and I can say that initial results are very promising - it works!

If anyone interested in how-to, below is the receipt:

All you need is a Fibaro RGBW-441 module and 1 up to 4 Arduino compatible soil moisture sensors - I used the one like on this photo: http://img.dxcdn.com/productimages/sku_290154_5.jpg

According to the specification the inputs of RGBW-441 module can be configured and attached to various sensors, giving analog signal within 0-10V range. To do that, you need to define which of  inputs (you can configure all, if you want) should act as "Analog" 0-10V input. It is a bit unclear in the manual, so here s the detailed schema: you need to set parameter 14 (2byte dec) with a number reflecting setting for all 4 channels of the module. the number is calculated by converting binary values for each channel to the dec value - you can use online converter.
By default, each channel is set to RGBW - momentary switch, normal mode. The binary sequence for that setting is 0001, so four channels give 0001000100010001 which, converted to decimal system is 4369.
If you want to change i.e. channel 1 to analog input (1000) you have to modify sequence like here 1000000100010001 = 33041. For all four inputs it will be 1000100010001000 = 34952
Remember, that setting specific channel to receive analog input you lose possibility to turn on/off responding output. If you want to have possibility to steer some device (i.e water valve) directly by RGBW-441 module, you can't use sensor with that channel, at least not directly.
I configured CH 1 and 2 as analog inputs and CH 3 and 4 as "OUT - Toggle with memory (normal mode)". That gives bin 1000100011101110 = 35054 dec

One thing to remember - if input set to receive 0-10V signal it gives 100% when the circuit is open and 0% if it is closed. Don't be surprised that after you set specific channel like that, you'll see 100% (ON) reading when you didn't attached yet any device to it.

Next thing: Arduino sensor. I've decided to try Arduino one because it is cheap (like 2 USD) and available without much effort (OK, you wait for the shipment from China if you want to get best price). The only problem with such sensor is that, according to the specification, it works with power only up to 5V DC.
I tried to find moisture detector with output up to 10V, but all I have found were professional, expensive ones (starting from c.a. 200 USD)
After some tries with powering sensor with 5V and attaching its analog output to RGBW-441 (didn't work) or considering some step-up/step-down converter to make the sensor working, I finally figured that it may probably work with voltage up to 30V and the information about 5V refers to Arduino compatibility only. I power this setup with 12V, so I decided to give it a try.

And it works!

Attaching the sensor is really simple, you attach + and ground to the same DC power source as RGBW-441 and then analog output (A0) to desired IN channel of RGBW-441 module, and it is done.
Remember, that as I wrote before, Fibaro reports 100% if circuit is open (soil dry) and 0% if it is closed (soil completely wet), so the readings are reversed.
But they seem to be accurate enough to figure out at which level you should set your sprinkles/waterline ON.
If someone have any idea how to reverse these readings, please give a hint.

Another topic is that RGBW-441 is presenting itself as a dimmer, so it goes under "lights on/off" shortcut. I've tried to change its category and subcategory to move it out from there, but I didn't find working combination (some obvious ones, like refrigerator switch, are not accepted by it). Any help here is appreciated as well.
« Last Edit: September 05, 2017, 05:24:19 pm by kwieto »

Offline kwieto

  • Full Member
  • ***
  • Posts: 128
  • Karma: +3/-5
Re: [Working] Z-wave soil moisture sensor based on Fibaro RGBW module
« Reply #1 on: September 07, 2017, 06:00:55 am »
OK, so I went into first sign of bump: it seems that arduino probe is very sensitive to corrosion. Since current goes through probe constantly, one pole act as anode and the other one as cathode.
As a result, one of them is corroding, like on the picture here: http://www.homautomation.org/wp-content/uploads/2014/06/photo1.jpg

This process is known and according to the internet sources the probe can be damaged within a month or even less. Not a very good idea, to replace sensor every couple of weeks :(

There are several approaches to that:

First is to make probe by yourself, using more thick and less corrosive material, i.e. stainless steel. For that solution you need a set where controller is on separate PCB and the probe on the other (typically YL-69 module). You replace the old probe by the one you made and it should work again. Remember, that this only delays the time where you probe should be replaced, the corrosion process is still destroying the probe slowly. There are solutions with graphite poles, which should be corrosion-free, the question is mechanical durability.
There are several DIY manuals how to do the probe, from sticking two metal poles directly to the ground, to more sophisticated solutions like encapsulating them in gypsum, but the general built is always the same.

Second, you can buy a set with "anti corrosion probe" on Aliexpress, like this: https://www.aliexpress.com/item/Soil-moisture-sensor-and-soil-module-soil-moisture-test-soil-humidity-test-corrosion-resistance-probe/32812568676.html
It is more expensive than the basic set, but if the probe will work for a couple of months instead of weeks, it is worth it. Still, I don't expect it to be corrosion proof, rather slower process of disintegration. You can buy the probe alone, if you already have arduino module

Third, you can try the capacitive probe made by DFRobot: https://www.dfrobot.com/product-1385.html
According to the producer, it is 100% corrosion proof as the metering method is slightly different than with other sensors. In this case, you need to make some step-down circuit as it probably won't work with 12V and for sure not with 24V (the main component works up to 15V). You also can expect that readings will not go to the full scale in Vera (it gives 0-3V on the output, so most probably it will show readings between 66% and 100% in Vera. If you can live with it, you can still use it to detect when you should water your plants.
It is also more expensive than the basic version, yet still affordable.

Fourth approach is to attach probe to AC current. As it switches polarity constantly, you will not experience corrosion on the probe. The question is how to make it work with the main module.

I will try approaches 1-2 and probably 3,

I've found also probe which will probably work with FRGB-441 directly (link: http://www.vegetronix.com/Products/VG400/ ) but it is still a bit pricey (c.a. 40 USD) compared to the rest of the components.
« Last Edit: September 07, 2017, 06:05:33 am by kwieto »

Offline rafale77

  • Hero Member
  • *****
  • Posts: 690
  • Karma: +35/-20
Re: [Working] Z-wave soil moisture sensor based on Fibaro RGBW module
« Reply #2 on: September 07, 2017, 02:04:31 pm »
Have to applaud you for the hard work. There has been quite a few commercially available projects out there which have been working reasonably well, albeit not without some quirks. A friend of mine and myself have gone different ways and have found that sealing the electronic from humidity is probably the biggest challenge. I am using a zigbee solution with the plantlink. My friend went with http://spruceirrigation.com
Another one is http://www.sensoterra.com
After losing 2 of my plantlink to internal corrosion (out of 9) I started using silicone paste and silicate pouches to dehydrate and seal my sensors. After this, I immersed one of the sensors under 5" of water for an entire winter (accidentally)and... that sensor still works. I have not had any probe corrosion issues though.

The plantlink presents the advantage of having a plugin for the Vera which I improved recently...
127 zwave nodes, 8 zigbee nodes, 256 devices, 17 apps, 128 scenes on a Vera Plus linked with Echo and HomeKit through bridges

Offline kwieto

  • Full Member
  • ***
  • Posts: 128
  • Karma: +3/-5
Re: [Working] Z-wave soil moisture sensor based on Fibaro RGBW module
« Reply #3 on: September 08, 2017, 04:39:06 am »
I considered buying Plantlink for my setup. The main problem is that it is not available on sale anymore. There are single items on Amazon, which wouldn't be much of a problem if they would ship to Europe.
You can buy some of them on ebay with shipment to Europe, the shipment costs are not encouraging (like: 20-30USD).
And there are only base sets (main station + 1 sensor) available, I didn't find any additional sensors on sale.

I focused on custom solution for couple of reasons:
1. I need more "home" than "garden" appliance (watering plants on a balcony or pot plants inside the house)
2. I prefer z-wave solution over plugin solution, as my experience with devices operated via plugins (WeMo, Netatmo) shows me that it can be a bit tricky to make it work and needs more maintenance in the system than z-wave solution.
3. I don't need advanced statistical data (given i.e. by Spruce), nor weather predictions etc. My main target was to water plants when I'm outside the house, so simple logic "soil is dry - turn on the watering" is enough. Any weather prediction (like: "don't water plants on the balcony if it will rain today") can be added through existing plugins directly in Vera, so I don't have a need to buy sophisticated controller like Spruce.
4. For me it is more a "fun-project" than a need (I don't have a problem with excessive water bills or difficulty to keep large lawn watered properly) I focused on some low budget solution.

Speaking about prices, the setup I made is hard to beat by other solutions:
If you want to build a set similar to mine (2 sensors, 2 relays) you need to pay:

Plantlink - main unit with 1 sensor is priced about 60-70USD + additional sensor priced around 30USD = 100 USD for the set of two sensors. Plus z-wave relay (let say 1 x 2 relay swtich) which would be priced 50-60USD, you ned to pay c.a. 150USD for the whole setup.

Spruce is very interesting but also very pricey. For main unit and 2 sensors you need to pay 350USD, adding z-wave relay makes it 400 USD. Of course access to history and prediction plans are nice, but I'm not convinced if it is necessary for me. And for the in-house plants predicting the weather is useless anyway, since they are inside.

I don't know how Sensoterra is priced (they don't show pricing on their website), but seems to be a professional, farming system.

From the other hand Fibaro is very popular in my country and thus is also relatively cheap. FRGBW-441 is priced around 50-60USD, but if you have a bit of patience you can buy for outlet price (with full warranty) under 40 USD. 2 sensor with probes like those "anti-corrosion" from Aliexpress will cost c.a. 10-15 USD. Cost of the cable is negligible. And you don't need to buy any additional relay, since you have still 2 channels reserved for 12V output. So the whole cost is around 50-60 USD. Compared to Plantlink (the cheapest alternative). it is still almost 3 times less.
Another advantage over Plantlink or Spruce is that the probe doesn't contain any electronics, there are just two poles and a cable. You can put the main unit of the sensor together with the RGBW controller in a sealed box and attach probe on a long cable (I've tested up to 4m already). The drawback is that it is still on the cable, so if you have larger area to cover it would be difficult/less convenient than wireless solution.

So taking pros and cons together it would be like that:

Pros:
+ low budget solution
+ full z-wave integration without any plugins and bridging via WiFi/internet
+ works even if the internet connection is down.
+ You can design custom probe by yourself, i.e. if you need to reach deeper parts of the soil, to check the soil moisture near the roots of specific plants.
+ you can hide all electronics inside the house and let only the cheap probe to be outside, which can be the point in remote locations (I plan to install one sensor in my herbs garden located at my country house, which I visit more or less every other week and in between it is completely empty, so I don't want to loose expensive device just because somebody will "like" it).

Cons:
- readings are in % so you need to learn by yourself which percentage is the point when you should water your plants
- since probes are attached by cable to the main unit, it is recommended rather for small areas (balcony, pot plants, small herb/vegetable garden, etc.)
- no advanced statistics or predictions schemes available - you have to build some scheme by yourself if you need.
- the cheap probes are very poor, mine half-corroded within couple of days (probably because of soil type and using 12V instead of 5V). Durability of more expensive probes (5USD per item) are still to be tested. You can use cheap graphite sticks (i.e. made for pencils), but in this case attaching wires may require a bit of additional effort/manual skills. Possibility of using 7USD capacitive sensor is to be tested as well.

« Last Edit: September 08, 2017, 04:58:34 am by kwieto »