Introduction: Lettuce for Life - Arduino 101 Based Automated Controller for Hydroponics, Aeroponics, Aquaponics, Etc. Intel Curie

SUMMARY

A device that can be used to control up to 4 different Hydroponic/Aeroponic Systems at once. The device will control the components of the system and will display notification to a LCD screen and allow the user to customize settings via Bluetooth. This system will be user friendly and optimized for fast growing so that even the least experienced user can grow lettuce with minimal maintenance required.

AUDIANCE

This instructable was put together to help:

  • A tech/computer person who is interested in growing plants in water(Myself)
  • A traditional gardening(soil) person interested in converting their crops to DWC(Deep Water Culture)
  • A DWC person interested in automating the process
  • An agricultural/farming person that wants to implement new technology into their crops
  • Last but not least, the Curious George

INSPIRATIONAL VIDEOS

Backyard aeroponics: self-sustaining farm for Wisconsin

Hydroponics vs Aeroponics vs Soil

BACKGROUND

I do not have a garden or experience with growing plants. I'm just a computer geek that decided to quickly grow plants without soil inside my apartment. What inspired the lettuce for life project was the idea of regrowing lettuce. After learning about DWC(Deep Water Culture), I decided to start this Instructable because I found lots of information about DWC, but not a lot about the automation of the systems.

GROWING PLANTS

I decided to use 5 Gallons buckets to build a Hydroponic and an Aeroponic system that will be monitored by the Arduino device. I will show you how to build the device and both bucket system. If you have an existing DWC system, you can focus on the automation steps to add some automation to your system.

DEVICE DESIGN

The design has been inspired by power strip packet sniffer article from lifehack.com. Here is the Amazon Link to the exact powerstrip used. This one should work as well. You can come up with your own device design that does not require you to tamper a powerstrip. For example, using a plastic electrical junction box is a better option for those who do not know much about electricity. Quick warning: AC current can kill you. I would not recommend anybody to follow a tutorial on the internet that deals with something that kills, like electricity, if they do not have basic understanding of it.

TECHNOLOGY

For this project, I chose the $30 Arduino 101 board because it comes with a tiny, low-power Intel Curie module with built-in Real Time Clock(necessary for timer), and built-in Bluetooth. There is also a in built-in Gyroscope, but we will not be using it. I will break this Instructables down to the enabling of each component per step page. Finally, a step for the master code that used to pull information from all the sensors every 5 seconds.

Here is a preview list the components used for automation:

With no further dues, lets get stated!

UPDATE: DON'T FORGET TO VOTE FOR LETTUCE FOR LIFE!

Step 1: Setting Up the Location

INSTRUCTIONS

  • To utilize dead space, I chose to setup inside my A/C closet.
  • When choosing a location for your project, keep in mind the following :
    • Temperature should not change dramatically.
    • Power Outlet closeby, but not too close where it could get wet from splashes.
    • A place to clamp the light
    • A way to close the area so that the light will not go everywhere

WHY IS THE LIGHT PINK?

  • The light looks pink because it is a mixture of Violet-Blues and Orange-Reds LEDs.
  • These lamps are commonly known as Full Spectrum Light.

THE SHOPPING LIST

Step 2: Setting Up the Hydroponic Bucket

WHAT IS IT?

  • Hydroponics is a method of growing plants using mineral nutrient solutions, in water, without soil. Terrestrial plants may be grown with their roots in the mineral solution. oxygen is delivered to the roots via a air stone inside the water.

INSTRUCTIONS

  • In this Instructable, I will be using 2 Hydroponics buckets to grow a single plant per bucket. If you wish to use one only, I still recommend buying the two channel air pump and 2 air stones, just put both air stones in the same bucket.
  • The medium used is hydroton (a clay pebbles and should not be substituted). Wash it before use
    • Do NOT use RIVER ROCKS because they are not pourus.
    • Do NOT use LAVA ROCKS because they have sharp edges and will damage your roots
  • I chose to use a 5 Gallon buckets because:
    • It's structure is stronger than those Walmart tote, and uses less water than it
    • Easy to move it around
    • Easy to change water
    • Easy to clean
  • You will need to make a hole on the lid or create an opening on the edge of the bucket to pass the air hose
  • Fill up your bucket with the water going 1 to 2 inches over the bottom of the net cup, so the lower pebbles are submerged
  • As your roots grow past the net cup, the water level should be lowered

