Treemo The Emotion Tree

Overview:

TREEMO can detect soil moisture with sensor. You can display tree’s emotion by this device.
With the ESP8266 (WIFI dev. kit) you can make your own IoT (internet of things) projects with TREEMO.

Circuit Diagram

Components

Screws for assembly

to hold the electronic components to the body of treemo. 


#include "LedControl.h" 
#include "binary.h" 

const int AirValue = 1025;   //you need to replace this value with Value_1
const int WaterValue = 350;  //you need to replace this value with Value_2
int intervals = (AirValue - WaterValue)/3;   
int soilMoistureValue = 0;
String wet = "";

int DIN =  D0;

int CS =   D1;

int CLK =  D2;
LedControl lc0=LedControl(DIN,CLK,CS,0);
void setup() {
  Serial.begin(115200);
  int deviceA=lc0.getDeviceCount(); 
 //we have to init all devices in a loop 
 for(int addressA=0;addressA<deviceA;addressA++) 
 { 
 /*The MAX72XX is in power-saving mode on startup*/ 
 lc0.shutdown(addressA,false); 
 /* Set the brightness to a medium value (1-15) */ 
 lc0.setIntensity(addressA,15); 
 /* and clear the display */ 
 lc0.clearDisplay(addressA); 
 } 
} 


void loop() {

  soilMoistureValue = analogRead(A0);
  Serial.println(soilMoistureValue);
  if(soilMoistureValue > WaterValue && soilMoistureValue < (WaterValue + intervals))
  {
    lc0.setLed(0,0,7,false);   
    lc0.setLed(0,1,6,false); 
    lc0.setLed(0,2,7,false); 
    lc0.setLed(0,5,7,false); 
    lc0.setLed(0,6,6,false); 
    lc0.setLed(0,7,7,false);
    
    lc0.setLed(0,0,6,true);   
    lc0.setLed(0,1,7,true); 
    lc0.setLed(0,2,6,true); 
    lc0.setLed(0,5,6,true); 
    lc0.setLed(0,6,7,true); 
    lc0.setLed(0,7,6,true);
  
    Serial.println("Very Wet");
    lc0.setLed(0,1,3,true);   
    lc0.setLed(0,2,2,true);   
    lc0.setLed(0,3,2,true);   
    lc0.setLed(0,4,2,true);   
    lc0.setLed(0,5,2,true);   
    lc0.setLed(0,6,3,true); 
    delay(500); 
    
    lc0Clear();
    delay(100);
    
    lc0.setLed(0,2,3,true); 
    lc0.setLed(0,2,2,true); 
    lc0.setLed(0,3,3,true); 
    lc0.setLed(0,3,1,true); 
    lc0.setLed(0,4,3,true); 
    lc0.setLed(0,4,1,true); 
    lc0.setLed(0,5,3,true); 
    lc0.setLed(0,5,2,true); 
    delay(500);
    
    lc0Clear(); 
    delay(100);
  }
  else if(soilMoistureValue > (WaterValue + intervals) && soilMoistureValue < (AirValue - intervals))
  {
    lc0.setLed(0,0,7,false);   
    lc0.setLed(0,1,6,false); 
    lc0.setLed(0,2,7,false); 
    lc0.setLed(0,5,7,false); 
    lc0.setLed(0,6,6,false); 
    lc0.setLed(0,7,7,false);
    
    lc0.setLed(0,0,6,true);   
    lc0.setLed(0,1,7,true); 
    lc0.setLed(0,2,6,true); 
    lc0.setLed(0,5,6,true); 
    lc0.setLed(0,6,7,true); 
    lc0.setLed(0,7,6,true);
    
    lc0Clear();
    Serial.println("Wet");
    lc0.setLed(0,1,3,true);   
    lc0.setLed(0,2,2,true);   
    lc0.setLed(0,3,2,true);   
    lc0.setLed(0,4,2,true);   
    lc0.setLed(0,5,2,true);   
    lc0.setLed(0,6,3,true); 
  }
  else if(soilMoistureValue < AirValue && soilMoistureValue > (AirValue - intervals))
  {
    lc0.setLed(0,0,6,false);   
    lc0.setLed(0,1,7,false); 
    lc0.setLed(0,2,6,false); 
    lc0.setLed(0,5,6,false); 
    lc0.setLed(0,6,7,false); 
    lc0.setLed(0,7,6,false);

    lc0.setLed(0,0,7,true);   
    lc0.setLed(0,1,6,true); 
    lc0.setLed(0,2,7,true); 
    lc0.setLed(0,5,7,true); 
    lc0.setLed(0,6,6,true); 
    lc0.setLed(0,7,7,true);
    lc0Clear();
    Serial.println("Dry");
//    sad 
    lc0.setLed(0,1,2,true);   
    lc0.setLed(0,2,3,true);   
    lc0.setLed(0,3,3,true);   
    lc0.setLed(0,4,3,true);   
    lc0.setLed(0,5,3,true);   
    lc0.setLed(0,6,2,true); 
  }

}

void lc0Clear(){
    lc0.setLed(0,1,3,false);   
    lc0.setLed(0,2,2,false);   
    lc0.setLed(0,3,2,false);   
    lc0.setLed(0,4,2,false);   
    lc0.setLed(0,5,2,false);   
    lc0.setLed(0,6,3,false); 

    lc0.setLed(0,2,3,false); 
    lc0.setLed(0,2,2,false); 
    lc0.setLed(0,3,3,false); 
    lc0.setLed(0,3,1,false); 
    lc0.setLed(0,4,3,false); 
    lc0.setLed(0,4,1,false); 
    lc0.setLed(0,5,3,false); 
    lc0.setLed(0,5,2,false); 

    lc0.setLed(0,1,3,false);   
    lc0.setLed(0,2,2,false);   
    lc0.setLed(0,3,2,false);   
    lc0.setLed(0,4,2,false);   
    lc0.setLed(0,5,2,false);   
    lc0.setLed(0,6,3,false); 

    lc0.setLed(0,1,2,false);   
    lc0.setLed(0,2,3,false);   
    lc0.setLed(0,3,3,false);   
    lc0.setLed(0,4,3,false);   
    lc0.setLed(0,5,3,false);   
    lc0.setLed(0,6,2,false);
}

Leave a Reply