Skip to content

Tool to plants soil moisture monitoring with Adafruit IO dashboard and an ESP32 with soil moisture sensor.

License

Notifications You must be signed in to change notification settings

m0by314/plant_soil_moisture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monitor the soil moisture of your plants with an ESP32

Cloning

git clone --recurse-submodules https://github.com/m0by314/plant_soil_moisture.git

Summary

How it works

The tool performs a measurement every 6 hours, in order to have the evolution of the soil moisture during the day.
The data is stored on an Adafruit IO feed to be visualized in a dashboard.

If the percentage of soil moisture is below than the threshold, an alert watering for your plant is sent by email using an IFTTT webhook.

Between each measurement, the ESP goes into deep sleep mode.

I use the Adafruit IO platform because the free account offers 10 feeds, (which allows to monitor 10 plants), 5 dashboards and the data are stored for 30 days

Connect the soil moisture sensor

image

Create IFTTT webhooks

  • Go to the link: https://ifttt.com/

  • Then click on the "create" button image

  • Then click on "add" in the "If This" section image

  • Search for the "Webhooks" service image

  • Select trigger "Receive a web request" image

  • Define the event name (to keep aside it will be used in the configuration file) then create the trigger image

  • In the "Then that" section click on "add image

  • Search for the Gmail service

  • Then select action "send an email" image

  • Complete action fields like this: image

  • Go to the following link to get your key: https://ifttt.com/maker_webhooks/settings
    The key is at the end of the URL image

Create Adafruit IO Dashboard

Setup

  • First copy the template:
    cp config_template.h config.h

  • Configure the following variables with your credentials:

/* Soil sensor */
#define MOISTURE_SENSOR_PIN 36 
#define DRY_VALUE "value obtained in air" 
#define WET_VALUE "value obtained after immersing it in water" 

/* WIFI Setting */
#define WIFI_SSID "YOUR_WIFI_SSID"     /* Replace with your wifi ssid. */
#define WIFI_PWD "YOUR_WIFI_PASSWORD"  /* Replace with your wifi password */

/* Plant name */
#define PLANT_NAME "YOUR PLANT NAME"   /* Replace with your plant name, use for the subject of the mail.*/

/* Adafruit IO settings */
#define IO_USERNAME "YOUR ADAFRUIT USERNAME" /* Replace with your adafruit username. */
#define IO_KEY "YOUR ADAFRUIT KEY"           /* Replace with your adafruit key.      */
#define IO_FEED_NAME "YOUR FEED NAME"        /* Replace with your adafruit feed name. */

// IFTTT Setting
#define IFTTT_KEY  "YOUR_IFTTT_KEY"          /* Replace with your unique IFTTT Key, can be obtained at this link: https://ifttt.com/maker_webhooks/settings. */
#define IFTTT_EVENT_NAME "YOUR_EVENT_NAME"  /* Replace with your IFTTT event name. */

/* Mail Setting */
#define MAILTO "YOUR_MAIL" /* Replace with your email. */

/* Moisture alert threshold */
#define THRESHOLD "YOUR_MOISTURE_THRESHOLD" /* Replace with your moisture threshold alert */

Built with

  • ESP32 DevKitC V4
  • Soil Moisture Sensor Hygrometer Module V1.2 capacitive