Introduction: Smart Garden System
Learning how to grow plants can be complicated and costly. Plants are resilient, but just one innocent oversight can ruin your crop. You can avoid these costly mistakes by letting a Smart Garden System do the hard work for you!
- Why DIY when you could buy?
- What is a “Smart” Garden?
- Starting a Smart Indoor Garden
- Digging Deeper into Indoor Gardening
- Indoor Gardening: What can go wrong?
- Managing Nutrient Solution Systems
- Why Arduino when you can Pi?
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.
Step 2: Home Automation
A home automation idea that I had bouncing around in my head for a while 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 consumer 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.
If you question your strengths? I highly recommend you try the StrengthsFinder2.0, it's an amazing tool to help identify your top 5 themes.
Step 3: Programming
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 reliable 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.
Step 4: 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.
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.
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.
Step 5: 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 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. 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.
Step 6: Nutrient Solution Monitoring
The nutrient solution level of the hydroponics container system must be monitored.
As the nutrient solution level decreases it needs to be replenished with fresh water, otherwise the nutrient solution becomes more concentrated and some plants won’t respond well. The hydroMazing Nutrient Controller can activate a pump that adds fresh water to bring the concentration back to the level it was when started, often referred to as “topping-off.” The hydroMazing Nutrient Controller will also monitor your pH and EC, activating pumps to manage the solution, and notifying you when you need to make changes.
Step 7: Going Further...
A picture of the final hydroMazing set and the demo tent at the Portland Mini Maker Faire, September, 2016.
The future for hydroMazing, besides lots more beta testing ;-) is a hydroMazing Garden Wizard that guides you through your entire grow! The system could provide instructions and tips for how to manage the issues that hydroMazing identifies.
Thank you for taking the time to read my Instructable!
please follow me and learn much more at http://www.hydroMazing.com
You might be serving-up a lot more then you think you are!
Do you know who is accessing your web server?
There are many ways of running a web server in a Linux environment, so to keep this Instructable a relatively reasonable length, I will focus on the common L.A.M.P.(Linux.Apache.MySQL.PHP.) implementation. I explain searching your web server logs, setting-up typical access lists: blacklists, whitelists, and a combination of the two. I will also share with you my web interface for working with the .htaccess files remotely. Finally, we will look at an open-source firewall.
Private Web Serving with the Raspberry Pi
Runner Up in the
Indoor Gardening Contest 2016
Participated in the
IoT Builders Contest
Participated in the
Arduino Contest 2016
1 Person Made This Project!
- bitsandbots made it!
4 years ago on Step 7
“Anxiety, the next gumption trap, is sort of the opposite of ego. You're so sure you'll do everything wrong you're afraid to do anything at all. Often this, rather than "laziness" is the real reason you find it hard to get started”
― Robert M. Pirsig, Zen and the Art of Motorcycle Maintenance: An Inquiry Into Values
6 years ago
You (and it) are genius!
Reply 6 years ago
Oh you, stop! ;-)
6 years ago
6 years ago
Hello! Is there a photo of the final 'thing' somewhere?
Reply 6 years ago
Hi, Thanks for the question!!
Step 7, is a picture of the complete set and here is a picture from the Portland Mini Maker Faire of the mini demo tent: