EKO Lite Telegram Soil Sensor

A simple smart planter with a corrosion-free capacitive soil sensor and ESP8266, sending plant health notifications via Telegram

Public Chat
Similar projects worth following
A simple smart planter with a corrosion-free capacitive soil sensor and ESP8266, sending plant health notifications via Telegram

The story behind making a simpler version of EKO began with the desire to create a more accessible and affordable solution for plant lovers who may not have the resources or technical expertise to set up a full-fledged IoT system.

After researching and testing various sensors and communication protocols, it became clear that a simple capacitive soil sensor and ESP8266 could provide the necessary data collection and communication capabilities to monitor plant health and send notifications.

The focus was on making the system as easy to use and maintain as possible, with a corrosion-free sensor that could withstand long-term use and an ESP8266 that could send notifications via Telegram, a widely used messaging app that is easily accessible and user-friendly.

#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <UniversalTelegramBot.h>
#include <ArduinoJson.h>

// Configuraciones de WiFi
// Configuraciones de Telegram BOT
#define CHAT_ID "123456789"

WiFiClientSecure secured_client;
UniversalTelegramBot bot(BOT_TOKEN, secured_client);

void setup() {

  // Nos conectamos a la red Wifi
  Serial.print("Connecting to Wifi SSID ");
  while (WiFi.status() != WL_CONNECTED)
  Serial.print("\nWiFi connected. IP address: ");

  Serial.print("Retrieving time: ");
  configTime(0, 0, ""); // get UTC time via NTP
  time_t now = time(nullptr);
  while (now < 24 * 3600)
    now = time(nullptr);

  int humedad = analogRead(A0);


  bot.sendMessage(CHAT_ID, "EKO Bot arrancó con exito 🪴", "");

  bot.sendMessage(CHAT_ID, "Viendo que tal esta el suelo 👀", "");

int alerta_enviada = 0;
int startup = 1;

void loop() {

  // Leemos la humedad de suelo desde el pin analogico (rango de 0 a 1024 siendo <600 sumergido en agua)
  int humedad = analogRead(A0);

  // Regamos con mucha agua
  if ( humedad < 600 &&  (!alerta_enviada || startup)) {
    alerta_enviada = 1 ;
    startup = 0;
    bot.sendMessage(CHAT_ID, "Me regaste de más, me voy a morir 🥺", "");

  // La tierra esta seca
  if ( humedad > 1000 && (!alerta_enviada || startup)) {
    alerta_enviada = 1 ;
    startup = 0;
    bot.sendMessage(CHAT_ID, "Regame por favor 🙏", "");

  // Rango normal de humedad, solo alertamos si previamente no lo hicimos
  if ( humedad > 700 && humedad < 900 && (alerta_enviada || startup)) {
    alerta_enviada = 0 ;
    startup = 0;
    bot.sendMessage(CHAT_ID, "Todo bien, gracias por cuidarme 🙌", "");


The code includes libraries for WiFi and Telegram bot communication, as well as the ArduinoJson library for JSON parsing.

The setup function connects to the specified WiFi network and retrieves the current time using an NTP server. It also initializes the Telegram bot with the provided bot token and creates a secure WiFi client for sending messages.

The loop function reads the soil moisture level from an analog pin and sends a notification to the specified Telegram chat ID based on the moisture level. If the moisture level is below 600, indicating the plant has been over-watered, it sends a warning message. If the moisture level is above 1000, indicating the plant is too dry, it sends a request for watering. If the moisture level is within a normal range of 700-900, it sends a message indicating everything is fine.

The code also includes variables for tracking whether an alert has been sent to avoid sending multiple notifications for the same moisture level.

Full repo can be found on Github:


Read more »

  • 1 × ESP8266
  • 1 × Capacitive Touch Sensor
  • 1 × Power Brick
  • 1 × Dupont wires

View project log

  • 1
    Basic Build

    Instructions for this device are rather simple. Connect GND, +5V and analog signals from the sensor to the respective ones in the ESP8266 (The D1 Mini only has one analog input A0). Then replace the SSID details along with the bot token and chat id to send the messages to in the EKO-Telegram-Simple.ino. Fire it up and it will start monitoring your plants!

View all instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates