Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Andrew Wie
Published

Simple Plants Monitoring System

With this Simple Plants Monitoring System you no need to worry about your garden anymore.

BeginnerWork in progress2 hours2,951
Simple Plants Monitoring System

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
SparkFun Soil Moisture Sensor (with Screw Terminals)
SparkFun Soil Moisture Sensor (with Screw Terminals)
×1
DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1
LED (generic)
LED (generic)
×3
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×12

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk

Story

Read more

Schematics

001

001_wdJk1sEI9B.jpeg

Code

Plant Monitoring System Code

C/C++
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
#define DHTPIN 5
#define DHTTYPE DHT22

char auth[] = "82a1d1d9d23d40e9aa4f4650b46eb1a6";
char ssid[] = "Andrew";
char pass[] = "Andrew8266";

int LED1 = 14;
int LED2 = 12;
int LED3 = 13;
int m=0;
float h=0;
float t=0;
float mf=0;
int pinMoist=A0;

DHT dht(DHTPIN, DHTTYPE);


void setup()
{
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  pinMode(LED1,OUTPUT);
  pinMode(LED2,OUTPUT);
  pinMode(LED3,OUTPUT);
  dht.begin();
}

void loop()
{
  Blynk.run();
  h = dht.readHumidity();
  t = dht.readTemperature();
  Blynk.virtualWrite(V5, t);                                 
  Blynk.virtualWrite(V6, h);  
  m = analogRead(pinMoist);
  Blynk.virtualWrite(V7, m);
  if (m <= 341)
  {
   digitalWrite(LED3,HIGH);
   digitalWrite(LED1,LOW);
   digitalWrite(LED2,LOW);
  }

  else if (m >= 342 && m <= 500)
  {
   digitalWrite(LED2,HIGH);
   digitalWrite(LED1,LOW);
   digitalWrite(LED3,LOW);
  }

    else if (m >=700)
  {
   digitalWrite(LED1,HIGH);
   digitalWrite(LED2,LOW);
   digitalWrite(LED3,LOW);
  }
}

Plant Monitoring System

Credits

Andrew Wie
1 project • 2 followers

Comments