diy v1.3 smart aquaponics controller

Energy can neither be created nor destroyed, it can only change form. The source of earth’s energy is the Sun. 71% of planet earth is water, which stores the Sun’s energy. Water changes it’s state into gas when hot and into a solid when cold. Water in the oceans vaporizes and evaporates on sunny days. Wind blows the vapors inland and rises up when it reaches land. This causes condensation, and this moisture turns into clouds. Precipitation occurs and the moisture falls as rain. Water runoff causes rivers to flow back to the oceans with minerals. Infiltration makes underground rivers flow to the ocean as well. Plankton and other plants start growing in the ocean. As well as plants grow on land. And the oceans and land evolve and fill with life. Bacteria evolved cleaning the ocean & keeping the balance. This balanced model is what we mimic with smart aquaponics


We start the model using a fish tank. In the tank, water and fish mimic the ocean. A gravel filled bed mimics the land. Recirculating water between the tank and grow-bed recreates the watercycle. Flora grows on gravel in the grow-bed. Bacteria colonizes the gravel, composting & filtering waste. Balance & sustainability is attained … until ……Humans come into the picture. Humans farmed the land to create food . Nutrient runoff from human farms break the ocean’s ecosytem. Similarly, our models break as soon as we add human elements to it. Smart aquaponics turn physical gardens into data… Mitigating many issues.

A functional overview of a smart aquaponics systems is shown below:


linux makes it very easy to control the arduino. rather than write scary firmware, we abstract the arduino code as much as possible so it only reads sensors and reports the values while accepting basic commands for flipping bits or voltages.. ie. sensor and relay driver logic only. all decisions are made using higher level code. eg. turn on lights and reports how bright they are. linux decides when or why or how to respond next. further, running openwrt on the $20 tp-link router replace like 50 shields. wifi, ntp, sdcards, webservers usb – video, audio, cellular links not to mention linux tools like crond, sshd, grep, awk, sed etc and fun ones like python, nodejs, javascript etc.  oh is it also so cheap as compared to raspberry pi, beaglebone, dun etc. based solutions.

the micro controller part in this project is a standalone arduino compatible board using the atmega328. the function of this is to read sensors and drive actuators.  it handles sensor logic and reports the status of the connected sensor through a json. string object in the serial line uart0. ie. turn on lights command is issued, light sensors reports lights are on.,

the linux computer sees the atmega part as a serial device, similar to a printer or keyboard connected to it. the linux micro uses the ‘serial to  network’ ser2net utility to convert the atmega serial device into a network socket. so the sensors and relays on the atmega board can easily be accessed in linux using regular tcp/ip tools or as a device file /dev/ath0.

the data is then sent to a remote database application for data logging, monitoring, visualization, alerting, sharing and remote control.

Smart Controller Functional Overview



functional  parts of the smart controller overview and some data flow is shown above. the two pcb boards show above are the atmega based smart controller board and the linux microcomputer board.  the following stages will dig deeper into each individual block.

The Atemga Microcontroller Functional Block




The following are the electronic components used to build the smart controller boards.


Soldering is an acquired skill


We start with the components that have the lowest physical profile going up.

addingResistors addingLedsaddXtalsaddingTransistors


Hacking and Installing Linux on the Tp-Link wr703n

the tp-link wr703n is a wifi hotspot with usb that costs around $20. we will hack this to expose the pinouts we need, followed by a custom openwrt kernel install, install the smart control package files, configure this to work with the smart controller board via the serial lines and finally getting our application to connect and send data to the remote database for visualization and alerting.


breaking the warranty


broken warranty


tp_out and tp_in are the two solder pards marked on bottom of board. these are the serial pins tx and rx respectively for uart0.  we will  expose these for our application

tl-wr703n_top tin the serial connection points. a third point is anchored for grounding by scratching the pcb mask off as show below

tinningUartsa right angle pcb header is then soldered to these points


a different perspective for the uart connection is shown below: rightAngleUartCon

exposing power connections, these will be used to power the sensor board. this is done on the underside of the pcb to add a right angle pcb header connection


modified tp-link wr708n router, with power and serial pcb header connections