Many times I forgot to water my plants and this causes the plants to quickly get dry, especially summer at balconies.
The plants will look like this:
To address this problem I built a simple irrigation system with the CY8CKIT-048 PSoC®, the Analog Coprocessor Pioneer Kit.
The DIY moisture sensor is used to detect when the soil start to get dry. The temperature, humidity and ambient light sensors are used to monitor the plant's environment.
Based on the accrued the data, water is be pumped with a small water pump to the plant when needed:
The Moisture Sensor
To measure the moisture in the soil, I made a simple "sensor" consisting in two galvanized screws with a wire soldered to the head of each. The screws are inserted into the soil some distance away from each other. The resistance between the two will vary based on the moisture of the soil: the resistance in dry soil will be much higher then in wet soil.
The resistance is measured by applying a reference voltage between the two screws, through a 1 K reference resistor, and measuring the voltage drop on them. The voltage drop on the reference resistor is also measured. As the value of the reference resistor is known, the of the soil resistance can be calculated.
Temperature, Humidity, Ambient Light
To measure the temperature, humidity and ambient lighting of the plant's environment the on board sensors are used.
The temperature sensor is based on resistance measurement. The humidity sensor measures capacitance, while the ambient light sensor is uses current measurement.
Collecting the Sensor Data
The data was collected time to 1 month. It was logged into a file.
Here are graphs obtained after 1 month 24/7 monitoring data:
The soil resistance varies between 3 and 8 Kohm. Ideally should be bellow 4.5 Kohm, it went higher when I forgot to water the plant.
To automatically feed water to the plant I used a small water pump,
a water tank made from a plastic bottle
and a cheap plastic tube.
The water pump is driven by a transistor connected to the CY8CKIT-048 PSoC®. A PWM module is used to control the speed of the pump.
The irrigation algorithm is a simple state machine with 3 states:
- SENSE - checks the soil resistance and when get's higher than a certain threshold (4Kohm) enters into the PUMP state
- PUMP - pumps water for a given amount of time (30 sec), and than enters the WAIT sate
- WAIT - waits an amount of time (1 hour) before entering the SENSE state again. This is needed to allow the soil resistance to stabilize.
- Data Visualization with Grafana - this is already in progress. The data is imported into a Influx DB, but I'm having some trouble getting it shown in Grafana
- Dashboard - a dashboard in Grafana that will make the irrigation algorithm parameters, the soil resistance threshold, the pump duration and the wait duration configurable. The parameters can be already adjusted using the I2C interface.