Automated Watering System powered by Node-RED
In this blog post i will describe which components I used to build my automated watering system. I will also show you some details on the software I used. But start with the result and let me show you some pictures of the working system:
The tank and pump:
The power supply and sensor gateway:
The sensors and water outlets:
The cable management and uext connectors:
The UI and manual control panel:
The Node-RED flows:
The basement of the Automated Watering System (AWS) had to meet some requirements. To water multiple plants they had to be connected by a flexible tube and a centralized water pump or need respectively a tank and water pump for each plant. Since the centralized system with shared infrastructure for water tank, water pump and electronic components is cheaper, I preferred this solution.
So I needed a solution to bundle the plants at one place and hide most of the flexible tubes and cables. Also the water tank and pump and electronic components should be hidden and not directly visible. The IKEA Kallax shelf was perfectly suitable for this. I bought a kallax shelf with 8 shelves each about 32cm in width and height and about 39cm in depth.
The kallax shelf is about 60€ in Germany. Since the shelf is placed horizontal I decided to screw a multiplex board on the bottom and lift the whole shelf with five wheels. The shelf is now perfectly moveable in the room. Three of the shelves are equipped with a cabinet door hiding:
- the water tank and pump,
- the power supply and electrical components,
- and one to store stuff.
To manage the flexible tube and cable for the moisture sensors some cable ducts are screwed at the middle board and holes(Ø 8cm) are drilled in the three cross boards.
Five of the shelves hold plants. To prevent the water from destroying the shelf it put some flexible planters inside the shelves. They are not very expensive (arround 3-4€) and fit perfectly. I also use one of these planers as tank (see pictures below).
The pump is basically a holiday watering system by gardena. The system contains a pump with three water exits, a power supply with an integrated timer, three drip distributors with different water supply quantities and the tubes. The integrated timer can not be changed, it powers the pump everyday for one minute.
I use the chirp soil moisture sensors to measure the moisture of the soil. The chirp sensor is a capacitive sensor, which does prevent the sensor from corrosion. I dipped the sensors into some plastic dip to give some extra protection. The sensor has an i2c interface and also measures the light intensity and the temperature. You can buy this great sensor on tindie for 13$.
To get the values from the sensors to my control system, I use a esp8266 board as gateway. The Olimex ESP8266 Evaluation-Board is a very mature version of the various boards available.
It features a 5v power input, a relay, a button (useful to program) and UEXT connector. The UEXT connector has a defined pin layout and is used to connect the sensors via a flat ribbon cable. The 10 pins provide power, serial, i2c and spi. I use this for all my projects.
The gateway is programmed with the arduino IDE and uses mqtt as protocol. It scans the i2c bus for sensors, collects the values and sends them to my mqtt broker. This way sensors can easily be added or removed.
Switch the pump
Since I want to switch the pump only when needed I don't want to water my plants every day. I still use the power supply of the gardena system to power the pump but I use an edimax smart plug SP-2101W to switch the power supply on and off. The timer does not really bother me, because it will prevent the system from overwater if the edimax switch crashes, it will automatically power off the pump after one minute. If I want to water more, I can easily switch the power supply off and on to water another minute.
The edimax smart plug provides an REST api with some flaw. The web server logs every request to a file in the ram. Depending on the frequence you request the state, it will run out of memory and will fail from time to time. Since there is now access over telnet, it should be able to fix this.
The control center Node-RED
To control the pump and aggregate the sensor values I use Node-RED a mind blowing tool to wire things together. Its easy to understand and you get results very fast. The Node-RED instance is not only controlling the pump, it also controls my philips hue bulbs, the thermostats of my heatings, phone and reports incidents via hangout. Lets focus on the watering in this post. I use three flows for the watering system:
- Log values into a timesentive database: influxDB
- Define the rules to switch the pump over the edimax
- Provide some stats and manual control over node-red-dashboard