Plants don’t need access to the Internet to grow.
So what can a Raspberry Pi 3 with built-in WiFi and bluetooth do for hydroMazing? A connected hydroMazing can let us know what is going on inside our garden through a web-interface, email, or even, text-messaging.
Over the years, I’ve come across UNIX and then Linux environments through previous employers, so the Raspberry Pi’s default Raspbian OS is familiar to me. By default, there is a graphical windows interface so that the user isn’t left alone in the darkness of the command-line.
The hydroMazing system uses nRF modules for wireless communications, offering long transmission distances. The software running on the Arduino microcontroller manages “sensor” objects and “appliance” objects by transmitting and receiving to the controller which makes decisions using a preconfigured decision tree to turn on and off wireless AC outlets.
A little Internet research leads me to adding communication with the nRF24L01 wireless radio transceivers that I’ve used for the hydroMazing Controller and the hydroMazing Monitor. Using some open-source libraries for nRF devices I was happy to find I could reuse some of my Arduino C code to compile on the Raspberry Pi. The biggest challenge I had was finding datatypes that both the Arduino and the Raspberry Pi would agree upon. After much trial and error, I was able to get my C program to listen for incoming transmissions and then write that data out to a few files. First, a log file that captures all communications between the Pi and the hydroMazing Monitor. Next, I have the program write out the current state of all sensor objects and a file for all of the appliance objects. When an alert occurs the program will create a file containing that alert.
I then added a PHP script to read in the data object’s from their respective files and display live on the Pi’s Apache server.
Next, I wrote a Python script to read the directory for the alerts file and if it exists, read the file, parse out the pertinent information and then email or through SMS text the user. In addition to sending an email or text alert, the python script moves the alert file into position for the PHP script to read and display.
Using the log files that are created, I am able to import the data into a database. Once the hydroMazing’s data is recorded into a database residing on the Raspberry Pi we can start performing analytics and generate some reports.
The hydroMazing controller is designed to operate ventilation fans for air circulation, water pumps, occasionally a humidifier, heaters, or any other appliance that is necessary to maintain an ideal environment for plants to grow. Monitoring and controlling the system is mostly done for us, but when the hydroMazing needs to alert us to a problem it can now by using the Raspberry Pi.
Checkout my article on Instructables: Private Web Serving With the Raspberry Pi