THE SHOPPING LIST

Step 3: Setting Up the Aeroponic Bucket

WHAT IS IT?

  • Aeroponics is the process of growing plants in an air by spraying the roots with mineral nutrient solutions without the use of soil. Aeroponics grow faster than hydroponics because more nutrients and oxygen gets absorbed since plants are 100% in the air

INSTRUCTIONS

  • Get a 5 gallons bucket and lid
  • Drill openings in the lid with the same size of your netcups. The smaller PVC hole is for the water sensor
  • Starting from the water-pump, stack a few PVC male to female couplings. This makes it easier for you to adjust the height as your roots grow inside the bucket. Attach the 360° sprinkler head to the end of it.
  • Create a gap on the side of the bucket to pass the pump's electrical wire
    • DO NOT make the hole too small because you will damage the electrical cord
    • DO NOT make the hole too big because water will leak. This happened to me and I had to tape some orange foam to stop the leak
    • Depending on your lid, you may need to also create an opening in the inside of the lid if it touches the cord

THE SHOPPING LIST

  • 5 Gallon Buckets
  • Active Aqua 400-GPH Submersible Water Pump 6 Foot Cord - Amazon link
  • 360° Non-Adjustable Sprinkler Head
  • Threaded Male to Female PVC couplings. Make sure it fits your pump and the sprinkler
  • 2 or 3 inches net cups - Amazon Link
    • 3" works better for regrowing
    • 2" works better for growing for seed

Step 4: Growing Letuce

WHY ROMAINE LETTUCE?

  • Lettuce can be easily regrown; it doesn't require you to have a green thumb
  • Fast Growth. In DWC, lettuce can go from seed to harvest as fast as 30 days
  • Doesn't require lots of nutrients. Will almost grow on tap water!
  • Doesn't require special light bulb. Will grow under white daylight light bulb
  • Also, care2.com compared the benefits of romaine vs iceberg lettuce. Romaine lettuce has:
    • Less sugar
    • Twice the protein
    • Twice the calcium
    • Three times the Vitamin K
    • Four times the Iron
    • Eight times the Vitamin C
    • Seven times the Vitamin A

INSTRUCTIONS

  • Cut Romaine lettuce about 1 - 2 inches from the bottom. Make a nice salad with the top
  • With a spoon, scrape off the gunk on bottom of lettuce stem
  • DO NOT remove outer leafs. Doing so will make your lettuce grow loosely all over the place(see image 3)
  • Lettuce will start regrowing if you simply put it in a plate with 1in water and change the water daily
  • Get a sample of tap water and check the ppm and pH. As you can see in picture
    • Texas tap water was at 114PPM and had a pH of 8.5
  • Fill up bucket with water until it covers water pump completely, adjust pH, and add fertilizer
    • pH should be between 6.5
    • PPM should be about 560 - 840 of nutrients
      • DO NOT over fertilize lettuce. This is the most common mistake people make.
      • Keep nutrient water away from leaves. It can damage leaves by making nutrient burns
    • Fertilizer should have a balance of the following required nutrients for your plant:
      • Primary: Nitrogen(N), phosphorus(P), potassium(K)
      • Secondary: Calcium Nitrate(Ca), Magnesium Sulfate(Mg)
    • There are multiple table for each plant's fertilizer mix values available on the internet
  • Once in a while, check your sprinkler head filter(if you have one)

BEST CONDITIONS TO GROW LETTUCE

  • Ideal humidity is from 40% to 80%, with 50% being the best for growth
  • Ideal temperature is 60°F to 70°F during day time, and 50°F to 60°F at night time
    • if you are using LED lights, raise temperatures by 5°C. LEDs do not radiate heat
  • I had better results with 20 hours of Light, 4 Hours of Dark
  • Ideal PPM 560 - 840
  • ideal pH is from 6.0 to 7.0
  • ideal cF is 8-12

THE SHOPPING LIST

  • Romaine Lettuce - No amazon link, go to the store and buy it =)

Step 5: Setting Up Arduino 101

WHAT IS AN INTEL ARDUINO 101?

  • Arduino 101 is the first widely available development board based on the tiny, low-power Intel Curie module.
  • Easy to use and affordable, Arduino 101 is ideal for education environments, makers and embedded developers.

LETS GET STARTED!

  • Connect the Intel Arduino 101 to your PC with a USB A to B cable
  • Download the latest Arduino Software(IDE)
    • Go to http://www.arduino.cc,
    • Navigate to the Download page
    • Chose the Operating system on the right side of the page.
    • Then a donation page will show up before you start the download
    • You can skip it by clicking on "JUST DOWNLOAD" to start download
  • Install the Arduino Software with all default selected options. If prompted, Install any required drivers as well.
  • Open Arduino Software.
    • A new scketch will pop up with 2 fundamental functions,
      • setup()
      • loop()
    • Remember that this IDE is made in Java so if you have troubles opening the IDE, It may be because your PC does not have Java installed
  • By default, Intel Arduino 101 board is not part of the software and needs to be downloaded manually
    • On the Top Menu Bar, navigate to Tools -> Board -> Board Manager.
    • In the Boards Manager window, search for the word "curie"
      • You should see the "Intel Curie Boards. Arduino/Genuino 101".
    • Click in the install button and wait for the board package to be downloaded.
      • When prompted, click install on any popup in Windows.
  • Select the Arduino 101 Board
    • Now navigate back to Tools -> Boards and scroll down to the "Intel Curie(32-bit) Boards" section
    • Select "Arduino/Genuino 101" board
  • Select the COM Port for your Arduino platform
    • Navigate to Tools -> Port
    • select the port that has the label "Arduino/Genuino 101"
      • In my case was COM3
  • Last but not least,we need to make sure we have the 3 main Curie libraries.
    • Navigate to Sketch -> Libraries - > Library Manager
    • Type the word "curie" in the search box.
    • Install "CurieBLT", "CurieIMU", and "CurieTime" if not installed already.

SANITY CHECK

  • Now lets upload a quick example to verify that everything is setup properly.
    • Make sure you have the Arduino connected via USB
    • Navigate and open to File -> Examples ->01.Basics -> Blink.
      • A new window called Blink will popup with some code.
    • In this window, simply click on the "Upload" button
      • Button located on the top left of the window(looks like an arrow to the right).
    • This will cause the code to compile and upload.
  • If everything is setup correct, you should see a green build-in LED blink on your Arduino board(LED located close to Digital pin 13)

Step 6: Solid State Relay

WHY SOLID STATE RELAY?

  • To control A/C current for water pump and light. The Arduino 101 will trigger power ON/OFF based on a time reference from the build in RTC(real time clock).

NOTES

  • See image for wiring instruction.
    • DC+ to 5V
    • DC- to GND
    • CH1 to Digital Pin 3
    • CH2 to Digital Pin 4
  • If you are new to relay's and A/C current, make sure to read this ARTICLE AND WARNINGS as A/C current could kill you : http://tech.iprock.com/?p=10030.

RELAY USED

  • 5V 2A Channel Solid State Relay Module Board Low Level Trigger With Fuse Stable for Arduino Uno Duemilanove MEGA2560 MEGA1280 ARM DSP PIC Raspberry Pi Relay
    • Features:
      • Use it to control various appliances, and other equipments with large current.
      • It can be controlled directly by Microcontroller (Arduino , Raspberry Pi, 8051, AVR, PIC, DSP, ARM, ARM, MSP430, TTL logic).
    • Specifications:
      • Power supply: 5V DC (160mA)
      • Input control signal voltage: (0-0.5V low stage SSR is OFF) (2.5-20V high stage SSR is ON)
      • SSR Output (each channel): Load voltage range: 75 to 264VAC (50/60Hz).
      • Load current: 0. 1 to 2 AMP.
      • Power supply: 5VDC / 160mA (all channel ON).
      • Input control signal voltage: 0V - 0. 5V
      • Low stage (SSR is OFF): 0.5V-2.5V. 2. 5V - 20V
      • High state (SSR is ON)

THE CODE

// Digital pin for Light
#define RELAY1_PIN 3

// Digital pin for Pump #define RELAY2_PIN 4

// the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 2 and 3 as an output. pinMode(RELAY1_PIN, OUTPUT); pinMode(RELAY2_PIN, OUTPUT); }

// the loop function runs over and over again forever void loop() { // turn the signal to GPIOs pin of Relay 1 to high and Relay 2 to low(HIGH the voltage level) digitalWrite(RELAY1_PIN, HIGH); digitalWrite(RELAY2_PIN, LOW);

delay(2*1000); // wait for 2 second

// turn the signal to GPIOs pin of Relay 2 to high and Relay 1 to low(HIGH the voltage level) digitalWrite(RELAY1_PIN, LOW); digitalWrite(RELAY2_PIN, HIGH);

delay(2*1000); // wait for 2 second

//Turn both relay to OFF digitalWrite(RELAY1_PIN, LOW); digitalWrite(RELAY2_PIN, LOW);

delay(5*1000); // wait for 5 second }

Step 7: Light Sensor

WHY LIGHT SENSOR?

  • This sensor can be used to check if plant is getting the light it is suppose to get
  • Perform logic actions like turn light ON/OFF according to luminance value
  • If you leave your light on 24/7, your plant will have small leaves as they will not lack light. They will not need to grow their leaves to have a bigger area in order get more sunlight.
  • In order to grow, plants need light for photosynthesis and photomorphogenesis


NOTES

  • Your results are highly influenced by the light. See images results of a light intensity experiment I performed
  • Plant has an "internal clock". It counts the amount in light and dark period necessary to satisfy the Calvin Cycle
  • Plants organisms have physiological reaction to the lenght of day or night due to its photoperiodism
  • Keep Solid State Relay connected to Arduino.
    • This step is built from relay step
  • See image for wiring
    • VCC to 5V
    • GND to GND
    • Out to Analog pin A0
  • Use a Full Spectrum light(mixture of Violet-Blues and Orange-Reds)
    • Reds are needed for Chlorophyll A, used during photosynthesis
    • Blues are needed for Chlorophyll B
    • Greens are reflected by the plant

SENSOR USED

Phantom YoYo Arduino compatible Light Sensor - Amazon link

  • Sensor Features
    • Can detect the surrounding luminance or light then output analog value
    • Analog Interface.
    • Adjustable Sensitivity.
    • Stable Performance.
    • Size : 23mm*21mm.
    • Working Voltage: 5V
    • Adopt photoconductive resistance ,
    • Suitable for detecting a wide range of luminance or light.
    • Applicable to a variety of platforms including Arduino / AVR / ARM.

THE CODE (Relay + Light code)

#define RELAY1_PIN 3 // Digital pin for Relay Channel that controls CH1
#define RELAY2_PIN 4 // Digital pin for Relay Channel that controls CH2
#define LIGHTSENSOR_PIN 0 //Analog Pin for Light

void setup() {
     //Initialize Serial to later print LightSensor value on Serial Monitor
     Serial.begin(9600);
     //Initialize Relay Pins.
     pinMode(RELAY1_PIN, OUTPUT); // Currently connected for Light
     pinMode(RELAY2_PIN, OUTPUT); // Currently connected for Water Pump
}

void loop() {
     //Read the Analog Pig connected to LightSensor and save value to Luminance variable
     uint16_t cur_luminance = analogRead(LIGHTSENSOR_PIN);
     
	 //Print Luminance Value to Serial Monitor
     Serial.print("Luminance Value: ");
     Serial.print(cur_luminance,DEC);
     Serial.print(" | ");
     
	 //Logic that uses luminance value to control relay
     if (cur_luminance <=350) {
        //Turn all Relay channels to HIGH
        digitalWrite(RELAY1_PIN, HIGH);
        digitalWrite(RELAY2_PIN, HIGH);
     }
     else {
        //Turn all Relay channels to LOW
        digitalWrite(RELAY1_PIN, LOW);
        digitalWrite(RELAY2_PIN, LOW);
     }
     //Read relay pin state and print to Serial Monitor
     Serial.print("Relay 1 Status: ");
     Serial.print(On_or_off(digitalRead(RELAY1_PIN)));
     Serial.print(" | Relay 2 Status: ");
     int relay2 = Serial.print(On_or_off(digitalRead(RELAY2_PIN)));
     // Sleeps for 2 second
     delay(2*1000);
     Serial.println("\n*******************************************************************************************************");
     }

//Function used to Print ON or OFF instead of 0 or 1
const char* On_or_off(int pin_value) {
     if (pin_value == 0) {
          return "OFF";
     }
     else if (pin_value == 1) {
          return "ON ";
     }
     else {
          return "BAD";
     }
}

