What is hydroMazing Smart Garden?

Control

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.  Typically, we DIY’ers would hook-up some relays to a microcontroller to achieve control.  However, with hydroMazing, the system uses remote controlled wireless AC outlets, ensuring safer control than traditional relays.  hydroMazing uses low-cost open-hardware modules and the ubiquitous microcontroller, the Atmega328, on an Arduino Nano*, offering the flexibility of customization and expansion. The sensor choices are endless, but I’ve narrowed it down to a few important and relatively inexpensive modules.  A temperature and relative-humidity sensor, moisture sensors for soil, liquid temperature probe for hydroponics, a simple photocell.  There are many other optional additions including the float switch or switches and flow-rate sensors.

The wirelessly controlled outlets proved to be a etekcity_outletsreliable method of controlling the fans using the Arduino to send the signals depending on the temperature sensor’s readings.  It didn’t take long for the source-code to evolve into a beast.  The Arduino family of microcontrollers is limited in how many instructions it can run and hitting the program size limit doesn’t take very long when you want to control more than a few blinking LEDs.  I have found that the size limitation has forced me to write better, more efficient code than I initially do.  Even with creative variable handling and custom libraries, eventually, there is a need for another microcontroller or to move to a larger one.

Wireless Monitoring w/o Internet

There are several ways that the microcontrollers can communicate with each other.  The least expensive wireless method I could find is the nRF24L01 wireless radio transceiver. The module is a low-power, lightweight variety of bluetooth giving hydroMazing the ability to communicate with a monitoring unit.fpzexmwi7vqs7mr-medium

I decided to add another Arduino Uno with an Liquid Crystal Display shield so that I could display what the sensors were reading, the state of appliances, and alerts with notifications.

frv8uq9i800wgat-medium

mmexport1472732631987

I made my own open and adaptable platform that can be custom tailored to a wide variety of gardening needs and conditions; yet, also a self-contained wireless system.  The open-architecture of the system allows for ease of integrating Internet connectivity and web services.

Internet Monitoring

Enter the Raspberry Pi connected with an nRF24L01 module.

I was able to modify much of  my Arduino Source code 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 progrhydromazing-liveam 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.

hydromazing-alert

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.

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.

 

img_20161001_145206012

With the hydroMazing smart gardening system, you can grow healthy, happy plants anywhere!

Contact us today for more information!

hydroMazing Connected

This slideshow requires JavaScript.

Plants don’t need access to the Internet to grow.pi2modb1gb_-comp

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.

 

58688968_1920_1080

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.

 

img_20161001_145206012

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 progrhydromazing-liveam 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.

 

hydromazing-alert

 

 

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

The Making of hydroMazing

 

It was two years ago when I decided to try using an Arduino Uno microcontroller to replace my individual Lux WIN100 Heating & Cooling Programmable Outlet Thermostat.  These outlets control an appliance, such as a small heater or, in this case, a ventilation fan.  A device that is plugged into the outlet turns on and off the appliance by using temperature settings that you manually program into each device.  This technique for controlling the ventilation fans is effective, yet uses several extension cords.  The temperature outlet controllers use old-fashioned relays to switch the state of the device.  My initial attempt was to hack an extension box inserting my own relays into it and connecting them to the Arduino Uno.  It wasn’t very long before there was a mess of wires with lots of connector nuts and I was left feeling discouraged.

A home automation idea that I had bouncing around in my head for a 20150412_104406while was to use wirelessly controlled AC outlets that use a hand-held remote-control.  Hacking the remote control to send the signal for the ON or OFF button selected by a corresponding pin on the Arduino Uno shouldn’t be too difficult, right?  The nagging concern that was preventing me from testing this idea was the fear that the signal would not be reliable and the Uno might “think” it had turned on a device when it actually failed.  Eventually, I was able to convince myself that the best way to find out is to just try and see what happens.  Unfortunately, the results of this test wasn’t much better than the relay attempt.

A search on the web for nearly any sensor or electronic doo-dad with “Arduino” will result in a number of products being sold for a few bucks.  In this case, I found the 315Mhz and 433Mhz transmitter and receiver pairs that are within the frequency range of most commercial wirelessly controlled outlets.  The greatest advantage to using the Arduino family of microcontrollers for these types of projects, is that you can find open-source software to get started.  Another search on the web for an “Arduino library” and in this case, transmitter and receiver or tx/rx pair.  Now, it was getting exciting for me.  I could read the codes coming out of the remote-control, record them, and then program the Arduino to control the corresponding outlets.  Designing the software to operate on the Arduino Uno became the challenge.  The examples that come with the Arduino software and the examples included with libraries are an excellent start to a project.  In my experience, once you start combining and making modifications to the examples it doesn’t take very long before you hit a wall.  I don’t think I’m a good programmer, I think I’m a stubborn perfectionist.

In one of my favorite books, Zen and the Art of Motorcycle Maintenance the author, Robert Pirsig, speaks of the gumption trap.  Essentially, the gumption trap is an event or mindset that can cause a person to lose enthusiasm and become discouraged from starting or continuing a project.  Knowing when to push through the discomfort and frustration and when to take a break and walk-away from the project are personal challenges.  There have been times when if I had taken a break, I might not have come-up with an excellent solution to a conflict in my source code.  Contrary, there have been times when I have walked-away for a month and worked on a completely different type of project feeling reinvigorated.   Perhaps, if the project is important enough, we will be compelled to return to work on it.  The trap is convincing ourselves that the project isn’t worth returning to even when it could be amazing.  Maybe it really isn’t worth returning to complete and this is where many projects end.

 

The software I have developed has been programmed into the microcontroller and features a set of base parameters for timing, managing, transmitting, and receiving “sensor” objects and “appliance” objects.  Control of appliances is achieved through a set of algorithms I have named “TheDecider,” which makes decisions based on sensor readings and pre-programmed thresholds and prompts the microcontroller to turn on or off the wirelessly controlled outlets.  I wanted the system to be easily modified to work with other environments including aquaponics, growing mushrooms, and anything where control is achieved by reading sensors and operating appliances based on programmed rules.

 

The wirelessly controlled outlets proved to be a etekcity_outletsreliable method of controlling the fans using the Arduino to send the signals depending on the temperature sensor’s readings.  It didn’t take long for the source-code to evolve into a beast.  The Arduino family of microcontrollers is limited in how many instructions it can run and hitting the program size limit doesn’t take very long when you want to control more than a few blinking LEDs.  I have found that the size limitation has forced me to write better, more efficient code than I initially do.  Even with creative variable handling and custom libraries, eventually, there is a need for another microcontroller or to move to a larger one.  There are several ways that the microcontrollers can communicate with each other.  The least expensive wireless method I could find is the nRF24L01 wireless radio transceiver.  The module is a low-power, lightweight variety of bluetooth giving hydroMazing the ability to communicate with a monitoring unit.fpzexmwi7vqs7mr-medium

I decided to add another Arduino Uno with an Liquid Crystal Display shield so that I could display what the sensors were reading and state of appliances.

I made my own open and adaptable platform that can be custom tailored to a wide variety of gardening needs and conditions; yet, also a self-contained wireless system.  The open-architecture of the system allows for ease of integrating Internet connectivity and web services.

hydroMazing outside the box
hydroMazing outside the box

Today, the project, I named, hydroMazing uses a listening Raspberry Pi for logging and communicating via email and text messaging.  In addition to the main system, I have further developed hydroMazing to include solar-powered ‘nodes’ offering even greater flexibility to scale in size accommodating outdoor gardens and industrial greenhouses.