$USD
  • EUR€
  • £GBP
  • $USD
TUTORIALS IoT

Intel® Edison Hands-on Day 8: Guardian of Eden

DFRobot Nov 06 2014 178

Guardian of Eden 
Would you like to provide a comfortable environment for your plants and flowers in your garden? Are they thirsty for the time being? Through a temperature sensor, a soil humidity sensor, and a LCD display, you can easily get the state of your soil.
 
Component Required 


 
 
 
Connection

LCD Keypad Shield for Arduino  →  Plug onto the Intel® Edison with Arduino Breakout Kit
LM35 Analog Linear Temperature Sensor  →  Analog Pin 1  (note the first left connection in the bottom right corner. Analog Pin 0 is occupied by keyboard)
Soil Moisture Sensor  →  Analog Pin 2



 
Coding
 // Guardian of Eden #include <LiquidCrystal.h> LiquidCrystal lcd(8, 9, 4, 5, 6, 7);     // Initiate the LCD display with the numbers of the interface pins int TemperaturePin=A1;      //The pin number of the temperature sensor int HumidityPin=A2;         //The pin number of the humidity sensor void setup() {  lcd.begin(16, 2);  // set up the LCD's number of columns and rows } void loop() {  int temperatureValue;     //store the analog value from temperature sensor  int humidityValue;        //store the analog value from humidity sensor  int temperature;          //store the real temperature.  temperatureValue=analogRead(TemperaturePin);    //read the temperature sensor  humidityValue=analogRead(HumidityPin);          //read the humidity sensor  temperature=(500 * temperatureValue) /1024;     //Convert the analog value to real temperature.  //LCD shows the temperature  lcd.setCursor(0, 0);    // set the cursor to column 0, line 0  lcd.print("T:");  lcd.print(temperature);  lcd.print("C");  //LCD shows the humidity of the soil  lcd.setCursor(0, 6);    // set the cursor to column 6, line 0  lcd.print("H:");  lcd.print(humidityValue);  //Show the situation of the soil  lcd.setCursor(1, 0);    // set the cursor to column 0, line 1  if (humidityValue<300) {    lcd.print("Soil: Dry");  }  else if (humidityValue>=300 && humidityValue<700){    lcd.print("Soil: Humid");  }  else{    lcd.print("Soil: Water")  }  delay(500); }After uploading the sketch, the LCD will show the temperature and humidity, as well as the soil humidity condition. 



2015/8/24 Update::

We find there is a bug with Intel Edison Arduino IDE 1.6.x. The pinMode() won't be defined by this version. So please select V1.5.3 or redefine it again in setup()..
Defination code:
/

 for(int i=4;i<10;i++){
  pinMode(i,OUTPUT);
  } 

/

 

REVIEW