Step 8: Temperature and Humidity Sensor

WHY HUMIDITY/TEMPERATURE?

  • The Humidity/Temperature impact varies depending on the plant you are growing. But here is an overall idea:
    • Ideal humidity is from 40% to 80%, with 50% being the best for growth.
      • Plant can't pollinate on low humidity settings
      • Plant can't breath on high humidity settings
    • Ideal temperature is from 40°F to 90°F
      • There are cool season crop and warm season crop.
      • Ideal temperature range also tends to change during and and night
      • Lettuce for example:
        • Best specs is 60°F to 70°F during daytime, and 50°F to 60°F at nighttime

NOTES

  • See image for wiring
    • VCC to 5V
    • GND to GND
    • DATA to Digital Pin 2
  • Install the DHT Library
    • Navigate to Sketch > Include Library > Manage Libraries...
    • Search for the word "DHT"
    • Install "DHT Sensor Library"
    • Close Sketch and re-open it to properly complete library install
  • The attached code works with DHT11, DHT21 and DHT22.
  • If not DHT11, You must change the sensor model your are using in code line "#define DHTTYPE"

SENSOR USED

Phantom YoYo Arduino compatible DHT11 Analog Temperature & Humidity Sensor- Amazon Link

  • Sensor Features

    • Calibrated digital signal output with the temperature and humidity sensor
    • High reliability and excellent long-term stability.
    • A high-performance 8-bit microcontroller is connected.
    • Includes a resistive element and a sense of wet NTC temperature measuring devices.
    • It has excellent quality, fast response, anti-interference ability and high cost performance advantages.
    • The calibration coefficients stored in the OTP program memory, internal sensors detect signals in the process, we should call these calibration coefficients.
    • The single-wire serial interface system is integrated to become quick and easy.
    • Small size, low power, signal transmission distance up to 20 meters
    • Convenient connection, special packages can be provided according to users need.

THE CODE

#include DHT.h> //Due to web tags, I can't include symbol < on this line
#define DHTPIN 2 //What digital pin we're connected to #define DHTTYPE DHT11 //Sensor model DHT dht(DHTPIN, DHTTYPE);

void setup() { Serial.begin(9600); Serial.println("DHTxx test!"); dht.begin(); }

