Introduction: Intel® Edison Hands-on Day 8: 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

Step 1: 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

Step 2: Coding

After uploading the sketch, the LCD will show the temperature and humidity, as well as the soil humidity condition.

// Guardian of Eden

#include

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);

}