Engineers Garage

  • Electronics Projects and Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

How to build a plant health monitor using ESP8266 and the MIT App Inventor

By Nikhil Agnihotri February 4, 2024

Most house plants require temperature, humidity, and moisture monitoring for optimal care. Temperatures exceeding the optimal range can cause stress, wilting, stunted growth, and even death, while cold temperatures can slow plant development, leading to weak growth and susceptibility to frost damage. Excessive humidity encourages fungal diseases and prevents proper transpiration, while drier air typically causes leaves to dry out and drop, impacting photosynthesis and overall plant health. 

Overwatering can also lead to root rot and other diseases. It’s a delicate balance of ideal care, depending on the plant. Although different plants have different needs, general temperature preferences fall between 18° and 23° C, with humidity levels around 40% to 60%. Moisture levels can vary more vastly based on the plant species. 

In this project, we’ll build an online plant health monitor using ESP8266, a moisture sensor, and the DHT11 temperature and humidity sensor. The related temperature, humidity, and moisture data will be published on a local website hosted on an ESP8266-based web server. We’ll also design a mobile app using MIT App Inventor, where we can access this data with the click of a button. 

Components required

  1. ESP8266 x1
  2. DHT11 x1
  3. Moisture sensor x1
  4. Connecting wires/jumper wires

Circuit connections
Here are the steps to build this project for your plants:

  • Interface DHT11 and the moisture sensor with ESP8266.
  • Connect DHT11’s VCC and GND pins with ESP8266’s 3Vout and ground pins, respectively.
  • Connect DHT11’s output pin with ESP8266’s GPIO5 pin.
  • Connect the 4.7K resistor between ESP8266’s GPIO5 and 3Vout.
  • Connect the moisture sensor’s VCC and GND pins with ESP8266’s 3Vout and ground, respectively.
  • Connect the moisture sensor’s analog output with ESP8266’s A0.

Arduino sketch

How it works
ESP8266 operates as a web server, reading the temperature and humidity from the DHT11 sensor and the moisture from the moisture sensor. ESP8266 then publishes the sensor data to a webpage: /root/read. The root URL is the URL of the WIFI network or router. The sensor data about the plant health parameters can be accessed by browsing the webpage /root/read, where the root is the IP address of the WIFI network. 

Any browser that accesses the webpage acts as a web client. The sensor data is always obtained in real-time whenever there’s a request from the web client. 

The mobile app also acts as a web client, built using the MIT App Inventor. It can also access the real-time values of the plant’s conditions via a smartphone by making HTTP requests to the ESP8266-based web server. Whenever an HTTP request is made through a web browser or the app, ESP8266 collects the plant’s conditions in real time and publishes them on the web URL. This is accessed by the browser or mobile application. 

The MIT app
The MIT App Inventor is used to build a mobile application that can access the plant’s current conditions. The app has the following front-end design. 

The app has just one screen, renamed the “Plant Health Monitor.” The app’s user interface has three components: a label, a button, and a web client. The label has the following properties.

The button has these properties:

The app is programmed based on this block diagram:

The code
The sketch begins by importing the DHT.h and ESP8266WiFi.h libraries. The DHT.h library works with the DHT11 sensor, and the ESP8266WiFi.h library runs WIFI functionalities on ESP8266. This is followed by the DHT sensor’s pin assignments and instantiation of a DHT object. Variables are declared to store the WiFi credentials, and an object of the WiFi server is instantiated. The variables to store the moisture sensor’s analog value, moisture percentage, humidity, and temperature are declared.

In the setup() function, the baud rate for serial communication is set to 9600 BPS, and a timeout of two seconds is provided for the DHT sensor. ESP8266 is connected to WiFi, and the web server is started. The DHT sensor is initialized, and a message is printed to the serial console that the sensor is operating.

In the loop() function, ESP8266 reads values from the moisture and DHT11 sensors, storing them as global variables. ESP8266 server “looks” for any potential web clients (a computer browser or a smartphone app). If an HTTP request from a browser or the plant health app is received, the IP address of that web client is printed to the serial console. When the web client is available, a webpage containing the real-time humidity, temperature, and moisture values is sent to it.

When the plant health monitor app accesses the sensor data from the ESP8266 web server, it displays the webpage’s contents in the label of the app’s user interface.

Troubleshooting
The ESP8266-based web server connects to a WiFi router’s IP address. This address is printed to the serial console when ESP8266 connects to WiFi. However, the status of your IP address can make a difference to the app: 

  • If your router has a static IP, this address will remain constant, which is ideal. 
  • If your router has a dynamic IP address (DHCP), it often changes every time the router is reset. This means the ESP8266-based web server will host the webpage on an entirely new IP address.

If the latter occurs, you might need to alter the URL of the web component in the mobile app to access the sensor data.

Results
This is how the project looks:

When ESP8266 is powered ON, it connects to WiFi, initializing the DHT sensor. When a web client, such as a browser or the Plant Health Monitor App, accesses the URL, the ‘/root/read’ sends an HTTP request. The he sensor data is also printed to the serial console.

The messages from the serial console are displayed below.

The plant health data is accessed through the URL ‘/root/read’ on a web browser. Its root is the WiFi network’s IP address, as shown below.

The plant health data accessed on the Plant Health Monitor App is shown below.

Additional notes
It’s possible that your WiFi connection may be slow or that ESP8266-based server takes time to respond. Be patient and watch for the messages printed on the serial console. When a browser or the app requests data from the ESP-based server, it prints the IP address of the connected remote client and the sensor data on the console.

 

You may also like:


  • How to get started with MIT App Inventor

  • How to send SMS alerts from ESP32 without a GSM…

  • MicroPython based online weather station on ESP8266 and ESP32

  • Arduino Based IoT Garden Monitoring System

  • How to use a DHT sensor to show humidity and…

  • What are level sensors?

Filed Under: Electronic Projects, ESP8266
Tagged With: app, dht11, electronicproject, esp8266, mitappinventor, monitor, plants, sensors
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Estimating Power Budget with Limited Datasheet Information
  • RFsoc4x2 fpga diagram request
  • GanFet power switch starts burning after 20 sec
  • 12VAC to 12VDC 5A on 250ft 12AWG
  • Unity Gain Buffer with 0 to 0.5V Range

RSS Electro-Tech-Online.com Discussions

  • An Update On Tarrifs
  • Trying to use a L9110s motor driver chip
  • I want to make a CRT with some modifications But i have no Idea where to start
  • Funny Images Thread!
  • Need Help Figuring Out the Schematics Of Circuit Board

Featured – Designing of Audio Amplifiers part 9 series

  • Basics of Audio Amplifier – 1/9
  • Designing 250 Milli Watt Audio Power Amplifier – 2/9
  • Designing 1 Watt Audio Power Amplifier – 3/9
  • Designing a Bass Boost Amplifier – 4/9
  • Designing a 6 Watt Car Audio Amplifier – 5/9
  • Design a low power amplifier for headphones- 6/9

Recent Articles

  • Fischer connector system adds ratchet locking system designed for 300g shock resistance
  • Littelfuse introduces tactile switch with enhanced bracket peg design for mounting strength
  • Infineon releases GaN switch with monolithic bidirectional design
  • Sienna Semiconductor data converters feature sample rates from 20 to 250 Msps
  • Delta’s 5,500 W power supplies achieve 97.5% energy efficiency for AI servers

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronics Projects and Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe