What is a controller and why do we need one?

In my previous blog post, Aeroponics — Root Temperature Control, I mentioned a PID (proportional–integral–derivative) algorithm that regulates the workload of our temperature conditioning unit. With aeroponics growing, there are a lot of regulated activities such as rationed nutrient delivery and scheduled grow light exposure.

Because there isn’t soil used in aeroponics, there is little wiggle room for mistakes in temperature or nutrient concentration. Too little nutrients or a defective atomizer could cause fatal damage to the plants; too much nutrient would saturate the roots, defeating the purpose of aeroponics.

In fact, the algorithms and automations of control are the keys to the success in aeroponics growing.

A controller is the brain that executes the algorithms and automations. It is used to

A) Sense the environmental elements

B) Trigger actions

C) Coordinate actions based on sensor data, action history, algorithms and plants characteristics

That sounds good, but how can we get one? Well, I wasn’t able to find a good and affordable controller in consumer market. Most aeroponics DIY’ers are using timers to control nutrient sprays. It is far from precise, let alone has the ability orchestrate activities.

So we need to build our own. How? There are many ways to build an automation system controller. The most common way is to use microprocessors.

The microprocessor is a multipurpose, clock driven, register based, digital-integrated circuit which accepts binary data as input, processes it according to instructions stored in its memory, and provides results as output. — Wikipedia

In simple terms, a microprocessor (MPU) is a tiny computer with the ability to read and write signals, in forms of high/low voltage, via its pins (GPIOs — General-Purpose Input/Output). Programs are loaded to a microprocessor to execute pre-set algorithms and automation routines to collect and process signals from sensors, and send new signals to modules in order to act.

Thanks to the IoT movement, there are more options in the microprocessor market at very affordable price points.

Let's look at our function requirements before we make our pick.

Reads environment data: such as humidity & temperature, nutrient pressure, reservoir levels, etc. Drives actions: such as power up pumps, activates atomizers, sends signals to grow lights Acts on data analysis: for example, shuts down the pump when the nutrients are low and sends alerts Executes custom grow plans: for example, provides attuned climate for specific plants Cooperates with external systems: such as user applications or smart home systems. Accessible from mobile devices: remotely and securely

We can group and classify the functions in modularized architecture, so that the system could be more customizable and expandable.

Ok. Let’s find the candidates for a microprocessor that could be used for the controller’s core.

When people talk about microprocessors (MPUs), the name Atmega would naturally come up. Atmega series micro-processors are behind the famous open source Arduino project. They have digital outputs, digital sensors, analog sensors, PWM outputs like “dimmer” functions. The ecosystem enjoys a broad range of compatible hardware and firmware libraries. It appears to be a natural fit for us.

However, the Atmega chip doesn’t have the computing power to execute more complex routines, such as security, and is less convenient in terms of using modern development methodology and practice.

So besides the Atmega chip, I also selected Raspberry Pi 3 with Raspbian Linux for the security, data storage, and communication functions. Raspberry Pi3 has quad-core ARMv8 CPU, 802.11n Wireless LAN, Ethernet, 4 USB ports and BLE support. With Linux operating system and widely adopted Node.js application framework, it is very promising to build an appliance with the modern features with short development cycles.

Why not just use Raspberry Pi all along? After all, it also has GPIOs available, and lots of projects are using Raspberry Pi.

That’s a good observation BUT it still falls a short just because

It lacks support of analog inputs It has fewer GPIOs needed in our comprehensive controller design Linux based timer is less accurate than MPU’s clock for some aeroponics modules we want to build It lacks the power of modules to transform, regulate, and drive different voltages for the aeroponics modules There is a definite need for circuit protection and stability when we work with sensors and modules

So, I settled with Raspberry Pi and a custom-made adapter board with Atmega2560.

Prototyping time! I designed the board with Kicad, an open source design tool, it’s excellent and, best of all, it’s free!

3D Model of Custom Board — Aero Command

Then I sent it to MacroFab in Texas. It took about 15 days to manufacture the board. The quality is good and so is their customer service. Although they do offer discounts based on the quantity, for the initial trial, the unit price was still too high. Later on, I found a place to manufacture small batches with relatively affordable costs.

If you happen to be geeky enough to read to this line and have recommendations on manufacturing in the Stats, please let me know.

The following is the pinout map of the controller. There are two 40-pin connectors with standard 2.54mm pitch . The main reason to select this type connector is to be DIY friendly, as most of the breadboard and DIY connectors and wires are 2.54mm pitch compatible.

There are lots of pins available for future modules, such as Ph meter, smart grow light, etc.

Notice the last group of the pins in purple? It is for extension purpose. My thinking is that we don’t need Raspberry Pi for every aeroponics appliance. It would make more sense to create a Central/Extender model, so that we can create an aeroponics farm with one Central controller and multiple Extenders. (Original name was Master/Slave, but I don’t like the sound of it. So I am using Central/Extender)

The Extender will be a follow-up project in the near future.

Ready for the show! Here is the prototype I put together. It really looks like a commercial off-the-shelf product, doesn’t it? (Check out our latest version of our smart controller)

Specifications & Features:

combination of quad-core ARMv8 CPU and Atmega 2560 MPU,

with 8GB storage space,

supporting 802.11n Wireless LAN,

Bluetooth Low Energy (BLE) for discovery,

wired Ethernet,

up to 4 standard UVC cameras

standard 2.54mm pitch IO pins for sensors and drivers

extendable with Extenders

extra 24V, 5V, and 3.3V IOs for external components

input: 24VDC

max current: 6A

80 pins of sensors and drivers, allows:

Humidity/Temperature sensor

Water proof temperature sensor

Nutrient pressure sensor

Nutrient temperature conditioning

Climate temperature conditioning

Multi-band adjustable LED light control

24VDC solid state relay driver for solenoids

3 of 24VDC driver for pumps

2 ultrasound liquid level sensors

habitat door lock, sensor, indicator ready

extra analog and digital circuit sensors

On top of the controller hardware, I built a whole suite of firmware, software, a mobile app, and cloud service, so that I can remotely access, control and view my Aeroponics garden (Our latest device AeroXPS is now available to view on our site). If you are interested in integrating with your smart home system, such as Alexa, or Google Home, you can, with the APIs this controller provides.

So stay tuned for the next post: Aeroponics — Software development with the Smart Controller.