Instructables - Lettuce For Life - Arduino 101 Based .

Transcription

Lettuce For Life - Arduino 101 Based Automated controller for Hydroponics,Aeroponics, Aquaponics, Etc. Intel Curieby evandromiami on April 23, 2016Table of ContentsLettuce For Life - Arduino 101 Based Automated controller for Hydroponics, Aeroponics, Aquaponics, Etc. Intel Curie . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1Intro: Lettuce For Life - Arduino 101 Based Automated controller for Hydroponics, Aeroponics, Aquaponics, Etc. Intel Curie . . . . . . . . . . . . . . . . . . . . . . . . . . .2Step 1: Setting up the location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3Step 2: Setting Up the Hydroponic Bucket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5Step 3: Setting Up the Aeroponic Bucket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7Step 4: Growing Letuce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9Step 5: Setting Up Arduino 101 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Step 6: Solid State Relay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17Step 7: Light Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Step 8: Temperature and Humidity Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24Step 9: OLED Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28Step 10: Water Level Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Step 11: PH Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35Step 12: Bluetooth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36Step 13: Main Loop () - All sensors together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Step 14: Building the Device - Bottom Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Step 15: Building the Device - Top Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44Step 16: Building the Device - External Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51Step 17: Thank you! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -Arduino-101-Based-Automated-Contr/

Intro: Lettuce For Life - Arduino 101 Based Automated controller for Hydroponics, Aeroponics, Aquaponics, Etc. IntelCurieSUMMARYA 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 displaynotification 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 leastexperienced user can grow lettuce with minimal maintenance required.AUDIANCEThis instructable was put together to help:A tech/computer person who is interested in growing plants in water(Myself)A traditional gardener(soil) interested in converting their crops to DWC(Deep Water Culture)A DWC person interested in automating the processAn agricultural/farming person that wants to implement new technology into their cropsLast but not least, the Curious George pesronINSPIRATIONAL VIDEOSBackyard aeroponics: self-sustaining farm for WisconsinHydroponics vs Aeroponics vs SoilBACKGROUNDI do not have a garden.I do not have experience with growing plants. I'm just a computer geek that decided to quickly grow plants without soil inside my apartment. Whatinspired me to start growing plants was the idea of regrowing lettuce. After learning about Deep Water Culture, I decided to start this project because I found a lot ofinformation on the topic, but there was not a lot about automating the system.GROWING PLANTSI decided to use 5 Gallons buckets to setup a Hydroponics and a Aeroponics system that will be controlled by the Arduino device. I will show you how to build both aswell, but if you already have a system that is missing automation, you could skip those stepsDEVICE DESIGNThe design has been inspired by power strip packet sniffer article from lifehack.com. I have chosen to use the same powerstip. Here is the Amazon Link to the exactpowerstrip used. This one should work as well. You do not have to follow this design, I will give you an optional version of it during this instructable that does not requireyou to tamper a powerstrip and will be a better option for those who do not know much about electricity. Quick warn: AC current can kill you. I would not recommendanybody to follow a tutorial on the internet that deals with AC current if they do not have basic understanding of AC electrical.TECHNOLOGYFor this project I chose a 30 Arduino 101 because it comes with a tiny, low-power Intel Curie module, a built-in Real Time Clock(necessary for timer), and built-inBluetooth. 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 sensor/component per step page,and then a step page just for the master code that will pull information from each sensor every 5 seconds.Here is a list of all sensors/components used were:Intel Arduino 101 - Amazon LinkOLED LCD Screen - Amazon LinkSolid State Relay - Amazon LinkHumidity and Temperature Sensor - Amazon LinkLight Sensor - Amazon LinkWater level sensor - Amazon LinkWith no further dues, lets get Life-Arduino-101-Based-Automated-Contr/

Step 1: Setting up the locationINSTRUCTIONSBecause I have a small apartment, I chose to setup inside the A/C closet. Make sure of the following when choosing a location for your project:Temperature will not change dramatically.Power Outlet close by, but not too close where it could get wet from splashes.A place to clamp the lightA way to close the area so that the light will not be everywhereSome shade space, for plant nourishing.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.Reds are needed for Chlorophyll A, (used in photosynthesis)Blues are needed for Chlorophyll BTHE SHOPPING LISTFull spectrum Light Bulb with heat-sink - Amazon linkLight Clamp - Amazon fe-Arduino-101-Based-Automated-Contr/

Image ife-Arduino-101-Based-Automated-Contr/

1. BAD! Do not place outdoor existing soil plants together with Hydroponic plantsbecause you may be bringing in outside bugsImage Notes1. Aluminum FoilStep 2: Setting Up the Hydroponic BucketWHAT 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 mineralsolution and oxygen is delivered to the roots via a air stone inside the water. In Hydroponics,INSTRUCTIONSIn 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 channelair pump and 2 air stones, just put both air stones in the same bucket.The medium used is hydroponics clay pebbles and should not be substitutedDo NOT use RIVER ROCKS because they are not pourus.Do NOT use LAVA ROCKS because they have sharp edges and will damage your rootsI chose to use a 5 Gallon buckets because it's structure is stronger than those Wallmart rectangular flat lid tote, it uses less water, you can move it to cahngewater, easy to clean, and it takes less space.You will need to create an opening on the edge of the bucket to pass the air hose. I know the picture shows the air-holes going through a hole in the actual lid butthat turned out to be inconvenient when I change the waterFill up your bucket with the water going 1 to 2 inches over the bottom of the net cup so it lower clay pebbles are submergedTHE SHOPPING LIST2x 5 Gallon bucketAir Pump 7.8L/min - 2 channels - Amazon link8 ft of flexible air line tubing(cut in half and use 4 ft per channel) - Amazon link2x Small Cylinder Air Stone - Amazon link8 in Wide Bucket Basket - Amazon linkHydroponics Clay Pebbles Grow Media - Amazon LinkORYou may buy a similar pre-made system like the Hyydroponic Deep Water Culture Vegetative System from homedepot.com. This setup ends up beingcheaper/easier, but has lower r-Life-Arduino-101-Based-Automated-Contr/

rduino-101-Based-Automated-Contr/

Step 3: Setting Up the Aeroponic BucketWHAT 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 thanhydroponics because more nutrients and oxygen gets absorbed since plants are 100% in the air.INSTRUCTIONSGet a 5 gallons bucket with a lidDrill openings in the lid with the same size of your netcups. The smaller PVC hole for the water sensorStarting from the waterpump, 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 in the side of the bucket to pass the electrical wireDO NOT make the hole too small because you will damage the electrical cordDO NOT make the hole too big because water will leak. This happend to me and I had to tape some orange foam to stop the leakDepending on your lid, you may need to also create an opening in the inside of the lid if it touches the cordTHE SHOPPING LIST5 Gallon BucketsActive Aqua 400-GPH Submersible Water Pump 6 Foot Cord - Amazon link360 Sprinkler head and Female to Male threaded PVC couplings.Make sure it fits your pump.2 or 3 inches Net fe-Arduino-101-Based-Automated-Contr/

rduino-101-Based-Automated-Contr/

Step 4: Growing LetuceWHY ROMAINE LETTUCE?Lettuce can be easily regrown; it doesn't require you to have a green thumb.Grow fast. Can go from seed to harvest as fast as 30 daysDoesn't require lots of nutrients. Will almost grow on tap water!Doesn't require special light Bulb. Will grow under white daylight lightbulb.Also care2.com compared listed the benefits of romaine vs iceberg lettuce, romaine lettuce has:Less sugarTwice the proteinTwice the calciumThree times the Vitamin KFour times the IronEight times the Vitamin CSeven times the Vitamin AINSTRUCTIONSCut Romaine lettuce about 1 - 2 inches from the bottom. Make a nice salad with the topWith a spoon, scrape off the gunk on bottom of lettuce stemDO 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 dailyGet a sample of tap water and check the ppm and pH. As you can see in picture, my Texas tap water was at 114PPM and had a pH of 8.5Fill up bucket with water until it covers water pump completely, add fertilizer and as a last step, adjust pHpH should be between 6.5PPM should be about 500-700.DO NOT over fertilize lettuce. This is the most common mistake people make, including myself.Once in a while, check your sprinkler head filter(if you have one)BEST CONDITIONS TO GROW LETTUCEIdeal humidity is from 40% to 80%, with 50% being the best for growth.Ideal temperature is 60 F to 70 F during daytime, and 50 F to 60 F at nighttime20 hours of Light, 4 Hours of Darkideal pH is from 6.0 to 7.0ideal cF is 8-12Ideal PPM 560 - 840THE SHOPPING LISTRomaine Lettuce (Organic or Not) - No amazon link, go to the store and buy it Arduino-101-Based-Automated-Contr/

