Introduction: SENSOR SET & TESTING SKETCHES -- for Aquaponic Balcony Garden

Picture of SENSOR SET & TESTING SKETCHES -- for Aquaponic Balcony Garden

BALCONY GARDEN

SENSOR SET and Automation components:

1 - DHT-22 - Humidity and Temperature

2 - DS18B20 - 1 wire Temperature probes (grow-bed and fish tank)

1 - Ultrasonic Module HC-SR04 Distance Sensor for Arduino

1 - Analog Float Switch in Fish Tank for water level tracking

1 - Analog Water Sensing Probe in grow bed for tracking water level and timing of cycles

1 - Master System Kill & Grow Bed Valve Relay - should anything go wrong with the unit

4 - Relay Controlled outlets


BALCONY GARDEN KIT FEATURE SET:
27 gallon fish tank

27 gallon grow bed - this allows for the aquaponic standard of 1:1 ratio of water to grow bed volumes be maintained for a healthy system

DIY Solids Filtration unit - allows for solid wast capture or removal and reuse in system

DIY BIO-REACTOR - converts toxic fish waste to non-toxic plant fertilizer using moving bed media (big system component not found in any small systems)

Overflow Preventer - will not let any water to escape from your grow bed should you encounter a system problem

Root Clogging Preventer Mechanism - this is the problem no one talks about in aquaponics - roots clog everything - unless you plan for the problem

System power down - should a power failure occur Air supply back-up for fish tank - should power failure occur

Plug-N-Play construction of kit Once assembled and cycled easy to maintain.

Starter water - bacteria rich and ready to jump-start your system provided with the kit

Small footprint - big results High percentage of materials can be locally sourced at a big box store and rest at Amazon if you want to do-it-yourself (DIY)

System allows for a high degree of control of the flood and drain cycles depending on what you are growing and environmental demands

Allows for expansion of sensor set and moving to solar back-up option in the future

Unit can be converted to off-grid applications easily - will require a different power configuration of components and equipment

Start code for system on which ever micro-controller platform a person would like to use

aquaponic-IOT device -- Balcony Garden concept:
BALCONY AQUAPONIC GARDEN - IOT READY- DIY materials can be purchased locally at Big Box Stores and amazon.

With all the interest around the world in aquaponics there are a number of creative units being developed for small spaces.

Many if not most of these solution do not address a number of issues that cause these units to end up on Craig's List or in the trash at the end of the day.

None of these solutions even address the automation aspect of aquaponics to take the stress out of operating a small unit effectively at an affordable price point and can be assembled safely by anyone interested in aquaponics.

PROCESS IMPROVEMENTS:
At anytime improvements to this build can be made. These improvements can and will take many different forms. When new tricks are learned or better parts are sourced changes will be made. Updates will be made at aquaponic DIY Automation Blog and the new ideas - parts or changes will be updated in this Instructable. So please send in your ideas and modifications and design changes can and will be made if they are of value to others interested in this project.

VISIT STORE FOR ITEMS TALKED ABOUT HERE:

AGponics Store

BALCONY GARDEN - is featured as a Project in MAKE MAGAZINE - vol 47 starting on page 62

Step 1: DHT-22 -- Digital Humidity and Temperature Sensor

Picture of DHT-22  --  Digital Humidity and Temperature Sensor

The DHT-22 is a very common and standard sensor found in almost all arduino projects. Just do an Google search about if you have no idea what it can do or how to use it.

This Sensor is found in the Double-Leg part of the Balcony Garden. It is housed in the box facing away from the fish tank. A cover plate protects the sensor from the elements but gives easy access to the sensor in the event that the sensor fails at anytime. This easy access allows for the sensor to be replaced if need be.

PLEASE VISIT THIS INSTRUCTABLE FOR CONSTRUCTION OF THE SENSOR:

Stay tuned as content for this section is being developed and will be update as soon as ready for release.

PINS on Sensor:

1. VCC - 5 volt source (red wire)

2. Data - (signal) -- (yellow or white wire)

3. NOT USED

4. Ground (black wire)


DHT-22 SENSOR CONSTRUCTION:

Collect all the parts

A. DHT -22 Sensor

http://www.amazon.com/Vktech-Appliance-Temperature...

B. Connector Housing Receptacle 4 Position 2.54mm Straight Bag

