Balcony Aquaponics 35 litre – Setup

Overview::

Trying out Aquaponics in the limited space of  balcony. This post tries to explain the basics,  components needed and initial minimal setup to get the system in place. As you must be aware Aquaponics is the practice of growing fish and plants together. Fish excreta is rich with Ammonia which will be converted to nitrate that is good food for the plants. Conversion takes place in plant grow bed where bacteria grows. Water is cycled  from the fish tank to the plant grow bed and back.

Aquaponics-Diagram-41-649x779
A 35 litre / 10 Gallon container is used to grow the fish and a 25 litre plant grow bed is used . Grow bed is placed on a level above the container and water is pumped into it with a submersible pump . Draining of the growbed back to the fish container is performed with an Auto siphon.

Components::

  • 35 litre container for tank ( Fish tank volume should be larger than the growbed vloume )
  • 25 litre barrel cut on top used as grow bed
  • 9″ x 6″ HDPE sheet to cover the container ( Optional if you have a food safe container )
  • 3/4″ PVC Standpipe
  • 1 1/2″ Bell Siphon PVC pipe
  • 1 1/2″ PVC cap
  • 2 1/2″ PVC Gravel guard
  • 3/4″ PVC tank connector
  • 3/4″ PVC Female & Male adaptors to connect to tank connector
  • 3/4″ L joints
  • Tape to insulate the PVC fittings
  • Submersible pump
  • 1/2″ Hose

Points to note::

  • Fish tank volume should be larger than the growbed vloume or else a sump tank must be used
  •  Make sure you have  food safe container. To make sure used containers / barrels  are food safe , they should have any of the below markings in the bottom
  • Food safe container markings
    Use a HDPE sheet inside the container if you are not sure your container is food safe

Tools required::

  • Drill
  • Hack saw
  • 1″ Hole saw
  • .3″ drill bit

Howto::

Clean the container and barrel. Wrap the container with HDPE sheet .

Grow bed preparation : Drill a 1″ hole using hole saw in the bottom on the Growbed barrel

1" hole on barrel for siphon
1″ hole on barrel for siphon


Tank adapter :
Connect the tank adaptor on the drilled hole, make sure the adaptor has valves that will seal the hole ( seals not in image )

Tank adaptor

Stand Pipe: Measure the depth of the grow bed and cut the 3/4″ standpipe so that it stays 2 inches below the surface. This is to prevent the water from reaching the surface of the growbed ( to prevent algae growth ). In my case growbed is 9 inch deep. the top of standpipe when connected to the tank adaptor is 7 inches from the bottom

Stand pipe
7″ Stand pipe

Bell siphon: Cut 1 1/2″ pipe with length 9 inches for bell siphon and connect the cap  to one end. The cap should be air tight, use PVC solvent to fix it.  Other end of the  pipe should have slits to allow water in. When placed on top of standpipe the bottom of the cap should be on level with standpipe

Bell Siphon
Bell Siphon

Growbed Outlet:  Used 2 3/4″ pipe with length 7+ inches and elbow joint as growbed outlet. You should have enough outlet pipe length as this will help in starting the Autosiphon.

Growbed outlet
Growbed outlet

Pump and inlet :Submersible pump with 1100L/H output is used for the cycling water. Garden hose connected to the pump is used as inlet to the growbed.  The whole setup assembled together is looking as below.

Growbed
Growbed
Fish container tank
Fish container tank

Testing : Switch on the pump , water should start flowing into the growbed . Once the water level reaches near to Siphon cap the water will drain back into the fish container . Water flow should stop when it reaches the slits of the Siphon.

Let the system continue on its flood and drain cycle, check the joints and make sure there is no leaks.

References:: 

Aquaponic Gardening Rules of Thumb

Plastic Containers as Planters: Safe or Not?

Agri IoT :: Prototype 2 : Gateway & Controller

Overview::

With prototype 2 of Agri IoT, attempt is to proceed further by adding persistence to the OpenHab2 controller, charting of sensor data is also done. Mysensors v2.0 API is used to build and connect the blocks.  Prototype 2 gateway and controller is covered in this article, check out Agri IoT :: Prototype 2 : Overview & Sensor 

Prototype 1 is covered in below articles,

  1. Agri IoT :: Prototype 1 : Overview
  2. Agri IoT :: Prototype 1 : Sensor
  3. Agri IoT :: Prototype 1 : Gateway
  4. Agri IoT :: Prototype 1 : Controller

