Patel Darshil
Published © GPL3+

Easy IOT Water Leakage Indicator

IOT-based project to know about water leakage on your server.

BeginnerFull instructions provided1 hour29,797
Easy IOT Water Leakage Indicator

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
ESP8266 ESP-01
Espressif ESP8266 ESP-01
×1
Samsung SmartThings Water Leak Sensor
Samsung SmartThings Water Leak Sensor
×1
7805 Voltage Regulator IC
×1
9v Battery
×1

Software apps and online services

Arduino IDE
Arduino IDE
EasyIOT Server

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

uno_esp_connection_hWNKzevLuM.png

Code

Untitled file

C/C++
#include <Esp8266EasyIoT.h>
#include <SoftwareSerial.h> 

Esp8266EasyIoT esp; 

SoftwareSerial serialEsp(10, 11);

#define LEAK_PIN  2  // Arduino Digital I/O pin number
#define CHILD_ID_LEAK 0

Esp8266EasyIoTMsg msgLeak(CHILD_ID_LEAK, V_DIGITAL_VALUE);
//Esp8266EasyIoTMsg msgHum(CHILD_ID_LEAK, V_LEAK); // supported in esp >= V1.1 lib

int lastLeakValue = -1;

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

  Serial.println("EasyIoTEsp init");
  esp.begin(NULL, 3, &serialEsp, &Serial);

  pinMode(LEAK_PIN, INPUT);

  esp.present(CHILD_ID_LEAK, S_LEAK);
}

void loop()
{
  esp.process();
  
  // Read digital pin value
  int leakValue = digitalRead(LEAK_PIN); 
  // send if changed
  if (leakValue != lastLeakValue) {    
    Serial.println(leakValue);
    esp.send(msgLeak.set(leakValue==0?0:1));
    lastLeakValue = leakValue;
  }  
}

Credits

Patel Darshil

Patel Darshil

29 projects • 163 followers
I am an Electronics Hobbyist pursuing my BE in Electronics and communication

Comments