http://www.jameco.com/webapp/wcs/stores/servlet/Pr...

C. Connector Contact Female 1 Position Crimp Straight Cable Mount http://www.jameco.com/webapp/wcs/stores/servlet/Pr...

D. RIBBON 4 WIRE- AWG22

https://www.robotics.org.za/index.php?route=produc...

E. Resistor Carbon Film 10k Ohm 1/4 Watt 5%

http://www.jameco.com/webapp/wcs/stores/servlet/Pr...

F. Magic Sculpt Resin - Tap Plastics --

http://www.tapplastics.com/product/mold_making_mat...

G. Magic Sculpt Hardener- Tap Plastics --

http://www.tapplastics.com/product/mold_making_mat...

ACTION 1:

Cut Resistor using the connector base as a guide.

ACTION 2:

Crimp short resistor end with contact to signal wire (green in this case)

ACTION 3:

Crimp long resistor end to (+) positive (red) wire and connector contact

ACTION 4:

Crimp connector contacts with both White and Black wires.

ACTION 5:

Insert all 4 contacts into connector.

Make sure to match the correct wires with the right probe ends.

ACTION 6:

Mix Magic-Sculpt

Apply at base of the connector where wires inter connector and resistor is located -

Let dry 24 hours

ACTION 7:

Place sensor into connector and then test to insure that the sensor is working correctly and data can be obtained

ACTION 8:

Sensor placement - The best placement of this sensor is in the Double Leg Assembly in the mounted junction box that houses all the


Sensor can now be placed in the Double Leg support behind the Micro-controller housing along with where the terminal connections are made for powering sensors and microcontrollers


CODE TO TEST SENSOR:

// DHT22 Testing Sketch - ladyada
// Example testing sketch for various DHT humidity/temperature sensors

// Written by ladyada, public domain

#include "DHT.h"

#define DHTPIN 9 // what pin we're connected to

// Uncomment whatever type you're using!

//#define DHTTYPE DHT11 // DHT 11

#define DHTTYPE DHT22 // DHT 22 (AM2302)

//#define DHTTYPE DHT21 // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V

// Connect pin 2 of the sensor to whatever your DHTPIN is

// Connect pin 4 (on the right) of the sensor to GROUND

// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

DHT dht(DHTPIN, DHTTYPE);

void setup() {

Serial.begin(115200);

Serial.println("DHTxx test!");

dht.begin();

}

void loop() {

// Reading temperature or humidity takes about 250 milliseconds!

// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)

int h = dht.readHumidity();

int t = dht.readTemperature();

// check if returns are valid, if they are NaN (not a number) then something went wrong!

if (isnan(t) || isnan(h)) {

Serial.println("Failed to read from DHT");

} else {

Serial.print("Humidity: ");

Serial.print(h);

Serial.print(" %\t");

Serial.print("Temperature: ");

Serial.print(t);

Serial.println(" *C");

} }




PROCESS IMPROVEMENTS:
At anytime improvements to this build can be made. These improvements can and will take many different forms. When new tricks are learned or better parts are sourced changes will be made. Updates will be made at aquaponic DIY Automation Blog and the new ideas - parts or changes will be updated in this Instructable. So please send in your ideas and modifications and design changes can and will be made if they are of value to others interested in this project.

VISIT STORE FOR ITEMS TALKED ABOUT HERE:

AGponics Store

BALCONY GARDEN - is featured as a Project in MAKE MAGAZINE - vol 47 starting on page 62

Step 2: DS18B20 - Temperature Probes

Picture of DS18B20 - Temperature Probes

The DS18B20 is a very common and standard sensor found in almost all arduino projects. Just do an Google search about if you have no idea what it can do or how to use it.

This Sensor is found in the Fish Tank and Grow Bed of the Balcony Garden. It is joined in each container using a cable gland that makes the connection watertight. The probes feed into the RJ-45 housing where connections are made that allow the sensors to be passed on to the micro-controller for processing and data display in where in the world (if using the IoT version of this garden).

Make sure you use a 4.7ohm resistor (PULL-UP configuration) with these probes. See directions below and also learn more about this probe at:

DIY Aquaponic Automation Blog


LEVELS OF TESTING:

First level:

First of test is to determine the HEX code of the individual probe. Make sure you write down the HEX giving off by the "Finder" Sketch below. This HEX code will be used in the system wide test for temperature in both the Fish Tank and Grow Ben in latter testing of wires and sensors.