Digital LCD TDS Meter Water Tester- Amazon linkGeneral Hydroponics GH1514 Ph Control Kit - Amazon LinkHydroponic Lettuce Fertilizer 24-15-36 - Amazon LinkImage Notes1. FAIL.This will happen if you remove the outer leafs of the lettuce Life-Arduino-101-Based-Automated-Contr/

Image Notes1. Tap water in Austin, ife-Arduino-101-Based-Automated-Contr/

Image Notes1. Nutrient Water ready for Lettuce2. Nutrient Water ready for Lettuce3. Nutrient Water Ready for Hydroponic Lettuce GrowingImage Notes1. Clean Sprinkler filter once a ife-Arduino-101-Based-Automated-Contr/

Step 5: Setting Up Arduino 101WHAT 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 cableDownload the latest Arduino Software(IDE)Go to http://www.arduino.cc,Navigate to the Download pageChose the Operating system on the right side of the page.Then a donation page will show up before you start the downloadYou can skip it by clicking on "JUST DOWNLOAD" to start downloadInstall 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 installedBy default, Intel Arduino 101 board is not part of the software and needs to be downloaded manuallyOn 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 BoardNow navigate back to Tools - Boards and scroll down to the "Intel Curie(32-bit) Boards" sectionSelect "Arduino/Genuino 101" boardSelect the COM Port for your Arduino platformNavigate to Tools - Portselect the port that has the label "Arduino/Genuino 101"In my case was COM3Last but not least,we need to make sure we have the 3 main Curie libraries.Navigate to Sketch - Libraries - Library ManagerType the word "curie" in the search box.Install "CurieBLT", "CurieIMU", and "CurieTime" if not installed already.SANITY CHECKNow lets upload a quick example to verify that everything is setup or-Life-Arduino-101-Based-Automated-Contr/

Make sure you have the Arduino connected via USBNavigate 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" buttonButton 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)Image Notes1. Must change to Board to Arduino 101Step 6: Solid State RelayWHY 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).NOTESSee image for wiring instruction.DC to 5VDC- to GNDCH1 to Digital Pin 3CH2 to Digital Pin 4If 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 USED5V 2A Channel Solid State Relay Module Board Low Level Trigger With Fuse Stable for Arduino Uno Duemilanove MEGA2560 MEGA1280 ARM DSP PICRaspberry Pi RelayFeatures: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. 5VLow stage (SSR is OFF): 0.5V-2.5V. 2. 5V - 20VHigh state (SSR is ON)THE CODE// RELAY CONTROL FOR PUMP AND LIGHT#define RELAY1 PIN 3 // Digital pin for Light Channel#define RELAY2 PIN 4 // Digital pin for Pump Channel// the setup function runs once when you press reset or power the boardvoid setup() {// initialize digital pin 2 and 3 as an -Life-Arduino-101-Based-Automated-Contr/

pinMode(RELAY1 PIN, OUTPUT);pinMode(RELAY2 PIN, OUTPUT);}// the loop function runs over and over again forevervoid 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 OFFdigitalWrite(RELAY1 PIN, LOW);digitalWrite(RELAY2 PIN, LOW);delay(5*1000); // wait for 5 -Life-Arduino-101-Based-Automated-Contr/

Image Notes1. CH2 -Arduino-101-Based-Automated-Contr/

Image Notes1. CH1 ONFile Downloadsrelay only.ino (1 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'relay only.ino']Step 7: Light SensorWHY LIGHT SENSOR?This sensor can be used to check if plant is getting the light it is suppose to getPerform logic actions like turn light ON/OFF according to luminance valueIf 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 getmore sunlight.NOTESYour results are highly influenced by the light. See images results of a light intensity experiment I performed0Plant has an "internal clock". It counts the amount in light and dark period necessary to satisfy the Calvin CycleKeep Solid State Relay connected to Arduino.This step is built from relay stepSee image for wiringVCC to 5VGND to GNDOut to Analog pin A0Use a Full Spectrum light(mixture of Violet-Blues and Orange-Reds)Reds are needed for Chlorophyll A, used during photosynthesisBlues are needed for Chlorophyll BGreens are reflected by the plantSENSOR USEDPhantom YoYo Arduino compatible Light Sensor - Amazon linkSensor FeaturesCan detect the surrounding luminance or light then output analog valueAnalog Interface.Adjustable Sensitivity.Stable e-for-Life-Arduino-101-Based-Automated-Contr/

Size : 23mm*21mm.Working Voltage: 5VAdopt 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)#include// RELAY CONTROL FOR PUMP AND LIGHT#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// the setup function runs once when you press reset or power the boardvoid setup() {//Initialize Serial to later print LightSensor value on Serial MonitorSerial.begin(9600);// Initialize Relay Pins.pinMode(RELAY1 PIN, OUTPUT); // Currently connected for LightpinMode(RELAY2 PIN, OUTPUT); // Currently connected for Water Pump}// the loop function runs over and over again forevervoid loop() {//Read the Analog Pig connected to LightSensor and save value to Luminance variableuint16 t cur luminance analogRead(LIGHTSENSOR PIN);//Print Luminance Value to Serial MonitorSerial.print("Luminance Value: ");Serial.print(cur luminance,DEC);Serial.print(" ");//Logic that uses luminance value to control relayif (cur luminance 350) {//Turn all Relay channels to HIGHdigitalWrite(RELAY1 PIN, HIGH);digitalWrite(RELAY2 PIN, HIGH);}else {//Turn all Relay channels to LOWdigitalWrite(RELAY1 PIN, LOW);digitalWrite(RELAY2 PIN, LOW);}//Read relay pin state and print to Serial MonitorSerial.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 o-101-Based-Automated-Contr/

const char* On or off(int pin value) {if (pin value 0) {return "OFF";}else if (pin value 1) {return "ON ";}else {return "BAD";}}Image Notes1. Low Light Intensity Experiment.2. Medium Light Intensity Experiment.3. High Light Intensity -for-Life-Arduino-101-Based-Automated-Contr/

Image Notes1. How I Connected Light Sensor and Relay to the Arduino -Arduino-101-Based-Automated-Contr/

File Downloadsrelay light.ino (3 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'relay light.ino']Step 8: Temperature and Humidity SensorWHY 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 settingsPlant can't breath on high humidity settingsIdeal temperature is from 40 F to 90 FThere are cool season crop and warm season crop.Ideal temperature range also tends to change during and and nightLettuce for example:Best specs is 60 F to 70 F during daytime, and 50 F to 60 F at nighttimeNOTESSee image for wiringVCC to 5VGND to GNDDATA to Digital Pin 2Install the DHT LibraryNavigate 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 installThe 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 USEDPhantom YoYo Arduino compatible DHT11 Analog Temperature & Humidity Sensor- Amazon LinkSensor FeaturesCalibrated digital signal output with the temperature and humidity sensorHigh reliability and excellent long-term stability.A high-performance 8-bit microcontroller is for-Life-Arduino-101-Based-Automated-Contr/

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 metersConvenient connection, special packages can be provided according to users need.THE CODE#include#define DHTPIN 2 // what digital pin we're connected to#define DHTTYPE DHT11 // DHT 11DHT 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' (its a 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 ntr/

Serial.println(" *F");}Image Notes1. The resistor in already integrated in the sensor ife-Arduino-101-Based-Automated-Contr/

File DownloadsDHTtester.ino (6 KB)[NOTE: When saving, if you see .tmp as the file ext, rename it to 'DHTtester.ino']Step 9: OLED ScreenWHY OLED LCD SCREEN?Inexpensive way to report variables and show warnings to userEasy to integrateNOTESWiringVCC to 3.3VGND to GNDSCL to SCLSDA to SDAUse I2C scanner to confirm LCD is detected in the I2C bus of Arduino 101, and to get its addressDownload the attached file "MultiSpeedI2CSc

For this project I chose a 30 Arduino 101 because it comes with a tiny, low-power Intel Curie module, a built-in Real Time Clock(necessary for timer), and built-in Bluetooth. There is a