Objective ::

  • No changes in gateway same as on prototype 1
  • Controller should be able to store the sensor data
  • Controller will be plotting the data in charts.

Components::

  • PC running Debian Jessie
  • NodeMUC
  • NRF240L+

Howto::

Openhab2 installation  will be configured to have a persistent storage and sitemap/items configuration will be modified to show charts.

  • Install influxdb persistance

Access http://<controller_ip>:8080/paperui/index.html#/extensions under Persistence  >> InfluxDB (v 1.0) Persistence >> Install

Make sure the installation is properly done with

# ssh openhab@localhost -p 8101
Default pass : habopen

openhab> log:tail

  • install influxdb and setup a database


# curl -sL https://repos.influxdata.com/influxdb.key | apt-key add -
# source /etc/os-release
# test $VERSION_ID = "8" && echo "deb https://repos.influxdata.com/debian jessie stable" | tee /etc/apt/sources.list.d/influxdb.list
# apt-get update && sudo apt-get install influxdb
# systemctl start influxdb
# sudo systemctl enable influxdb

$ influx
Connected to http://localhost:8086 version 0.13
InfluxDB shell version: 0.13
> CREATE DATABASE openhab_db
> CREATE USER admin WITH PASSWORD 'new_admin_pass' WITH ALL PRIVILEGES
> CREATE USER openhab WITH PASSWORD 'new_hab_pass'
> GRANT ALL ON openhab_db TO openhab
> exit
  • Configure influxdb

Influxdb should be configured as below. Below configuration logs all sensor data into a database called openhab_db that was created on previous step

Enable http auth

# vi /etc/influxdb/influxdb.conf

[http] enabled = true
bind-address = “:8086” # change to a specific interface if needed
auth-enabled = true # will enforce authentication

# cat /etc/openhab2/persistence/influxdb.persist

Strategies {
   everyHour : "0 0 * * * ?"
}
Items {
 * : strategy =  everyChange, everyHour
}

# cat /etc/openhab2/services/influxdb.cfg

# The database URL, e.g. http://127.0.0.1:8086 or https://127.0.0.1:8084 .
# Defaults to: http://127.0.0.1:8086
url=http://<controller_ip>:8086

# The name of the database user, e.g. openhab.
# Defaults to: openhab
user=openhab

# The password of the database user.
password=new_hab_pass

# The name of the database, e.g. openhab.
# Defaults to: openhab
db=openhab_db

# The retention policy to be used, needs to configured in InfluxDB
# Till v0.13: 'default', since v1.0: 'autogen'
retentionPolicy=autogen
  • Configure multiple sensors and charts

Below item and sitemap configuration is done to show data collected from multiple sensors on the sensor node. 5 charts are also configured.  First chart showing the grouped data with ability to dynamically switch the time period of plotting and rest with hourly data plotted for each sensors.

# cat /etc/openhab2/items/agri.items

Group SoilSensors

Number SoilSensors_Period "Viewing interval" <chart>
Number Agri_moist "Moisture [%.1f ]" <grass> (SoilSensors) {mqtt="<[broker:mygateway1-out/1/1/1/0/37:state:default]"}
Number Agri_temp "Temperature [%.1f °C]" <temperature> (SoilSensors) {mqtt="<[broker:mygateway1-out/1/3/1/0/0:state:default]"}
Number Agri_hum "Humidity [%.1f ]" <humidity> (SoilSensors) {mqtt="<[broker:mygateway1-out/1/4/1/0/1:state:default]"}
Number Agri_lux "Illuminance [%.1f lux]" <light> (SoilSensors) {mqtt="<[broker:mygateway1-out/1/2/1/0/23:state:default]"}

# cat /etc/openhab2/sitemaps/agri.sitemap

sitemap demo label="Main Menu"
{
Frame label="Agri Sensor" {
Text item=Agri_moist
Text item=Agri_temp
Text item=Agri_hum
Text item=Agri_lux
Switch item=SoilSensors_Period label="Chart Period" mappings=[0="Hour", 1="Day", 2="Week"]
Chart item=SoilSensors period=h refresh=300 visibility=[SoilSensors_Period==0, SoilSensors_Period=="Uninitialized"]
Chart item=SoilSensors period=D refresh=1800 visibility=[SoilSensors_Period==1]
Chart item=SoilSensors period=W refresh=3600 visibility=[SoilSensors_Period==2]
}
}

You would be able to see the sensor output and plotted graph here

http://:8080/basicui/app?sitemap=agri

Testing & Troubleshooting::

Logs related to openhab2 can be viewed in Karaf console.


# ssh openhab@localhost -p 8101
Default pass : habopen

openhab> logs:tail

References :: 
http://www.homeautomationforgeeks.com/openhab_persistence.shtml
https://community.openhab.org/t/charting-in-oh2/10410
https://community.openhab.org/t/influxdb-grafana-persistence-and-graphing/13761

Agri IoT :: Prototype 2 : Overview & Sensor

Overview::

With prototype 2 of Agri IoT, attempt is to proceed further by creating a sensor node that collects more types of data and last much longer on battery. Pro mini 3,3v 8Mhz is selected because of its small form, low power consumption and NRF24L01+ will work with it on 2 AA batteries. Mysensors v2.0 API is used to build and connect the blocks.  Prototype 2 sensor node setup is covered in this article, rest is in Agri IoT :: Prototype 2 : Gateway & Controller 

Prototype 1 is covered in below articles,

  1. Agri IoT :: Prototype 1 : Overview
  2. Agri IoT :: Prototype 1 : Sensor
  3. Agri IoT :: Prototype 1 : Gateway
  4. Agri IoT :: Prototype 1 : Controller

Objective ::

Sensor node should,

  • Be able to collect the soil moisture data, humidity, temperature and luminescence
  • Send the collected data via RF network to gateway.
  • Be battery operated.

Components ::

  • Arduino pro mini 3.3v 8Mhz
  • NRF24L01+
  • CP2102 USB to TTL Serial
  • Soil Moisture sensor
  • LDR
  • DHT11
  • 10K resistor
  • Copper enameled wire
  • Perforated PCB Board 3 x 2 Inches
  • 2 AA batteries

How to ::

Idea is to power each sensor in the node with one of the Arduino digital out, this would be a first step in the long journey to save power.  Sensors would be powered on data collected and powered off.

Hardware:

Schematics:

multisensor_node_schem
multisensor_node_schem

Quick and dirty pcb setup :

Multi Sensor node
Multi Sensor node

Software:

Connect the arduino via Mini usb cable. Make sure you select the right options as mentioned here

Upload the sketch to sensor node.


#define MY_DEBUG // enabling debug
#define MY_NODE_ID 1 // node id 
#define MY_RADIO_NRF24 // enabling support for NRF radio module
#define CHILD_ID_MOIST 1 // Moisture sensor id
#define CHILD_ID_LIGHT 2 // Light sensor id
#define CHILD_ID_TEMP 3 // Temp sensor id
#define CHILD_ID_HUM 4 // Humidity sensor id
#define MOIST_SENS 2
#define LIGHT_SENS 3
#define HUM_SENS 4
#define VAL_MOIST A0
#define VAL_LIGHT A1
#define DIGITAL_HUM 8
#include <MySensors.h>
#include <SPI.h>
#include <DHT.h>
#define DHTTYPE DHT11 

DHT dht(DIGITAL_HUM,DHTTYPE);
MyMessage msgMoist(CHILD_ID_MOIST, V_LEVEL); // constructing the msg
MyMessage msgLux(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
MyMessage msgHum(CHILD_ID_HUM, V_HUM);
MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);

void setup()
{
 pinMode(MOIST_SENS, OUTPUT);
 pinMode(LIGHT_SENS, OUTPUT);
 pinMode(HUM_SENS, OUTPUT);
 dht.begin();
}

void presentation()
{
 present(CHILD_ID_MOIST, S_MOISTURE); // presenting the sensor 
 present(CHILD_ID_LIGHT, S_LIGHT_LEVEL); 
 present(CHILD_ID_HUM, S_HUM); 
 present(CHILD_ID_TEMP, S_TEMP); 
 sendSketchInfo("SoilSensor", "0.1"); //meta data 
}

void loop()
{
 digitalWrite(MOIST_SENS, HIGH);
 delay(50);
 int moisture = analogRead(VAL_MOIST); //measuring the moisture 
 digitalWrite(MOIST_SENS, LOW); 
 send(msgMoist.set(moisture)); // sending the data 

 digitalWrite(LIGHT_SENS, HIGH);
 delay(50);
 int light = analogRead(VAL_LIGHT); //measuring the moisture 
 digitalWrite(LIGHT_SENS, LOW); 
 send(msgLux.set(light)); // sending the data 
 
 digitalWrite(HUM_SENS, HIGH); 
 delay(1000); // delay to get Humidity sensor ready to read data
 float humidity = dht.readHumidity(); //measuring the humidity 
 float temperature = dht.readTemperature(); //measuring the temperature 
 digitalWrite(HUM_SENS, LOW); 
 send(msgHum.set(humidity,1)); // sending the data 
 send(msgTemp.set(temperature,1)); // sending the data
 
 sleep(300000); // sleeping for 5 minutes
}

Testing & Troubleshooting::

Use Arduino IDE serial monitor and set the baud rate to 115200.  You can find sensor node related debug output there.

Reference :: 
https://www.mysensors.org/build/connect_radio
https://www.mysensors.org/download/
https://www.arduino.cc/en/Main/ArduinoBoardProMini

Agri IoT :: Prototype 1 : Overview

This article is a part of a series that I’m doing to build agriculture based IoT system.

Objectives :: 

Create a remote sensor node that collects and sends data, a gateway that listens to the sensor and posts the data to Controller. The whole setup should be cost effective and at the same time should work to illustrate the concept. The idea is to have a Controller in intranet which can be used as a management platform for sensors deployed in a local area.

Components ::

Sensor node :  Arduino nano with soil sensor and nrf24l01+
Gateway : Nodemuc with nrf24l01+
Controller : Debian pc with OpenHab2 as controller software

Details :: 

Sensor node communicates with Gateway using RF network and Gateway posts the data to controller through local wifi network using MQTT protocol. Controller has a Mosquito broker which assists in communication between Gateway and Openhab2 software.

References :: 

OpenHAB, MQTT, Arduino and ESP8266: Part 1 – Setting up your environment

DIY Smart Home Sensors with Arduino, MySensors and OpenHAB


https://www.mysensors.org/build/

Agri IoT :: Prototype 1 : Sensor

This article is a part of a series that I’m doing to build agriculture based IoT system.

Objective ::

Sensor node should,

  • Be able to collect the soil moisture data.
  • Send the collected data via RF network to gateway.
  • Be battery operated.

Components ::

  • Arduino nano
  • Mini B usb cable
  • NRF24L01+
  • Soil Moisture sensor
  • Jumper wires
  • Breadboard

How to ::

Hardware:

Connection between Arduino nano and radio module ( NRF24L01+ ) should be done as suggested here .

Arduino NRF24L01+
GND GND
5VReg
3.3V
VCC
9 CE
10 CSN/CS
13 SCK
11 MOSI
12 MISO
2 IRQ

Connect soil moisture Analog pin to the A0 pin of Arduino, tt can be powered with the  Arduino 5V pin

Arduino Soil Sensor
GND GND
5V VCC
A0 A0 ( pin at the opposite end of VCC)

Arduino nano  can be powered with  7v to 12v . I’m using a 9V 6F22 battery

Arduino Battery
VIN Positive terminal
GND Negative terminal

Quick and dirty breadboard setup :

Software:

Connect the arduino via Mini usb cable. Make sure you select the right options as mentioned here

Upload the below sketch to sensor node.


#define MY_NODE_ID 1 // node id
#define MY_RADIO_NRF24 // enabling support for NRF radio module
#define MY_DEBUG // enabling debug
#define NODE_ID 1 // sensor id
#include <MySensors.h>
#include <SPI.h>
MyMessage msg(NODE_ID, V_LEVEL); // constructing the msg

const int VAL_PROBE = 0; // initializing the moisture variable

void presentation()
{
present(NODE_ID, S_MOISTURE); // presenting the sensor
sendSketchInfo("SoilSensor", "0.1"); //meta data
}

void loop()
{
int moisture = analogRead(VAL_PROBE); //measuring the moisture
send(msg.set(moisture)); // sending the data
sleep(10000); // sleeping for 10 sec
}

Testing & Troubleshooting::

Use Arduino IDE serial monitor and set the baud rate to 115200. You can find sensor node related debug output there.

Reference :: 
https://www.mysensors.org/build/connect_radio
https://www.mysensors.org/download/
https://www.arduino.cc/en/Main/ArduinoBoardNano