Second Level:

This is a Sketch that will use both HEX code from the first level above. You will need to replace the HEX code in the Sketch with your on HEX code or you will get no readings and be presented with an error when checking for the temperatures in the Fish Tank and Grow Bed.


PLEASE VISIT THIS INSTRUCTABLE FOR CONSTRUCTION OF THE SENSOR:

DS18B2O-Temperature-probe


PINS on Sensor:
1. VCC - 5 volt source (red wire)

2. Data - (signal) -- yellow - white - blue - green - orange wire depends on where you buy them and from whom

3. Ground (black wire)

Collect all the parts
A. Vktech DS18b20 Waterproof Temperature Sensors Temperature Transmitter (5pcs)

http://www.amazon.com/Vktech-DS18b20-Waterproof-Te...

B. PG7 Waterproof Connector Gland Black for 4-7mm Diameter Cable --

http://www.amazon.com/Waterproof-Connector-Gland-B...

ACTION - 1
Using the 27/64-inch Drill Bit -- drill hole on the sensor side of Fish Tank and Grow Bed. See instruction sets for the Fish Tank and Grow Bed for the exact placement of the cable glands.

ACTION - 2

Insert cable gland in to drilled hole in Fish Tank and Grow Bed.

ACTION - 3

Place Cable Gland Nut on outside of Fish Tank and Grow Bed and seal with sealant

VERY IMPORTANT --- TEST -- TEST -- TEST -- TEST

This cannot be stressed enough -- *************

Test sensors when you purchase them

Test sensors after each action to insure the connections are working and the test code returns correct results.

Should the tested sensor not give data output then corrections need to be made before moving forward to next action.

Again TEST - TEST - TEST - will save much time in the long run.



CODE TO TEST SENSOR & DETERMINE HEX CODE OF EACH PROBE:

// DS18B20 - one_wire address finder
// This sketch looks for 1-wire devices and // prints their addresses (serial number) to

// the UART, in a format that is useful in Arduino sketches

// Tutorial:

// http://www.hacktronics.com/Tutorials/arduino-1-wi...

#include

OneWire ds(8); // Connect your 1-wire device to pin 8

void setup(void) {

Serial.begin(115200);

discoverOneWireDevices();

}

void discoverOneWireDevices(void) {

byte i;

byte present = 0;

byte data[12];

byte addr[8];

Serial.print("Looking for 1-Wire devices...\n\r");

while(ds.search(addr)) {

Serial.print("\n\rFound \'1-Wire\' device with address:\n\r");

for( i = 0; i < 8; i++) {

Serial.print("0x");

if (addr[i] < 16) {

Serial.print('0');

}

Serial.print(addr[i], HEX);

if (i < 7) {

Serial.print(", ");

}

}

if ( OneWire::crc8( addr, 7) != addr[7]) {

Serial.print("CRC is not valid!\n");

return;

}

}

Serial.print("\n\r\n\rThat's it.\r\n");

ds.reset_search();

return;

}

