Does this project spark your interest?

Become a member to follow this project and don't miss any updates

Smart Aquaponics

Harnessing Nature, Linux And A Phone To Feed Ourselves

Similar projects worth following
This project is submitted for

This project was created on 07/12/2014 and last updated 5 months ago.

Mimicking and modeling natural processes that sustain life on earth is critical for humanity to colonize new frontiers. The biggest challenge is that natures processes take like forever while humans live for a limited short time – so people take shortcuts leading to most sustainability issues facing the earth today.
Smart aquaponic systems can autonomously mimic the earths water cycle and model nitrogen cycles, oxygen cycles etc. to grow healthy organic produce for feeding new and existing colonies
This smart aquaponics project involves using modern fabrication technologies to build an aquaponic garden, establishing biological life balances in the garden, assemble the electronics kit and sensors, software programming and finally remote database configuration for monitoring and visualization.
We will hack a wr703n router into an Openwrt Linux microcomputer, build a standalone arduino compatible board and connect the two for a powerful IoT smart controller application

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

there are three main functional blocks, the atmega328 standalone brains, the input section consisting of pullup/pulldown resistors chains and an open collector output stage. there is also a uart section for connecting with the linux microcomputer and a power indicator section.

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

a larger list is shown below....

Read more »

  • 1 × v1.3 smart controller pcb board
  • 1 × tplink wr703n router
  • 1 × atmega 328p chip
  • 1 × 28 pin dil ic socket
  • 4 × bjt transistors
  • 4 × green led diodes
  • 1 × red led diode
  • 1 × 16 mhz crystal
  • 6 × 10k resistors
  • 2 × 22pf ceramic capacitors

See all components

Project logs
  • kj2arduino - it's all starting to coming together

    07/01/2015 at 12:24 0 comments

    and its so fun and easy to use

    i designed the v2 smart controller boards such that i could connect any inputs(sensors) or outputs(actuators, relays) on any pin without having to update the firmware on the board or external interface components..

    the only thing you need to use a v2 smart controller board is a unique hostname and wifi(or ethernet) connection. you can connect any digital, analogue, 1-wire, 12c, serial sensors to the pins and the board will send the raw values of all sensors connected to the backend server . the api for retrieving your raw data is (where kj_v2_01 is my office garden). in response is the raw pin data sent from the controller (i don't know if it is temp, a float switch, leak, noise etc they are just raw readings)

    "pins": {
    "D38": 0,
    "D30": 0,
    "D31": 0,
    "A15": 417,
    "A14": 456,

    user, device and sensor profiles are defined and mapped in the backend. say A4 is assigned to a photocell sensor, and D30 to a float switch, raw values are converted to the to correct values here. say A14:456 could be mean that an ir sensor connected on pin A14 measured 4 feet. or that D30 :0 means that a leak sensor connected on pin D30 has detected no leak yet

    the library kj2arduino makes it possible to assign pins dynamic characteristics that you would normally need firmware on the board to do. the sensor mapping interface is show below:

    typical ui with mapped sensor elements decoded using kj2arduino

    the colors change based on sensor present values. you can change sensor set points, units, conversion code and messages using the sensor screen below::

    more visualizations of my kj_v2_01 office garden done with v2 and kj2arduino

    grafana graphs of the same data ... this are raw values straight from an influxdb server

    and lots of other goodies with the v2 board, video streaming//timelapsing, remote control ui, alerting etc

    so ... in short you need to use a v2 for your next project ... comes with all the software

  • v2 smart controler based garden visualizations

    04/23/2015 at 22:27 0 comments

    we finally figured out most of the critical bugs on the v2 controller boards, things are never as easy as it seems - i guess building your own custom linux computers from scratch was not going to be as easy as i thought it would be. this one really tiny smt resistor that was picked and placed in the wrong orientation took almost 2 months to catch since i thought it was a kernel or software issue, but we are good to go now. here are some v2 visualizations of my office garden ... ... does your flood and drain garden behave the same as mine

    the visualizations are done using influxdb and grafana as per this tutorial in in my website

    here is a live video url from this garden

  • v2 testing and debugging is coming along

    11/04/2014 at 12:58 0 comments

    always takes longer than originally anticipated.. fixed hardware bugs and waiting on new updated boards from the east.

    working on software platform ... this is fun - a different kind from electronics ...

    see updated video 3 for more information

View all 7 project logs

Build instructions
  • 1

    Soldering is an acquired skill

  • 2

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

  • 3

See all instructions

Enjoy this project?

kijani grows wrote 12/09/2014 at 03:44 point
i started adding more information at the knowledge base section on our site.

Are you sure? yes | no

Ben Ahrens wrote 08/21/2014 at 04:30 point
Your LED current limiting resistor size calculation Vcc/If neglects the fact that the voltage across the resistor will not be the full 5V. Your power calculation, on the other hand, assumes Vcc - Vf volts across the resistor. Why the difference?

Are you sure? yes | no

kijani grows wrote 08/22/2014 at 00:10 point
just me being a goof ball. the doc's are for explaining design considerations. given the voltage and current ratings most preferred components with values close by will most likely work. but yes, i should consider all potential drops in my calculations.

Are you sure? yes | no

sbrulais wrote 08/17/2014 at 07:40 point
Power dissipated by the resistor: (5-2.1)*0.02= 0.058W assuming 20mA is going through the LED (which is not true now). When you don't know the current P=V²/R=2.9²/220=0.038W
So 1/4W resistor are ok ;-)

Are you sure? yes | no

Gareth Coleman wrote 08/08/2014 at 12:30 point
Hey - great project! I've tried the Atlas pH probe and I was disappointed, to be honest. Their support forum seems of limited value and their stuff is expensive. Also the probe was completely destroyed after only a couple of months continuous use. We had much better results with a cheap probe (£7 vs £50 for the Atlas one) and a circuit from Sparky's Widgets - it's open source and Ryan is responsive if you have questions or issues. Good luck!

Are you sure? yes | no

zakqwy wrote 07/15/2014 at 12:30 point
How do you plan to measure DO? In my experience, getting that value accurately can get a bit spendy, and the sensors often need regular maintenance.

Are you sure? yes | no

kijani grows wrote 07/16/2014 at 08:37 point
nature does not dependent on absolute values ... rather how the different variables relate to one another ... which is one of the objectives for this project, to model after nature. dissolved oxygen in water depends on many things including, temperature, time of day, water quality, biological mass etc. there are many ways to monitor and respond to oxygenation issues without instrumentation. that said, i like the devices from ... their probes are relatively professional, stable and they have replacement membranes for their dissolved oxygen probes.

Are you sure? yes | no

zakqwy wrote 07/16/2014 at 09:58 point
Great call--if you're looking for relative values, a galvanic device will probably work well. That probe from Atlas isn't too expensive either, which is nice. Good luck!

Are you sure? yes | no

Similar projects