Irrigation 8 – Solar Powered Sensor Unit

A solar powered, ESP8266 based sensor unit for my automatic irrigation system.

Finally all parts arrived and my irrigation sensor is now ready. I took my ESP8266 Breakout Board as basis. During soldering works I realized that there are some details missing in my breakout design (mainly missing designations). Therefore I have updated its design as well (Github). Using the XCSOURCE FT232RL 3.3V 5.5V FTDI USB zu TTL Serielles Adaptermodul Arduino Mini Anschluss TE203 and the soldering jumper there is no need for the “PROG” button. It is handled by the converter it self. I use the same sonsors I have used for the prototype (MTS1EU Greenhouse Sensor Kit Soil Hygrometer Module and DHT11 Temperature/Humidity Module for Arduino. Gewächshaus Pflazen .)

Circuit Diagram
Circuit Diagram
PCB Sensor
PCB

I use a small 5V / 81mA solar panel from Conrad. The panel drives very little current so I don’t need to care about charging logic. A simple Zener diode (BZX85C3V9) should be enough. I also changed the transistor to a PNP type as some of my readers recommended. Also the GPIOs I use have changed due to layout reasons. I have put the latest version of Fritzing and code on my Github.

So thats what the result looks like.

 

sensor5 sensor4 sensor3 sensor2 Sensor1

Irrigation Part 7 – ESP8266 Breakout Board

When I started layouting the PCB for my irrigation sensor I realized the advantages of a breakout board. They are handy for developing, sure. But they also bear the big advantage that you do not have to take care about repetitive tasks (such as pull-up resistors). Additionally they ease up layouting by adding two additional layers to your design. That simplifies the design and it also minimizes the footprint of the final PCB.

When I started layouting the PCB for my irrigation sensor I realized the advantages of a breakout board. They are handy for developing, sure. But they also bear the big advantage that you do not have to take care about repetitive tasks (such as pull-up resistors). Additionally they ease up layouting by adding two additional layers to your design. That simplifies the design and it also minimizes the footprint of the final PCB.

Size was the most important factor for me. It isn’t just a question of space, it is also a question of price (PCB cost ist based on cm²). Beside the pull up resistors for CH_PD, GPIO_0, GPIO_2 and RESET and the buttons to ground RESET and GPIO_0 (PROG) I have also foreseen a pin header for connecting my XCSOURCE FT232RL USB<->TTL. The voltage supply of the USB-TTL converter can be enabled or disabled with a jumper. Additionally I have foreseen solder jumpers CTS->REST and DTR->GPIO_0. I’ve not tried personally but some sources say that this connections make the manual buttons obsolete by handing over this task to the USB-TTL converter. Finally there is also a solder jumper to connect GPIO_16 and RESET (for wake up after deep sleep) and a capacitor as voltage stabilizer. Other boards like the Huzzah Board use a voltage converter for this but I have made good experience with the capacitor.

My followers on twitter know that it took several attempts before I got my final version ready (special thanks here to @ccxx72, @i_grr, @bdcatalin und @tzapulica for their help).  I also faced some troubles with  Fritzing but finally you can download my result at Github: https://github.com/Stromspielplatz/misc/tree/master/ESP8266%20ESP-12%20Breakout

ESP8266-ESP12 Breakout Board Circuit Diagram
ESP8266-ESP12 Breakout Board Circuit Diagram
ESP8266-ESP12 Breakout Board PCB
ESP8266-ESP12 Breakout Board PCB

Irrigation – Part 6: Fuzzy Control

The easiest way to control automatic irrigation would be using the soil moisture as threshold value and start a pump with that. But I don’t think that this is a suitable approach to control watering of plants. The measuring value coming from the soil probe is rather more a reference point than a value to be used for a controller. I also want to implement a real controller keeping my soil moisture rather constant because I think that will lead to a better yield. The standard controller everybody knows is the PI-Controller. It is an ideal solution for many situations but in my case the disadvantage is that it can only process one measuring value. For sure there are some ways to deal with additional values such as feedforward or cascading but I won’t do that. I will use a Fuzzy Controller instead.

The Fuzzy Controller is a multi-input-multi-output (MIMO) control algorithm working with indistinct (fuzzy) definitions. That sounds very creative but the history goes back to 1965. In the 1990s there was a real hype about Fuzzy Control but then this concept sank into oblivion. In my opinion this control concept is still quite underestimated and unknown today and that’s very unfortunate because it deals well with the most common problems in controller design: no exact model and inly empirical knowledge about the needed algorithm.

I want to use our existing webserver so I will implement the controller in PHP. I have found a very nice class from Wojtek Jarzecji. The idea is that later on an Arduino will call the PHP script. The script will return a change request for the water setpoint (-10%…+10%). The Arduino will add this to the actual pump setpoint (0….100%) and transfer it to a pwm signal.

For the parameters I do some measurements in wet (~400) and in dry soil (~800). Google tells me that in my hometown average humidity is between 50% and 90% and temperature in summer times is between 8°C and 36°C. I take this values to define my input membership functions as follows:

fuzzyparameter_en

That’s my script: