Greenhouse irrigation

I was worried about mine because I was having so much trouble getting it to connect to my MQTT broker. It has the diagonal cut corner and purchased from Aliexpress for $2.49 free shipping. I did get it working, though, the connection between my DHT22 shield and the board is a little iffy. I've had to reseat it twice in two days.

BTW: Paul- do you have a shield for your moisture sensors or solder directly to the board?

I've attached the Wemos to a strip of veroboard via the headers, and soldered the moisture connections onto the veroboard.

Paul

How do you protect it all from the weather? We don't get much rain during the Spring-Fall but it would seem prudent...

I use a moulded PVC joint box, similar to this - IP65 Moulded PVC Box 110 x 110 x 67mm | Toolstation which gives IP65 protection.
I feed the cables into the box by using compression glands.

Paul

I've just made a few changes to the ESP sketch, and changed the MQTT library from the original pubsubclient library, to a fork of the the same library by Ian Tester (Imroy).

Imroy/pubsubclient library has been further developed to add a set of MQTT classes which allow a number of additional features to be available.

In particular, the full range of QoS, allowing me to now use QoS1 or even QoS2, to send and receive messages. I've settled with QoS1 which is probably adequate for this project, and looking at the mosquitto logs, appears to work well.

Integrating Imroy/pubsubclient into an existing project requires a few code changes, but nothing major.

Paul

1 Like

Hi Paul,
Way back in June of 2018 we "chatted" about Wemos D1 Mini devices.
I've now had three of the devices fail because the USB power connector (socket) has snapped off the board.

Last month I spotted this Breadboard Power Adapter on AliExpress for 30p.
They are also listed on Amazon UK - but at twice the price.

A set of them arrived today.
They fit really well onto a breadboard and have enabled me to get each of my defunked D1 Minis back to life again.

So if any of your Wemos clones pack-up with a faulty USB connector I suggest you purchase some of these.

Cheers from David.

3 Likes

Thanks Dave, they look really useful.
I haven't had any of the connectors break myself - although I generally solder the Wemos onto veroboard and make the power connection a permanent feature, so I'm not constantly plugging/unplugging the power cord.

The cost of these chinese tech imports is ridiculous!!

1 Like

I think the breadboards with the Wemos devices mounted on them have a rough time with my students at the IoT Club, as each week a USB power cable gets plugged-in and taken out (at the end of the session).
So I suppose it's no wonder that some of the Wemos devices have given up the struggle !!!

I'm amazed how many electronic components are on the Power Adapter board for just 30p.

wemos

Isn’t that my old wemos that you broke during club????

hi nice job i have question how did you choose this parameter Kp ,Ki & Kd !!! thank you

A lot of help from the forum, especially @Colin (plus loads of trial & error)

1 Like

My first advice is to use node-red-contrib-pid. I have written a blog on tuning using that node at
http://blog.clanlaw.org.uk/2018/01/09/PID-tuning-with-node-red-contrib-pid.html

3 Likes

thank you so much

Hi Paul, I was and still impressed by your project so I decided to realise it as my first iot project, I'm using ESP8266 NodeMCU instead of Wemos and MQTT PubSubClient library. So far I managed to collect data from the sensors and control a relay through MQTT, I bought a similar pump to yours. When it comes to PID control I read about it understood the principals and tried @Colin 's PID loop tuning, but when it comes to trying it on the real process I got lost, how could you tell how much water to pump based on the PID results ? or did you use a timer to the pump ? and -it might be dumb to ask but- Is it possible to control relays with signals other than 1 or 0 ? if not, how to solve the confusion !

Hi Paul, how are your capacitive sensors performing over time are they reliable? I have an irrigation system which has worked well for 3 years but I would like to add a moisture measurement feature on a sample plant as you have. I am in the UK too. I have the main control code run on the Wemos locally and used MQTT to update values and collect data. That way if the WiFi goes down I only lose data not control of the watering.

The way mine works is maybe a little different...

  • The ESP sends the humidity value of the sensor to node-RED via MQTT every minute.
  • node-RED takes the average of 10 consecutive readings, then passes the value to the PID (every 10 minutes).
  • The PID then determines how long the ESP should energise the water pump (for example 15 seconds) and sends the number, again by MQTT, back to the ESP. (15)
  • If the number is >0 then the ESP switches on the water pump and water is delivered.
  • After the number of seconds (in this example 15) the ESP switches the pump off.

I've done it this way, because if there is a communication breakdown between node-RED and the ESP, my plants will not get flooded, as the ESP will know when to switch the pump off, and is not reliant upon receiving a 'OFF' message.

Paul

1 Like

For me the ESP sends the humidity value of the sensor to node-RED via MQTT every 30s, should I use node-red-contrib-timeprop to determine how much time to water the plant ? and why didn't you just make it read the humidity every 10 minutes instead, I mean consider just the last reading in your case

I disconnected them over winter as the greenhouse was empty, but am planning to set it back up again this coming weekend.
The sensor worked fine last year, and despite being much more consistent than the resistive sensors, you still need to run the readings through a RC filter, to smooth out any dodgy readings.

Paul

1 Like

I use node-red-contrib-pid

Because although the capacitive sensors are much better than the resistive sensors, the readings do vary slightly, and you may get spikes. Using a RC Filter in node-RED will lessen the effect of the 'spikes', and provide a more stable reading. That's why I use 10 readings instead of 1.

1 Like

My question hasn't been clear I guess, I used node-red-contrib-pid too as in "PID loop tuning using node-red-contrib-pid in node red" in Colin's Blog, but the output of the PID node is in a range from 0.0 to 1.0.
My question is: if I get a result of let's say 0.35 for example, how can I determine the time of watering based on that ?