ESP8266

Treemo The Emotion Tree

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

// Live from circuit.rocks shop

How It Works

Screws for assembly

to hold the electronic components to the body of treemo.

Code


#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);
}
See also  Announcement Scheduler

Frequently Asked Questions

What does this Treemo The Emotion Tree tutorial cover?

Overview: TREEMO can detect soil moisture with sensor.

What Arduino library does the Treemo The Emotion Tree tutorial use?

The sketch uses standard Wire.h (I2C) or SPI.h plus a part-specific library installable via Arduino IDE → Sketch → Include Library → Manage Libraries. See the Sample Code section.

Why does the Treemo The Emotion Tree act differently on USB power vs battery?

Battery voltage sags under load. Add a 100uF cap across the rails, use a 5V/2A regulator-backed pack, and never power motors from the Arduino's onboard regulator.

// written by circuitrocks

Official account for the Circuitrocks team. Store updates, product announcements, and shop-wide news from the Philippines maker electronics retailer behind the tutorials, kits, and components.

Leave a comment