Select a time for sensor data from database:
Current Date: 2022-01-22 12:15:24
During the COVID19 lockdown, I decided to work on an IoT project to develop a real-time automatic watering irrigation system for Plants (AWISP) based on a RaspberryPi 3B+ to store, retrieve and display
sensor data via a website. The main goal of the project was to intelligently control the water flow to various vegetables/plants in the greenhouse based on a combination of sensor parameters (temperature, humidity and moisture).
Once they have reached some certain set thresolds, the raspberryPi would then automatically control a 12V solenoid valve to open/close the water flow. I started this project in late May 2020 by first getting hold of a RaspberryPi and
then tried to figure out what bits and pieces were needed for the project, such as types of sensor, software and hardware etc. Although I have some general knowlegde of electronics and computing, it was still
quite a steep learning curve given that I had no prior or limited experience with RaspberryPi, Python, Apache web server, PHP, MySQL and HTML/CSS programming.
By August 2020, after a great deal of online research, and many trials and errors, I was able to come out with a first version AWISP prototype using the DHT22 sensor to monitor temperature and humidity
and a resistive moisture sensor for measuring soil moisture. The below figure and table (click on the Data link above) show the graphical plots and storage of the sensor data, which can be selected via a timestamp from a MySQL database. The figure showing the
three sensor data were plotted using Highcharts plotting libraries coded inside the PHP program. From the above photos, you can also see the set-up of the RaspberryPi connected to the two sensors, along with some LEDs used to indicate the status when a certain threshold has been reached. The relay to control the 12V
solenoid valve can also be seen clearly from these photos. The top right photo shows the set-up for the solenoid valve connecting to the water pipe hose. I have been working on this project inside my shed which is next to the greenhouse so the sensor data are currently
coming from there. Later on I will place the senors inside the greenhouse to acquire the data for analysis. The data will then help to estimate the sensor thresholds needed for the intelligent control of the water flow to the plants.
I have also managed to setup the Raspberry Pi Webiopi GUI which is needed to control the relay for the 12V solenoid valve for water flow remotely. This GUI is now working for both local network in my house/shed as well
as externally using my mobile devices when outside via the Remote.it application. This application offers a secuire communication link and services between the raspberry pi and the mobile devices. It allows the
webiopi GUI to directly control external devices such as LEDs and alarms to be switched ON/OFF via the relevant GPIOs on the raspberry pi.
There were many online resources and tutorials which I found extremely useful and helpful. They have contributed to various development stages of my project, including setting up the raspberry pi, programming tips on python,
PHP, MySQL and Highcharts, as well as HTML/CSS for website development. This project is still an on-going development, I have listed some of these resources and components which can be used as references/guidance for anyone who is interested in
developing similar projects based on the raspberry pi. You can find them in the Resources link given above.
New update (12 November 2020): Recently I replaced the resistive moisture sensor with a capacitive moisture sensor using a MCP3008 10 bit ADC chip. This has provided a much better data accuracy as compared to the
previous measurements from the resistive moisture sensor using a 8-bit ADC (PCF8591). In order for the new sensor to operate, some changes to the python code and updates to the raspberry pi libraries were needed. These changes
in using the MCP3008 also impacted the LCD1602 (16 x2) display, which required some code updates in the python code as well.
© Copyright 2021 ARC