Arduino hydroponics, how to go from simple to complex

Hydroponic systems offer a great opportunity for DIY electronics. In these systems, you can monitor many variables, gather a lot of data, and build automated control systems using this information. However, the more advanced projects can be very overwhelming for people new to Arduinos and the simpler projects can be very limiting and hard to expand on if you don’t make the right decisions from the start. In this post, I’m going to talk about the easiest way to start in Arduino hydroponics, which materials and boards to buy, and how to take this initial setup to a more complex approach with time.

The Arduino Wifi Rev2

Buy the right Arduino

First, buy an Arduino that allows you to build simple projects without compromising your ability to upgrade in the future. My recommendation would be an Arduino Wifi Rev2. These are small boards that are compatible with Arduino Uno shields, with the ability to connect to your network when you’re ready for more complex projects. Shields are boards that can be stacked on top of your Arduino, which allow you to get additional functionality or simplify the usage of the board. The Arduino Wifi Rev2 is a perfect choice, as you can outgrow simpler boards quickly while the more complicated ones are likely to be overkill and limit your potential shield choices.

Avoid soldering and protoboards, go for plug-and-play

For people new to Arduino, it is easier to avoid sensors that require soldering or protoboards and go with plug-and-play approaches. My all-time favorite is the “Gravity” system created by DFrobot, which uses shields that expose quick access connectors that you can use to plug-in sensors. My recommendation is the LCD12864 Shield, which has an LED and allows you to connect both analog and digital sensors. If you buy any “Gravity-compatible” sensor, you will only need to hook up a connector, no soldering or protoboards involved. You also have a graphic interface you can program and buttons you can use to interact with your Arduino and code.

The LCD12864 Gravity shield that exposes easy plug-and-play ports for sensors

Start with a temperature/humidity display station

A good beginner project is to create a monitoring station that displays the readings from sensors on a screen. I’ve written about how to build such a station in a previous blog post. However, since pH and EC sensors can be more complicated, it is easier to start with temperature/humidity sensors only. There are several cheap sensors of this kind, such as the DHT11 and DHT22 sensors, but these have important issues. A better choice for hydroponics is the SHT1x sensor. If you are more advanced, the BME280 sensors are now my low-cost sensor of choice. There are lots of gravity sensors to choose from. You can also monitor CO2, light intensity, solution temperature, EC, pH, and other variables as you become more advanced.

Sensor de Humedad y Temperatura SHT1x Gravity - RobotShop
The SHT1x Gravity sensor, this can be easily plugged into the LCD12864 shield shown before

When you go into EC/pH monitoring, make sure you buy sensors that have electrically isolated boards. The ones from DFRobot are not electrically isolated and have important issues when multiple probes are put in the same solution. Most cheap ones on eBay/Amazon, have the same issues. I would recommend the sensors boards from uFire, which have a lower cost, are properly isolated, and are easy to use. The hydroponic kit collection, offers all the sensors and boards you require, in rugged industrial quality configurations, to build a hydroponic monitoring station.

Next step, simple control

The next step in complexity is control. You can use a Gravity relay to switch a light or timer on or off. You can also use a simple dead-band algorithm to attempt to control your temperature and humidity values by using relays to turn humidifiers, dehumidifiers, or AC systems on or off. If you want to control nutrients and pH, this is also where you would get shields to run stepper motors and the peristaltic pumps required to feed solutions into a tank. I’ve used this shield stacked under an LCD12864 for this purpose.

As an example of simple control, imagine your humidity is getting too high, so you install a dehumidifier to keep your humidity from climbing above 80%, you then create a line of code that sets the relay to “on” whenever the humidity gets higher than 80% and shuts it down whenever it drops below 75%. That way your crop’s humidity increases to 80%, the dehumidifier kicks in, and then it shuts down when it reaches 75%. This allows the setup to climb back up for some time, avoiding the continuous triggering of your appliance.

Data Logging

After you’re comfortable with both monitoring setups and simple control, the next step is data logging. Up to this point, none of your setups have done any data logging. By its very nature, an Arduino is not built to log any data, so this will require interactions with computers. My favorite way to do this is to set up a MyCodo server on a Raspberry Pi, then transmit data to it using the MQTT protocol. Since your Arduino Wifi v2 can connect to your Wifi network, you will be able to transmit data to your MyCodo using this configuration.

A sample of the data-logging capabilities of a MyCodo server. Taken from the MyCodo site.

I have previously written posts about MyCodo, as well as how to build a pH/EC wireless sensing station that transmits data to a MyCodo server. This allows me to log data continuously and monitor it without having to go into my hydroponic crop. Since the server is centralized, it also allows you to monitor multiple sensing stations simultaneously. I use my MyCodo server to monitor both my hydroponic crops and Arduino sensing stations that monitor how much food my cats eat.

More complex control

After you have connected your Arduino to a MyCodo server, you have access to much more complicated control, through the Raspberry Pi computer. You can then implement control algorithms in the MyCodo, then communicate with your Arduino, and trigger actions using MQTT messages. This means that you no longer need to code the control logic into your Arduino but you can do all the control in the raspberry Pi and just communicate the decisions made to the Arduino Wifi Rev2.

More complicated algorithms includes the use of proper PID algorithms for the control of humidity, temperature, pH and EC. It also includes the implementation of reinforcement learning algorithms and other advanced control methods that the Raspberry Pi can have the capacity to run.

Conclusion

Arduino in hydroponics does not need to be complex. Your first project can be a simple temperature/humidity monitoring setup and you can evolve to more complicated projects as your understanding and proficiency grow. If you select a powerful and feature-rich Arduino from the start, you can use the same controller through all your different projects. If you select shields that can make your life easier – such as the LCD12864 shield – and use a plug-and-play sensor interface, you can concentrate on building your setup and your code, rather than on soldering, getting connections right, and dealing with messy protoboard setups.

The road from a simple monitoring station to a fully fledged automated hydroponic setup is a long one, but you can walk it in small steps.

Have you used Arduinos in your hydroponic setup? Let us know about your experience in the comments below!