void loop() { // Wait a few seconds between measurements. delay(2000); // Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old'(very slow sensor) float h = dht.readHumidity(); // Read temperature as Celsius (the default) float t = dht.readTemperature(); // Read temperature as Fahrenheit (isFahrenheit = true) float f = dht.readTemperature(true); // Check if any reads failed and exit early (to try again). if (isnan(h) || isnan(t) || isnan(f)) { Serial.println("Failed to read from DHT sensor!"); return; } // Compute heat index in Fahrenheit (the default) float hif = dht.computeHeatIndex(f, h); // Compute heat index in Celsius (isFahreheit = false) float hic = dht.computeHeatIndex(t, h, false); Serial.print("Humidity: "); Serial.print(h); Serial.print(" %\t"); Serial.print("Temperature: "); Serial.print(t); Serial.print(" *C "); Serial.print(f); Serial.print(" *F\t"); Serial.print("Heat index: "); Serial.print(hic); Serial.print(" *C "); Serial.print(hif); Serial.println(" *F"); }

Step 9: OLED Screen

WHY OLED LCD SCREEN?

  • Inexpensive way to report variables and show warnings to user
  • Easy to integrate

NOTES

  • Wiring
    • VCC to 3.3V
    • GND to GND
    • SCL to SCL
    • SDA to SDA
  • Use I2C scanner to confirm LCD is detected in the I2C bus of Arduino 101, and to get its address
    • Download the attached file "MultiSpeedI2CScanner.ino" and open it in Scratch
    • With the LCD wired properly, upload the code to your Intel Arduino
    • Follow the steps in the image
      • Open Serial Monitor
      • Type "s" and press Enter
    • Write down the I2C address that returned true after you scanned(Mine was 0x3C)
  • Download 2 required libraries via Sketch>Included Libraries>Manage Libraries...
    • Adafruit_SSD1306 (driver library. Used to communicate from Arduino to LCD via I2C)
    • Adafruit_GFX (graphical library. Used to easily display text, shapes, animation)
  • Now Restart Sketch and open File > Examples > Adafruit SSD1306 > ssd1306_128x64_i2
  • Save this example as a new file. We need to do the followings changes to it:
    • Change the address in line "display.begin(SSD1306_SWITCHCAPVCC, 0x3D);" to your address(0x3C)
    • If like me, you encounter #error ("Height incorrect, please fix Adafruit_SSD1306.h!")
      • Use Notepad++ to open Arduino > libraries > Adafruit_SSD1306> Adafruit_SSD1306.h
      • Uncomment line: #define SSD1306_128_64
      • Comment line: #define SSD1306_128_32
    • Also the error with the sleep function
      • Change #include to #include
    • And Finally the wrong variable type returned error
      • You will need to cast (force) the variable to return the correct type in line 183,185,193,195
      • PortReg * is type(volatile unsigned char*)
      • portOutputRegister() returned uint32_t*
  • Once you were able to PowerOn and play the Display Library demo on the screen,

CUSTOM LOGO

DISPLAY USED

Diymall 0.96" Inch Yellow and Blue I2c IIC Serial 128x64 Oled LCD Display - Amazon Link

  • Sensor Features
    • Interface:VCC: 3.3-5V. GND: Ground. SCL: Serial Clock. SDA: Serial Data
    • Backlight: OLED self-lit (no backlight)
    • Communication: I2C
    • Driver IC: SSD1306
    • Size: 27mm×27mm×4.1mm
    • Working temperature: –30~80°C
    • Input voltage: 3.3V~5VDC
    • Color: Yellow(top row) and Blue(bottom). These are the actual LED colors and CANNOT be changed
    • Resolution: 128px by 64px
    • Power: 0.04W (low-power mode)
    • Size: 0.96in

Step 10: Water Level Sensor

WHY WATER LEVEL SENSOR?

  • In the Hydroponic/Aquaponics system, this sensor could alert if water level is low
  • In the Aeroponic system, this sensor could be used for:
    • confirm if the pump is ON/OFF
    • trigger water pump ON when the water on it has evaporated

NOTES

  • Waterproofing is required for the top of the sensor as the wires and resistors cannot get wet.
    • You will need:
      • PVC coupling/adapter. The 3/4 slip x 1/2 threaded worked fine after filing the edges of sensor
      • Telephone wire coupling. Connected wires from sensor to telephone coupling as follow:
        • "+" to Phone Jack Pin 1
        • "-" to Phone Jack Pin 2
        • "S" to Phone Jack Pin 3
      • Black silicone calking to make sensor waterproof
  • 2x RJ-11 Keystone Jack. Each jack will use 2 twisted pairs(4 wires)
  • Ethernet Cable. This cable has 4 twisted pairs inside(total of 8 small wires)
  • Telephone cable. 7ft long will work fine.
  • Trace back the phone jack wires 1, 2, 3 and connect them to your Arduino as follow
    • Phone Jack Pin 1 to 5V
    • Phone Jack Pin 2 to GND
    • Phone Jack Pin 3 to Analog Pin A1

SENSOR USED

Phantom YoYo High Sensitivity Water Sensor - Amazon Link

  • Sensor Features:
    • Water sensor brick is designed for water detection, which can be widely used in sensing the rainfall, water level, even the liquate leakage. The brick is mainly comprised of three parts: An Electronic brick connector, a 1 MΩ resistor, and several lines of bare conducting wires.
    • This sensor works by having a series of exposed traces connected to ground and interlaced between the grounded traces are the sens traces. The sensor traces have a weak pull-up resistor of 1 MΩ. The resistor will pull the sensor trace value high until a drop of water shorts the sensor trace to the grounded trace. Believe it or not this circuit will work with the digital I/O pins of your Arduino or you can use it with the analog pins to detect the amount of water induced contact between the grounded and sensor traces.
    • This item can judge the water level through with a series of exposed parallel wires stitch to measure the water droplet/water size .
    • This item can easily change the water size to analog signal, and output analog value can directly be used in the program function, then to achieve the function of water level alarm.
    • This item have low power consumption, and high sensitivity, which are the biggest characteristics of this mdoule.
    • This item can be compatible with Arduino UNO、Arduino mega2560、Arduino ADK etc.
    • Pin definition :
      • "S" stand for signal input
      • "+" stand for power supply
      • "-" stand for GND

THE CODE

// Analog Pin Connected to Sensor
int sensorPin = 1; // select the pin for the LED, or use 13 for internal LED int ledPin = 13; // variable to store the value coming from the sensor int sensorValue = 0;

void setup() { Serial.begin(9600); Serial.println("Analog input read"); }

void loop() { // read the value from the sensor sensorValue = analogRead(sensorPin); // print value Serial.print("Water sensor: "); Serial.print(sensorValue); Serial.println("V"); delay(2000); }

Step 11: PH Sensor

WHY CHECK pH?

SENSOR USED

  • Option 2 - Digital Sensor with Probe - $150.00
    • Atlas Scientific pH Development Kit for Arduino - Full Range pH Readings from .001 to 14.000 - Accurate to .02 - Includes Scientific Grade pH Probe, (4) 250ml ph Solution Bottles pH, (1) EZO pH Circuit, and (1) Pre-Assembled Female BNC Connector
    • http://www.amazon.com/Atlas-Scientific-pH-Developm...
  • I just want to point out that there is a automatic solution and its a lot more pricey

SETUPING UP OPTION 2

  • Please be aware the the probe cannot dry. This will damage it and you cannot return a dry pH probe, saying that it is not working. However, there are ways to fix a dry pH probe.

Lucky, Atlas did an awesome job putting together a pH kit and the documentation is the best way to go. I have attached the pdf documents I used to get started

THE CODE

#include <SoftwareSerial //Because of this editor, I removed the ">". Make sure to add it back to close the tag
#define rx 2
#define tx 3
SoftwareSerial myserial(rx, tx);
String inputstring = "";
String sensorstring = "";
boolean input_stringcomplete = false;
boolean sensor_stringcomplete = false;
float ph;

void setup() {
Serial.begin(9600); myserial.begin(9600); inputstring.reserve(10); sensorstring.reserve(30); }

void serialEvent() { char inchar = (char)Serial.read(); inputstring += inchar; if (inchar == '\r') { input_stringcomplete = true; } }

void loop() { if (input_stringcomplete) { myserial.print(inputstring); inputstring = ""; input_stringcomplete = false; } if (myserial.available() > 0) { char inchar = (char)myserial.read(); sensorstring += inchar; if (inchar == '\r') { sensor_stringcomplete = true; } } if (sensor_stringcomplete) { Serial.println(sensorstring); sensorstring = ""; sensor_stringcomplete = false; } }

Step 12: Bluetooth

WHY BLUETOOTH?

  • To change timer values
  • To read sensor values

BLE APP REQUIRED

nRF Master Control Panel (BLE) for

  1. Android
  2. iOS

NOTES

  • We will be using BLE, the latest Bluetooth technology available.
  • Get a mobile phone. Iphone 4s and above, or any Android with BLE
  • Download the App " "
  • Different from regular bluetooth, BLE works more like a Display Board. There are tons of documentations on the Arduino about this technology
  • If this is your first time using BLE, I suggest starting with the LED Blink example that comes with CurieBLE library

SENSOR USED

  • None
    • Intel Arduino 101 has BLE built-in

THE CODE

See Attachment


Step 13: Main Loop () - All Sensors Together

FILE

  • See attachment called "lettuce_main.ino" for the master Arduino code using all sensors in the main loop

PROJECT ARCHIEVE

  • See attachment called "PROJ Make2016ArduinoLettuce.zip" for an archieve including all project files and libraries.
  • Extract it on your pc (eg.. "Documents\LettuceForLife") and point the Arduino Software to use it

GITHUB

Step 14: Building the Device - Bottom Part

    INSTRUCTIONS

    • Open Power Strip. You will need a triangular screw driver tip for that.
    • Remove current power surge board and Coax/phone connector boards
    • Remove Phone and Coax boards and break the plastic pieces by it
    • Grind off the the plastic squares of the first set of outlets, as they willl not be used.
    • Trim off the metal inserts for the plug. Keep the metal trims from power rail because you will need it later
    • Connect the metal rails as follow to generate 2 separate power channels
      • Connect all Neutral rails together by soldering white cables(Neutral) coming into the power strip to left Neutral rail. Connect a bridge wire from left Neutral rail to the middle Neutral rail, and then another wire from middle to right Neutral rail
      • Connect all Ground rails together by soldering green cable(Ground) coming into the power strip to middle ground rail and bridging from it to the other 2 on ground rails on the sides
      • The black wire(Load) coming into the power strip has to be split into 2 and each wire connected into the a relay channel.
        • Connect a wire from relay Ch1 to the left Load rail. Connect a bridge wire from the left rail to the right rail
        • Connect a second wire from relay Ch 2 to the center Load rail
    • Connect a USB adapter to power the Arduino
      • This step will use the metal trims saved from previous step
      • I used an iPhone USB Power apter. Unfortunately, the plastic had to be melted down to make it fit.
      • Solder a the metal trim after the entrance of the Load wire, without actually cutting the wire.
      • Solder a the metal trim after the entrance of the Neutral wire, without actually cutting the wire.
    • Get a Half Foot USB A to USB B cable(6 inches) for your Arduino board and USB Power Adapter
    • Place adapter plug in the corner, with screw plastic column in between each of the plugs
    • Connect plug to electrical wire and tape each end with electrical tape
    • Use double sided tape to glue down the adapter to bottom of power strip
    • Attach USB cable to adapter and tape it in place as shown in the pictures
    • Use a multi-meter to verify each current path to avoid any electrical shorts
    • NEVER plug power strip into wall with it open

    Step 15: Building the Device - Top Part

    INSTRUCTIONS

    • Remove power switch
    • Break plastic pieces of the first set of outlets as they are not used
    • LCD
      • Mark LCD screw locations
      • Using #2 x 3/8 screws, Attach the OLED display to cover the power switch hole
      • Tape the LCD and first 3 plug holes with blue tape
      • Fill holes with Black Silicone Calking
      • Remove tape, fix any imperfections and let it dry(took about 2 days)
    • Sensors
      • To make better connection, solder jumper wires to the end of each wire of Ethernet cable
      • Carefully remove the top plastic piece from the end of the lid to have more space to work
      • Using a knife, open one of the coax round hole to fit the BNC connector through it
      • Using fire, melt open the phone jack spot to fit the phone jack connectors
      • Screw the outside nut of the BNC connector to hold it in place. Make sure board is flat down
      • Tape the Ethernet cable around the inside edge of the lid running to the Arduino area
      • Place both phone jacks in place and use screws to hold it in place
      • Cover the extra round hole with black Silicone
      • Tape the Atlas pH sensor close to the BNC board and connect the cables to it
      • Tape a cable with 4 wires to the other edge and run it from the 4 pins of pH sensor to the Arduino

    Step 16: Building the Device - External Sensor

    INSTRUCTION

    • Get the following items
      • Something plane to mount sensors. I am using a small piece of white baseboard.
      • Surface Mount Telephone Jack
      • Double Sided Tape. Came with phone jack
    • Screw down phone jack to baseboard
    • Cut 2 sets of 3 jumper wires to go from sensor to phone jack
    • Connect the VCC from both sensors to phone jack Pin 1
    • Connect the GND from both sensors to phone jack Pin 2
    • Connect the logic signal pin of Light Sensor to phone jack Pin 3
    • Connect the logic signal pin of DHT Sensor to phone jack Pin 4
    • Use a phone wire to connect from Lettuce for Life device to sensor block.
      • Be careful with wiring as wires inside cable can be crossed

    Step 17: Thank You!

    OUTCOME

    Hydroponics/Aeroponics works as people says. It is hard to get started because of the many factors to be aware of. Once you have everything setup correctly, DWC is very enjoyable

    I am still far away from regrowing lettuce to the point where you can eat it. I did plant lettuce from seed on dirt and hydroponically on a Gold Peak plastic bottle using the Kratky Method. I'm still not sure if re-growing lettuce can be do.

    TOMATOES

    DWC became my new hobby. I moved away on from re-growing lettuce and now I enjoy growing tomatoes hydroponically on my balcony. I started growing them in from seeds and I saw the first tomato flower yesterday. Also, I was able to clone a tomato sucker in the aeroponics bucket!

    FINISHED

    • Hope you enjoyed
      • Please
        • share
        • comment
        • talk about it
        • use it
        • modify it
        • ask questions
    • If you have experience with gardening, hydroponic, biology....
      • Feel free to give tips on how make system grow plants faster
    • if you have experience with Arduino, Sensors, Programing....
      • Feel free to give tips on how make system smarter, better, cheaper