void loop(void) {

// nothing to see here }



CODE WILL REPORT OUT TEMPERATURE OF FISH TANK AND GROW BED:

//Balcony Garden Temp Probe Testing - FH/GB
// This Arduino sketch reads DS18B20 "1-Wire" digital // Balcony Unit - IoT - aquaponics -- AGponics.com Temperature Sensors Testing Sketch.

// Ver.05.10.2015

// Tutorial:

// http://www.hacktronics.com/Tutorials/arduino-1-wi...

#include

#include

// Data wire is plugged into pin 3 on the Arduino

#define ONE_WIRE_BUS 8

// Setup a oneWire instance to communicate with any OneWire devices

OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.

DallasTemperature sensors(&oneWire);

// Assign the addresses of your 1-Wire temp sensors.

// See the tutorial on how to obtain these addresses:

// http://www.hacktronics.com/Tutorials/arduino-1-wi...

DeviceAddress Grow_Bed = { 0x28, 0x3A, 0x28, 0x41, 0x05, 0x00, 0x00, 0xA0 };

DeviceAddress Fish_Tank = { 0x28, 0xE9, 0X23, 0x41, 0x05, 0x00, 0x00, 0x4D };

// DeviceAddress Other_If_Needed = { 0x28, 0x59, 0xBE, 0xDF, 0x02, 0x00, 0x00, 0x9F };

void setup(void)

{

// start serial port

Serial.begin(115200);

// Start up the library

sensors.begin();

// set the resolution to 10 bit (good enough?)

sensors.setResolution(Grow_Bed, 10);

sensors.setResolution(Fish_Tank, 10);

//sensors.setResolution(Other_If_Needed, 10);

}

void printTemperature(DeviceAddress deviceAddress)

{

float tempC = sensors.getTempC(deviceAddress);

if (tempC == -127.00) {

Serial.print("Error getting temperature");

} else {

Serial.print("C: ");

Serial.print(tempC);

Serial.print(" F: ");

Serial.print(DallasTemperature::toFahrenheit(tempC));

}

}

void loop(void)

{

delay(2000);

Serial.print("Getting temperatures...\n\r");

sensors.requestTemperatures();

Serial.print("Grow Bed is: ");

printTemperature(Grow_Bed);

Serial.print("\n\r");

Serial.print("Fish Tank temperature is: ");

printTemperature(Fish_Tank);

Serial.print("\n\r");

// Serial.print("Other_If_Needed is: ");

// printTemperature(Other_If_Needed);

// Serial.print("\n\r\n\r"); }


PROCESS IMPROVEMENTS:
At anytime improvements to this build can be made. These improvements can and will take many different forms. When new tricks are learned or better parts are sourced changes will be made. Updates will be made at aquaponic DIY Automation Blog and the new ideas - parts or changes will be updated in this Instructable. So please send in your ideas and modifications and design changes can and will be made if they are of value to others interested in this project.

VISIT STORE FOR ITEMS TALKED ABOUT HERE:

AGponic Store

http://www.agponics.com/agponicsstore/

BALCONY GARDEN - is featured as a Project in MAKE MAGAZINE - vol 47 starting on page 62

Step 3: ULTRA SONIC - DISTANCE SENSOR - Part of Aquaponic BALCONY GARDEN

Picture of ULTRA SONIC - DISTANCE SENSOR - Part of Aquaponic BALCONY GARDEN

The ULTRA SONIC - DISTANCE SENSOR is a very common and standard sensor found in almost all arduino projects of this type. Just do an Google search about if you have no idea what it can do or how to use it.

This Sensor is found in the mounted to the attache lid of the Fish Tank that is covered by the Grow Bed of the Balcony Garden. It is housed in a 2" black ABS pipe positioned above the fish tank. Both ends of the housing can be removed as this gives easy access to the sensor in the event that the sensor fails at anytime. This easy access allows for the sensor to be replaced if need be.

PLEASE VISIT THIS INSTRUCTABLE FOR CONSTRUCTION OF THE SENSOR:
Stay tuned as content for this section is being developed and will be update as soon as ready for release.

PINS on Sensor:

1. VCC - 5 volt source (red wire)

2. TRIGGER - (signal) -- Green / white wire your choice - just make sure you use different color for each PIN

3. ECHO - (singal) -- Blue / White wire your choice - just make sure you use different color for each PIN

4. Ground (black wire)

ULTRA SONIC SENSOR CONSTRUCTION:

COLLECT THE PARTS

A. Charlotte Pipe 2-in x 2-in ABS DWV Pipe

http://www.lowes.com/pd_42368-1814-ABS+03200++1000...

B. Cat-5e Snagless Patch Cable (Black, 3 Feet)

http://www.amazon.com/Belkin-Cat-5e-Snagless-Patch...

C. Ultrasonic Module HC-SR04 Distance Sensor

http://www.amazon.com/SunFounder-Ultrasonic-Distan...

D. Canplas Test Plate, 2 Inch, ABS

http://www.osh.com/Osh-Categories/Plumbing/Rough-P...

E. PG7 Waterproof Connector Gland Black for 4-7mm Diameter Cable

http://www.amazon.com/Waterproof-Connector-Gland-B...

F. Magic Sculpt Resin - Tap Plastics --

http://www.tapplastics.com/product/mold_making_ma...

Magic Sculpt Hardener- Tap Plastics --

http://www.tapplastics.com/product/mold_making_ma...

G. Rubberizeit!™ Dura-Rubber -- 2oz White -- Fish and People TOXIC FREE material

http://www.rubberizeit.com/Product.aspx?ProductID=...

ACTION 1:

Cut Hole for Sensor Housing - Using 2 inch hole saw. Cut hole in the lid top square located directly under the grow bed platform and on side away from the Fish Tank return area.

ACTION 2:

Lay out location holes for Sensor to be inserted into cap end on back side of cap.

ACTION 3:

Drill holes in cap for Sensor placement.

Should look like this when completed:

ACTION 4:

Place Sensor into the un-cupped back side of the cap

Using Magic Sculpt material adhere sensor to cap back - make sure to shape so cap will fit into hole and 2" pipe

Let Dry 24 Hours to insure Magic Sculpt has set completly

ACTION 5:

Insert Sensor Cap Assembly from action 4 above into Fish Tank Lid making sure sensor is facing the inside of the tank.

ACTION 6:

Install PG-7 cable gland in middle of 2 inch pipe

insert CAT5 cable

Use

Brown
Orange

Blue/White

Green/White

wires

ACTION 7:

add single connectors to wire ends

ACTION 8

Connect up the CAT5 wires to the Sensor PINS
GND - Brown

Echo - Blue / White

Trig - Green / White

VCC - Orange

ACTION 9:

Seal back of sensor with Rubberizeit!™
Let dry for 24 hours

ACTION 10

Place top cap in place


CODE TO TEST SENSOR:

// Ultra Sonic Sensor Testing - new ping
// ---------------------------------------------------------------------------

// Example NewPing library sketch that does a ping about 20 times per second.

// ---------------------------------------------------------------------------

#include

#define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor.

#define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic sensor.

#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

void setup() {

Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.

}

void loop() {

delay(50); // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.

unsigned int uS = sonar.ping(); // Send ping, get ping time in microseconds (uS).

Serial.print("Ping: ");

Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance in cm and print result (0 = outside set distance range)

Serial.println("cm");

}

PROCESS IMPROVEMENTS:
At anytime improvements to this build can be made. These improvements can and will take many different forms. When new tricks are learned or better parts are sourced changes will be made. Updates will be made at aquaponic DIY Automation Blog and the new ideas - parts or changes will be updated in this Instructable. So please send in your ideas and modifications and design changes can and will be made if they are of value to others interested in this project.

VISIT STORE FOR ITEMS TALKED ABOUT HERE:
AGponics Store

BALCONY GARDEN - is featured as a Project in MAKE MAGAZINE - vol 47 starting on page 62

Step 4: FLOAT SWITCH - Helps With Water Level in Fish Tanks and Old School Sensor

Picture of FLOAT SWITCH - Helps With Water Level in Fish Tanks and Old School Sensor

The FLOAT SWITCH is not a common or standard sensor found in arduino projects. If you do a Google search you will find very little information on how they operate or how to connect them up in an aquaponics system. This switch is found in the Fish Tank of the Balcony Garden. The switch feeds into the RJ-45 housing where connections are made that allow the switch signal to be passed on to the micro-controller for processing and data display in where in the world (if using the IoT version of this garden).

THINGS TO KNOW ABOUT THE SWITCH:

Make sure you use a 10 ohm resistor with these switches.

These are "ANALOG" read sensors - so be aware of this fact.

The Switch returns only one of two values:

Either 0 or 1023 --

the read depends on how you position the switch in the tank.

IT should be that when at the high level the switch reads 1023.

But it can be reversed if a person want to for some reason.


WIRES on Sensor:

1. YELLOW - 5 volt source (red wire)

2. SIGNAL -- Yellow

Make sure you learn how these operate before connecting these switches in to a system.

Collect all the parts
A. Tank Pool Liquid Level Sensor Right Angle Float Switch

http://www.amazon.com/Liquid-Level-Sensor-Right-S..

ACTION - 1

Drill hole for the Float Switch in the Fish Tank. Depending where the Float Switch is purchased from determines the hole size. Measure the Float Switch purchased to determine the hole size. Not every manufacture uses the same threads.

ACTION - 2

Insert Float Switch into drilled hole making sure the silicon washer is on the inside of the fish tank then screw on the nut on the outside side of fish tank


IMPORTANT --- TEST -- TEST -- TEST -- TEST This cannot be stressed enough --

Test sensors when you purchase them Test sensors after each action to insure the connections are working and the test code returns correct results. Should the tested sensor not give data output then corrections need to be made before moving forward to next action.

Again TEST - TEST - TEST - will save much time in the long run.


CODE TO TESTING THE SWITCH:

// Simple Float Switch Test - Balcony Garden
// Sketch to determine values for FLOAT SENSOR

// FLOAR SENSOR 001 = FS-001

int FS_001 = 0;

int FS_001_val;

void setup()

{

Serial.begin(115200); // open serial port

}

void loop() {

FS_001_val = analogRead(FS_001); // read value from Float Sensor 001

Serial.print("Float Sensor 001 value is: ");

Serial.println(FS_001_val);

delay(1000);

Serial.println(); }


PROCESS IMPROVEMENTS:
At anytime improvements to this build can be made. These improvements can and will take many different forms. When new tricks are learned or better parts are sourced changes will be made. Updates will be made at aquaponic DIY Automation Blog and the new ideas - parts or changes will be updated in this Instructable. So please send in your ideas and modifications and design changes can and will be made if they are of value to others interested in this project.

VISIT STORE FOR ITEMS TALKED ABOUT HERE:

AGponics Store

BALCONY GARDEN - is featured as a Project in MAKE MAGAZINE - vol 47 starting on page 62

Step 5: MEDIA PROBE - SENSORS -- Part of Aquaponic BALCONY GARDEN

Picture of MEDIA PROBE - SENSORS --  Part of Aquaponic BALCONY GARDEN

The MEDIA PROBE is not a common or standard sensor found in any arduino projects. But it is very simple in concept and design. If you do a Google search you will find a lot of information on many different designs of this same concept. So you will get the general idea in short order once you research it a little bit. This Media Probe is found in the Grow Bed of the Balcony Garden.The Media Probe feeds into the RJ-45 housing where connections are made that allow the Media Probe signal to be passed on to the micro-controller for processing and data display in where in the world (if using the IoT version of this garden).


THINGS TO KNOW ABOUT THE MEDIA PROBE:

Make sure you use a 10 ohm resistor with these switches.

This is "ANALOG" read sensor - so be aware of this fact.

The Media Probe returns a range of readings of between 0 and 1023

the read depends on moisture level with in the Grow Bed. When a reading of 1023 is read the Grow Bed water level has totally covered the Media Probe contact points.

Readings of less than 1023 let you know that the moisture within the Grow Bed is less than full in relation to the Media Probe points.

The Media Probe is constructed from to Stainless Steel screws.


WIRES on Sensor:

1. RED - POSITIVE 5 volt source use a (red wire)

2. YELLOW -- SIGNAL -- Make sure you learn how these operate before connecting this probe in to a system.

3 BLACK -GROUND is connected to the Signal wire through a 10 ohm resistor

Collect all the parts
A. #8-32 x 1 -in Pan-Head Stainless Steel Spanner-Drive Standard (SAE) Machine Screws

http://www.lowes.com/pd_162075-37672-3577___?produ...

#8 Stainless Steel Standard (SAE) Nylon Insert Lock Nuts

http://www.lowes.com/pd_455299-37672-829712___?pr...

ACTION - 1

Drill 2 5/32 inch holes for the Media Probe in the Grow Bed

ACTION - 2

Screw #8-32 1 inch Pan Head Screws into #8 Nylon Nuts making sure that the tapered end is on Head of Screw side - flat Nuts goes on inside of Grow Bed.

ACTION - 3

Insert Screw - Nut assembly in to drilled holes

See the instruction set for the Grow Bed for more details regarding the Media Probe for the Grow Bed.


IMPORTANT --- TEST -- TEST -- TEST -- TEST

This cannot be stressed enough --

Test sensors when you purchase them Test sensors after each action to insure the connections are working and the test code returns correct results.

Should the tested sensor not give data output then corrections need to be made before moving forward to next action.

Again TEST - TEST - TEST - will save much time in the long run.


CODE TO TESTING THE SWITCH:

// SIMPLE MEDIA PROBE TESTING SKETCH
// Sketch to determine values for MEDIA PROBE

// MEDIA PROBE = MP

int MP = 0;

int MP_val;

void setup()

{

Serial.begin(115200); // open serial port

}

void loop() {

MP_val = analogRead(MP); // read value from MEDIA PROBES

Serial.print("MEDIA PROBE value is: ");

Serial.println(MP_val);

delay(1000);

Serial.println();

}

PROCESS IMPROVEMENTS:
At anytime improvements to this build can be made. These improvements can and will take many different forms. When new tricks are learned or better parts are sourced changes will be made. Updates will be made at aquaponic DIY Automation Blog and the new ideas - parts or changes will be updated in this Instructable. So please send in your ideas and modifications and design changes can and will be made if they are of value to others interested in this project.

VISIT STORE FOR ITEMS TALKED ABOUT HERE:
AGponics Store

BALCONY GARDEN - is featured as a Project in MAKE MAGAZINE - vol 47 starting on page 62

Step 6: RELAYS -- Control Both the Main Power Supply and Valve on / Off Function

Picture of RELAYS --  Control Both the Main Power Supply and Valve on / Off Function

RELAYS:

Main power supply is controlled by a relay. Power can be turned on and off remotely or the internet or if a system failure is detected.

Grow Bed Valve Control:

Relay controls the function of the valve that controls the filling and draining of the Grow Bed of the Balcony Garden.

STUDY THIS INSTRUCTABLES TO UNDERSTAND RELAYS:

RELAY - understanding how they work


CODE TO TEST 1 Channel RELAY:

/* ===============================================================
RELAY -- 1 CHANNEL RELAY TESTING

Project: 1 Channel 5V Relay Module

Author: Scott C -- Cut up from 4 Channel by Rik Kretzinger for testing

Created: 22th Febuary 2015 - modifed by Rik Kretzinger

Arduino IDE: 1.0.6

Website: http://arduinobasics.blogspot.com.au

Website: for sketch and set-up http://arduinobasics.blogspot.com/2014/09/relay-m...

Description: Explore the difference between NC and NO terminals.

================================================================== *

*

Connect 5V on Arduino to VCC on Relay Module

Connect GND on Arduino to GND on Relay Module

Connect GND on Arduino to the Common Terminal (middle terminal) on Relay Module. */

#define Valve_Relay 2 // Connect Digital Pin 2 on Arduino to Valve Relay on Relay Module

void setup(){

//Setup all the Arduino Pins

pinMode(Valve_Relay, OUTPUT);

delay(2000); //Wait 2 seconds before starting sequence

}

void loop(){

digitalWrite(Valve_Relay, HIGH); //Relay Valve -- ON -- provides power to device -- LED OFF

delay(3000);

digitalWrite(Valve_Relay, LOW); //Relay Valve -- OFF -- cuts power to device -- LED ON

delay(10000);

}

CODE TO TEST 4 Channel RELAY:

// RELAY 4-CHANNEL - 5V MODULE
/* ===============================================================

Project: 4 Channel 5V Relay Module

Author: Scott C - CUT-UP BY RIK KRETZINGER - TOOK OUT LED LIGHTS AND ADD 2 ADDITIONAL REALYS

Created: 7th Sept 2014 - REVISED 2.26.2015

Arduino IDE: 1.0.5

Website: http://arduinobasics.blogspot.com.au

Website: for sketch and set-up http://arduinobasics.blogspot.com/2014/09/relay-m...

Description: Explore the difference between NC and NO terminals.

================================================================== *

*

Connect 5V on Arduino to VCC on Relay Module

Connect GND on Arduino to GND on Relay Module

Connect GND on Arduino to the Common Terminal (middle terminal) on Relay Module. */

#define CH1 4 // Connect Digital Pin 4 on Arduino to CH1 on Relay Module

#define CH2 5 // Connect Digital Pin 5 on Arduino to CH2 on Relay Module

#define CH3 6 // Connect Digital Pin 6 on Arduino to CH3 on Relay Module

#define CH4 7 // Connect Digital Pin 7 on Arduino to CH4 on Relay Module

void setup(){

//Setup all the Arduino Pins

pinMode(CH1, OUTPUT);

pinMode(CH2, OUTPUT);

pinMode(CH3, OUTPUT);

pinMode(CH4, OUTPUT);

//Turn OFF any power to the Relay channels

digitalWrite(CH1,LOW);

digitalWrite(CH2,LOW);

digitalWrite(CH3,LOW);

digitalWrite(CH4,LOW);

delay(2000); //Wait 2 seconds before starting sequence

}

void loop(){

digitalWrite(CH1, HIGH); //Green LED on, Yellow LED off

delay(1000);

digitalWrite(CH1, LOW); //Yellow LED on, Green LED off

delay(1000);

digitalWrite(CH2, HIGH); //Relay 3 switches to NO

delay(1000);

digitalWrite(CH2,LOW); //Relay 3 switches to NC

delay(1000);

digitalWrite(CH3, HIGH); //Green LED on, Yellow LED off

delay(1000);

digitalWrite(CH3, LOW); //Yellow LED on, Green LED off

delay(1000);

digitalWrite(CH4, HIGH); //Green LED on, Yellow LED off

delay(1000);

digitalWrite(CH4, LOW); //Yellow LED on, Green LED off

delay(1000); }

PROCESS IMPROVEMENTS:
At anytime improvements to this build can be made. These improvements can and will take many different forms. When new tricks are learned or better parts are sourced changes will be made. Updates will be made at aquaponic DIY Automation Blog and the new ideas - parts or changes will be updated in this Instructable. So please send in your ideas and modifications and design changes can and will be made if they are of value to others interested in this project.

VISIT STORE FOR ITEMS TALKED ABOUT HERE:

AGponic Store

BALCONY GARDEN - is featured as a Project in MAKE MAGAZINE - vol 47 starting on page 62

Step 7: 4 RELAYS -- Control the Main 4 Outlet Electrical Outlet for the Balcony Garden

Picture of 4 RELAYS --  Control the Main 4 Outlet Electrical Outlet for the Balcony Garden

ELECTRICAL OUTLET:

Main power supply provides the power source for the 4 outlet sockets used to control unit pump, air supply, heater and back-up air supply notification if electric is OFF.

Power can be turned on and off remotely over the internet or if a system.

STUDY THIS INSTRUCTABLES TO UNDERSTAND RELAYS: RELAY:

Controlling Electrical Outlet

PROCESS IMPROVEMENTS:
At anytime improvements to this build can be made. These improvements can and will take many different forms. When new tricks are learned or better parts are sourced changes will be made. Updates will be made at aquaponic DIY Automation Blog and the new ideas - parts or changes will be updated in this Instructable. So please send in your ideas and modifications and design changes can and will be made if they are of value to others interested in this project.

VISIT STORE FOR ITEMS TALKED ABOUT HERE:

AGponics Store

BALCONY GARDEN - is featured as a Project in MAKE MAGAZINE - vol 47 starting on page 62

Step 8: Arduino Shield for Sensor Connections

Picture of Arduino Shield for Sensor Connections

The Arduino sensor shield allows for connection points where all the signal wires for the sensors feed into. This shield serves the purpose of connecting to an Arduino UNO or Arduino YUN. If local control and stand alone unit is the starting point then use a UNO. If the goal is IoT capability then the YUN is the solution. This shield will fit either option that is selected.

Pull together the parts need to complete this section:

A .Arduino ProtoShield prototype expansion board

http://www.amazon.com/Arduino-ProtoShield-prototy...

B. Terminal Block - 2-pin 3.5mm - pack of 5

https://www.adafruit.com/products/724

C. CAT5 wire - any colors will do

Action 1:

Insert Terminal blocks into ProtoShield as shown in photo of shield.

Action 2;

Soldier CAT 5 wire from Terminal configuration to the individual PIN's for both analog and digital PINs

Action 3:

Place and solider placement extenders from the ProtoShield kit that will allow for attachment to either the UNO or YUN.

Make sure to position the Ground connection on the ProtoShield and connect back to the Ground Terminal in the Sensor Junction Box or the sensors will not be able to be read.

PROCESS IMPROVEMENTS:
At anytime improvements to this build can be made. These improvements can and will take many different forms. When new tricks are learned or better parts are sourced changes will be made. Updates will be made at aquaponic DIY Automation Blog and the new ideas - parts or changes will be updated in this Instructable. So please send in your ideas and modifications and design changes can and will be made if they are of value to others interested in this project.

VISIT STORE FOR ITEMS TALKED ABOUT HERE:

AGponics Store

BALCONY GARDEN - is featured as a Project in MAKE MAGAZINE - vol 47 starting on page 62

Comments

About This Instructable

7,030views

140favorites

License:

More by rik:RUNNING Arduino IDE on RPi @ 800 X 480 Resolution800 X 480 - 5" HDMI Display - Using Jessie With Pixel -  Resolution Issueaquaponic BALCONY GARDEN
Add instructable to: