Introduction: IoT NFT Aquaponic System Controler With WebApp (Intel Edison & Node.js)

Aquaponics

Aquaponic combines Aquaculture (fish growing) with Hydroponics (plant cultivation in water). Fish excrete is broken down by bacteria to Nitrate which are absorbed by plants as nutrients, and plant roots act as a filter to clean the water for the fish. The water is circulating from fish tank to plant growing beads and back to fish tank. This is almost a closed circuit, you feed the fish and fish feed the plants and both feed you. This type of plant cultivation can be used anywhere (deserts, rooftops, houses...) and actually saves water as the same water is constantly recirculating (you just have to top up the tank when water evaporates), compared to traditional soil plant cultivation that needs to be watered constantly and most of the water is lost in soil. Also if all conditions are meet plants grow much faster then in soil because they don't have to develop extensive roots, nutrients are brought directly to them.

More details about aquaponics can be found on these links:

The Aquaponic Source

Backyard Aquaponics

NFT (Nutrient Film Technique) is a system for growing plants that recirculates water in a shallow stream over plant roots in a watertight gully. Gullies are most commonly made from PVC pipes with drilled holes on them that fit plant containers. Plant containers have holes that enable plant roots to grow inside the gully.

Motivation

My motivation for doing this instructable was to make life easier to all those aquaponics enthusiasts by automating the system so they can have a better control and monitoring of the system, and to allow them to experiment more easily with different settings to see which ones give best results.

Aquaponic setup

I used a 20 liter aquarium as a fish tank and pvc pipes to house 10 small plant containers. Its a small experimental setup but the controller can be used on a much bigger system. It could even run a small aquaponic greenhouse or if you already have an aquaponic NFT system you can just hook it up on that.

Controler

The system uses Intel Edison as a brain, many thanks to Instructables and Intel for providing me with this nice piece of hardware. Controller is made to be plug and play, you just plug in regular aquarium water pump, lights, air pump and fan to the controller box and attach the sensors. Controller can be hidden somewhere as everything can be viewed and controlled in the webpage on the local area network. Webpage displays the sensor data and enable users to change system settings, sensor data is refreshed using websockets so it has a good response to system changes.

To control water flow through the gullies water pump(AC) and water flow sensor are used. When certain amount of water passes through the gullies system can pause for some time to allow better aeration of the roots. If the water flow stops (pipes clogging or water pump malfunction) an alarm is sounded with LED indicating what is the problem.

You can set which period of the day you want your plants to receive light (eg. 10am to 10pm), if the ambient light is strong enough "artificial" light will be turned off to save power and when ambient light drops under user defined value artificial light will be turned off. There is a second light sensor that measures system light, so if the system is not getting enough light even when the artificial light is on an alarm is sounded with LED indicating what is the problem.

Aeration pump can be turned on or off by system settings, and fan can be turned on if temperature goes over user defined value.

Alternating current circuit is completely isolated from the Intel Edison circuit by using 4 channel relay module with optocouplers.

Future Development

  • First I'm planning to add a DIY automated fish feeder with adjustable settings (already in process)
  • Water level sensor that will sound the alarm if the water level in aquarium drops too low.
  • Webcam to take a picture of the plants each day and store it on a SD card, so you can review your plant progress.
  • Next is to add pH, DO and EC sensors to have a better overview of the water chemistry. DO (dissolved oxygen) sensor readings can then be used to turn the air pump on if DO value drops too low. These sensors are expensive so prize sparkfun credits would really come in handy. So please if you like the this instructable don't forget to vote for me in Intel IoT Invitational.
  • End goal is to store all these sensor and event data in a central database, that way we can feed it with data from multiple controllers. A web app on top of database that can display all the data and make statistics. I know there are cloud services like Salesforce IoT Cloud and Intel IoT Analytics that can achieve a similar effect, but I want to do it locally so i have full control, and can tailor the webapp (and db) the way I want and make its simple enough for everyday use.

Step 1: Gathering Materials and Tools

Electronic parts:

Alternating Current parts:

  • 220V AC Outlet (Europe) or 110 AC Outlet (US) (4x) - local hardware store
  • AC Switch - local hardware store
  • Power Supply - AC 220V/110V to DC 5V minimum 400mA - try to find old phone chargers (I used one from Ericsson)
  • 1mm copper insulated wires for electrical instalations (2-3 meteres) - local hardware store

Box Parts:

  • Laminate Flooring/Floating wood tile (6mm thickness)
  • 25x25mm piece of wood
  • Small Nails
  • Small Hinge (2x)

NFT System Parts:

Tools:

  • Hammer
  • Jigsaw
  • Drilling Machine
  • Rasp Tool
  • Brad Point Drill Bits
  • Hole Saw
  • Calliper
  • Angle tool
  • Tape Measure
  • Soldering Iron
  • Solder
  • Pliers
  • Wire Stripper

Step 2: NFT (Nutrient Film Technique) & Aquarium Settup

For NFT gullies I used 7.5 cm diameter PVC pipes that is ordinarily used for bathroom drain plumbings. They have rubber rings on one side so joint is sealed as soon as you plug one into another. Where i live you can pick them up from any hardware store. If your country doesn't have pipes like that you can probably find something with similar diameter just make sure it fits inside the frame and you can make joints watertight.

First drill one hole on 4 elbows (90 degree) and two holes on each 30 cm pipe, make sure that there is at least 5 cm space between the holes and try to distribute them evenly. To make these holes use a drilling tool and a circular saw (50mm diameter), after that use a rasp tool or knife and sand paper to smooth the edges of the holes. These holes will hold plant containers.

In the center of the PVC cap drill a hole of 26mm also using a circular saw and screw in the brass fitting (1/2''3/4"x1/2" Hose Barb to Male Pipe Fitting).

Assemble the PVC piping as it is shown on the picture 4 and 5. If the pipes are not going one into another put some cooking oil on the rubber rings to enable them to slide in more easily. A good thing to do before assembling is to wash the pipes to make sure nothing on them can harm the fishes.

Frame I used for the system was an old shelve unit made from aluminium rods and connectors. It is strong enough to hold the aquarium and pipes with plants and it looked good so i decided to reuse that. If you cant find anything similar you can always make your own frame. Dimensions are: height 50cm, width 50cm and depth 40cm.

Once assembled put it on your frame and adjust the pipe angles to drain the water from the cap to the 45° elbow (last one), holes for plant containers should face up :) . To secure the pipes I used few galvanized screws (screw them in the upper part of the pipes that wont have water running over them) and wires tied to the frame. Probably a better way of securing them would be to use proper 75mm pipe mounts, but im not planning on having big heavy plants so this should be ok.

Put pipe fittings(1/2"x3/4" Barb to Female Swivel Garden Hose) on each side of the G3/4 water flow sensor and tighten them. Now cut two pieces of 1/2 garden hose and connect them. One should go from the water pump to the water flow sensor and the other one from water flow sensor to fitting on the pvc cap. If they are going hard on the barb fitting heat the hose in hot water for a minute and then try again. I also added a manual valve between the pump and the flow sensor so i can control the amount of water flow, but its not necessary as I have it fully open all the time. Tighten the water flow sensor to the frame by zip ties or wires.

At this time you should test the pipes and hoses for leaks by leaving the pump to circulate water through the system for at least half an hour (just put some water container below the pipes). Also when you turn off the pump, if the water stays in one part of the gully adjust the slopes so all water is drained back to the aquarium.

If everything is ok you can install your aquarium and make sure water exiting from the pipes drop into aquarium and don't sprinkle water out of aquarium.

Now the aquaponic system is ready and we can go to the steps to automate it.

I wont go into starting up and cycling the aquaponics system in this instructable you can read more about it here.

Step 3: Controller Box

As I don't have a 3D printer i had to make a box for the controller in the old fashioned way ... with wood.

You can download pdf with dimensions and sketchup model of the box.

I had some laminate flooring left so i used that for the box, board thickness was 6 milimeters. You can use any wooden board you can find but if it has a different thickness you will have to compensate on sides E and F (labeled on first picture). Eg. if your board thickness is 10mm then the length of sides E and F are 180mm instead of 188mm.

First cut out all sides from dimensions specified in pdf (compensate board thickness), then mark all hole centers and Intel Edison board openings.

Use brad point drill bits (50mm) to make socket holes on side B, then use a rasp tool widen them so sockets can fit in tightly. If your country uses different sockets then measure them and make holes to fit them.

Drill 5mm holes for LED Indicators and piezo buzzer (Side C), and 3mm holes for bolts that will secure Edison and relay boards(Side B), a 8-10mm hole for power cord (Side F).

For Edison board openings first use a drill to make holes, and then tailor out the openings using the jigsaw. Try to fit in the edison board, if its not going in widen it more using a jigsaw. Also make sure all cables can be plugged in.

I found this AC flip switch laying around, most probably you will not find something simmilar so you can skip adding a switch. If you want it, buy something similar from a local hardware store, take the measurements and cut out an opening to fit it in.

Take 25x25 piece of wood and cut 4 pieces to 80mm length (Parts G).

Now take a hammer and nails (15-20mm long) and first assemble and nail sides C, D, E and F to parts G in the corners (look at the picture 5 to get a better idea how), then nail in the side B to assembled frame. You could use screws instead of nails, but nails are cheaper and are good enough.

Side A can be screwed in when you put everything in the box, but i wanted a easier access to the inside of the box when i want to modify or check something. For this I used two small hinges (30x30mm), screw them in on the inside of Side A, and on the outside of side C. As side C is the top side, gravity will keep it closed.

Step 4: Relays & AC Sockets Setup/Wiring

Here in my country (Croatia) we use European Type F Sockets for domestic grid electricity (230V monophase alternating current), so I put those on the controller box. That kind of socket is used for all house appliances, aquarium also, although most of them use Type C plugs, which are the same thing just without grounding connection.

If your country uses different AC Sockets use that, the wiring is the same, you just have to adjust the size of the box holes for sockets.

For more information about different AC Sockets you can go here or to wiki.

WARNING - In this step we are working with alternating current which can do serious damage to human body and can even cause death, so if you don't have any experience in working with alternating current or you are not sure what you need to do here find a person that does, and let them help you out.

First insert the sockets in holes and secure them with screws, two screws for each socket should be enough (if you want you can put four).

Take the 4 relay module and find two bolts(around 2-3cm length) with 6 matching nuts that fit the mounting holes.

  • put the bolts in the mounting holes and secure them with nuts
  • next screw in second set of nuts on desired height, minimum 1cm of bolt length should be keept so it can go through the box and have space for the nut on the other side
  • insert into box holes and screw in nuts from the outside, make sure everything is tight

To secure the AC-DC adapter you can use a metal strip and screw them in the sides. The adapter I found had a cable with AC plug, so I cut it off and used that as the controller box cable plug. If your adapter doesn't have a cable plug you can buy it or strip it of from some old household appliance that doesn't work.

I have put an AC switch on the box, but if you don't have (or don't want) one it doesn't matter, you can skip that and just unplug the controller from the wall socket when you want it to turn off. NOTE: If you put the AC switch make sure it's made to handle alternating current.

And finally wire everything up as it is shown on the schematic.

  • One input AC wire goes directly to the adapter and one side of the sockets
  • Second AC wire goes to switch (if you have it)
  • After the switch it goes to adapter and to middle connector on each relay
  • Left side of each relay connector connects to second side of the corresponding socket
  • Connect +5V (red) wire from adapter to jd-vcc pin on the relay module (remove the jumper)
  • Connect gnd wire from adapter to gnd pin on the relay module

This relay module uses optocouplers so we can completely isolate our edison board, to protect if from any possible surges caused by relay failure. More info about relay modules can be found on this site and about the wiring to arduino here.

Step 5: Intel Edison Wiring

Screw in Intel Edison Arduino breakout board to plastic legs that came with the board, and then screw in the legs through the pre-drilled holes on the box (side B).

Most of the breadboards have a sticky back side, so just stick it on the box between the Edison board and the relay board.

All sensors are outside the box, connected by wires to breadboard. I recommend using UTP cable for wiring, its light and it has 8 different color wires in them, so you can identify easier what goes where.

  • Make two groups with 4 wires each
  • On first group connect the temperature sensor and photoresistor, they can share the +5V wire so 4 wires are enough
  • First group will collect ambient data so its best to attach those sensors somewhere above the system lignt, so it doesn't pick up the system light
  • On second group connect water flow sensor and photoresistor, they also can share +5V wire so 4 wires are enough.
  • Photoresistor from the second group should be placed somewhere inside the system so it can catch its artificial light, possibly somewhere it wont be covered with plant leaves.
  • On the breadboard photoresistors use 10-kilohm resistor connected to the ground, and water flow sensor uses 10-kilohm resistor connected to +5V
  • Secure the wires so they can't be pulled out of the box, I used a metal strip screwed on the box and put few layers of insulation tape on the wires so they cant be pulled out.

Insert LEDs into box holes and solder some wires to them so you can connect them to the breadboard, connect the cathodes (short leg) to ground through 220-ohm resistors, and anodes to edison pins 10, 11, 12.

Solder some wires to piezo buzzer and insert it into box hole, connect one wire to pin 9, and other to gnd.

Connect Edison pins 4, 5, 6, 7 to relay module pins, and +5V from edison to vcc on relay module board.

Finally label the sockets and LED indicators.

Step 6: Edison Configuration and Code Upload

First assemble, flash and install everything you need for Intel Edison with Arduino breakout board, details can be found on this link.

  • Set up your serial connection, details here.
  • Connect your board to your local wifi, details can be found on this link.
  • Set the your Time Zone on edison, details can be found on this forum post.
  • Set your device name using this command (in serial terminal): configure_edison --name
  • Set your root password using this command: configure_edison --password

Device name will enable you to access you device from browser(on a computer connected to your local network) without IP by typing in "http://device_name.local/" (eg. "http://edison.local/"). You should try it out to make sure its working ok, a simple web page with device information (hostname and IP Address) and intel logo should show up.

Install Intel XDK IoT Editon, details can be found on this link. Make sure your XDK is up to date and after you connect to your board upgrade the xdk-deamon on IoT device.

Start a new project from template "Onboard LED Blink" and run it on your device just to make sure everything is working ok.

  • Now when everything is set up you can download "Aquaponic_IoT.zip" and unpack it somewhere on your disk.
  • Start a new project, select "Import Your Node.js Project", browser for folder where you unpacked the zip, continue and enter a working name of the project.
  • Upload the code to your device and run it
  • Go to "http://device_name.local:3000/" in your browser and you should see the Aquaponic IoT webpage

Step 7: WebApp and Alerts Explained

WebApp: Monitor

Ambient data

  • Light percent gauge - this sensor is placed somewhere above the system lamp
  • Temperature gauge
  • These show the data from the ambient the system is in (eg. room where you put the system).

System Data

  • Light percent gauge - this sensor is placed inside the system
  • Flow Rate - shows current flow rate, something like a RPM gauge in a car, only this one shows Liters per Minute.
  • Flow Cycle Progress - progress bar that shows how many liters have passed in the current flow cycle
  • Flow Cycle Statistic - holds the values of last cycle duration, average cycle duration and how many cycles where measured for this statistics. Flow statistic will be reset after edison reboot, manual reset and if you change Liters per Cycle setting.

Relay Status

  • 4 boxes, one for each device connected to Controller: Water Pump, Lights, Air Pump, Fan
  • Red box indicates the device is turned off, green indicates the device is turned on

Controls

  • Stop Sound Alert - override for alarm, so you can stop the sound until you fix the problem (i did try to make the alarm sound as less annoying as possible, but long exposure to it will probably make it annoying)
  • Reset Flow Cycle Statistics - Resets the flow cycle count and average values (good to do after cleaning your pump)

Event Log

  • Event log displays every event in the system, when any of devices is turned ON or OFF, and system alerts.
  • eg. "08:42:27: Water Pump: OFF, Reinitiate at: 08:52:27"

WebApp: Settings

Light Settings

  • Starts At: - when to turn the lights on
  • End At: - when to turn the lights off
  • Minimum Light (%): - turn lights on if ambient light drops below this percent

Water Pump Cycle

  • Liter per Cycle: - how many liters should flow in the cycle before the pause
  • Pause Cycle (minutes): - after the cycle ends pause for minutes specified

Temperature Control

  • Fan plugged in: - fan is optional so you can define here if you connected it or no
  • Max. Temperature: - Specify maximum temperature, if ambient temperature go over that value fan will be turned on

Water Aeration

  • Air Pump plugged in: - If you think your water is not aerated enough you can plug in an air pump, runs constantly for now, I'm planning to add a DO (dissolved oxygen) sensor to know when it should be turned on.

Alerts

Flow

When water isn't flowing through the system, and water pump relay should be on this alarm is sounded and flow alert LED lights up.

This alert can be caused by few different reasons:

  • Water pump malfunction
  • Flow sensor malfunction
  • Hoses clogged
  • Relay malfunction

Light

When system lights should be on, but the system is not getting enough light, alarm is sounded and light alert LED lights up

This alert can be caused by few different reasons:

  • Light malfunction
  • Light sensor malfunction
  • Light sensor covered by a leaf
  • Relay malfunction

Comments

author
samotras (author)2017-06-22

awesome project . can i use pi Instead of intel ? and github for this project ?

author

a new version with pi zero + arduino is under development, it should be done by the end of the year and available on github. A lot of new features will be included

author
lmaman (author)2016-11-30

Any new progress on future developments?

author
marjanovic_davor (author)lmaman2016-12-01

Working on a new model that uses arduino (for control and getting sensor data) in combination with rpi zero (for storing and displaying data over the web interface). This model will be enhanced with data statistics and few new sensors, and it will also cost less to make coz of switching from intel Edison to Arduino + Rpi Zero.

author
lmaman (author)marjanovic_davor2016-12-01

Oh sorry to hear that I kinda like this Edison chip and node.js. Me and my brother are going to do it like you did and we want to improve it with water temp sensor and heater and we got more ideas. Your work and idea is brilliant and thank you for sharing.
Also, I don't know if you know it but banggood.com is also very good and cheap place for electronic stuff.

author
marjanovic_davor (author)lmaman2016-12-02

Cool ... I'm happy to hear that ... if you need any help feel free to contact me.

Don't get me wrong i like the Edison chip also, its like a sports car for microcontrollers. :) But it is expensive compared to Arduino + Rpi Zero combination. So I want to make a cheaper alternative to this system. Rpi Zero will use Node.js for the things that it does best (web app and data storage) and Arduino will use C++ for things that it does best (reading sensor data with steady cpu clock). I run into some problems when trying to do it all with Node.js.

Also if you are interested we can open an github repository and collaborate on the project... its an open source project so any kind of contribution is welcome and it can grow faster that way.

PS: I still use Edison setup for my current aquaponics system, its been running for more then a year constantly with no problems. ;)

author
lmaman (author)marjanovic_davor2016-12-02

Thank you! The github idea is great! We will be in touch as soon as we'll start. For now we checking the net for Christmas sales and stuff we want start with.

author
AlanL45 (author)2016-03-02

Brilliant. Absolutely bloody brilliant. Full explanations etc etc...

I know nothing about electronics and have been looking for a aquaponics automated control, monitoring system. I want EC, DO, Ph, monitors and water level controller light monitor is a plus, and a fish feeder. All doable it seems. Fantastic. Now to read it all again to try and understand the technical bits. Talk about jumping in the deep end. Davor, many many thanks for this.

author
rpvanpatt (author)2015-12-14

This is great! I've been meaning to actually work on an idea very similar, the same really, as this. Is the Edison really key in this setup? I was looking at using some Adafriut pieces and their io to monitor and IFTTT to automatize. Any thoughts?

author

IFTTT requires constant link to the web and services, so if your system gets disconnected its inactive. I am more confident in a system that can run on itself. Edison is not the key in this setup, similar setup could be done with raspberry pi but some things should be adjusted, and its not easy to use as edison board. For Arduino I'm not sure you can do this, as you cant run Node.js on it, and getting the same user interface with C++ would be quite difficult.

author
CyberNinja187 (author)2015-12-16

I just thought I should mention . Many of the hoses and piping you used is not rated for potable water.Harmful toxins could be leeching into the water and absorbed by your plants. Which is in turn consumed by you.

author

I think that there shouldn't be anything toxic in the system, but I'm keeping an eye on fish. They are lively and looks like there is nothing harmful for them so far, so it should be ok.

author
tomatoskins (author)2015-11-04

I love the web app idea with this! So awesome!

author

Thanks, yea I wanted a better way of displaying system data and controlling settings, LCD display and push buttons seemed so lame :)

author

Well played. I am in the process of creating a fully controlled aqauponics system with close to what you have. i will most definatly have to read this again. Thanks for the contribution and hard work

author

Thanks, its not hard work when you enjoy doing it :)

This is still work in progress, I'm adding more stuff and settings, but current features are working good so far. Feel free to contact me if you have any questions.

author
szvenigorodsky (author)2015-11-04

Awesome, refined end product! Looks great.

I did have a question: what kind of lights did you use, and do you find the lighting satisfactory?

author

Thanks, currently i have 60W flourescent tube for lightiting, and I will have to change that as I think that plants are not getting enough light when ambient light is low. But you can plug in any type of light you have into this controller.

author
iciolan (author)marjanovic_davor2015-11-05

That's because FL give 45-55lumens/W

You might want to try A++ LED they usually give about 100lumens/W and have a better penetration.

author
marjanovic_davor (author)iciolan2015-11-05

Yea, I will have to switch to LED as it is more power efficient ... I'm looking into something with adjustable spectrum :)

author
drinknhand (author)2015-11-05

Exceelant work -- thank you for sharing!

author
BrankoD2 (author)2015-11-04

Im very much interested in your project, is there a way to contact you directly?
How do you measure ambient light strenght? Do you measure the par value?

author

You can contact me at aquaponic.controller@gmail.com

I'm measuring ambient light with a photoresistor, putt the values in an array (10) for buffering and use the avg value. Additional for turning the light on and of i use the difference between min and max values in the array(if the sensor has wild sensor reading) that is incorporated into minimum light condition.
System and Ambient light sensors readings are separate.

author
sde wit1 (author)2015-11-04

really nice project mate

author
SenthilL1 (author)2015-11-04

Good stuff, closed loop ecosystem is a cool idea- especially when you can control it through a web app.