Giter Site home page Giter Site logo

yamin8000 / waterlevel Goto Github PK

View Code? Open in Web Editor NEW
19.0 2.0 4.0 410 KB

๐Ÿ’ง Monitoring water tanker level using NodeMCU ESP8266 and HC-SR04P Ultrasonic Sensor and broadcasting it using a simple HTTP server inside NodeMCU ESP8266 and show data in an Android App

Kotlin 32.15% C++ 64.22% Python 3.63%
iot esp8266 nodemcu-esp8266 android kotlin hc-sr04 hc-sr04-ultrasonic-sensor ultrasonic-sensor arduino-ide arduino

waterlevel's Introduction

WaterLevel

Preface

This project aims to find a tanker water level using NodeMCU with ESP8266 core and HC-SR04P Ultrasonic sensor and broadcasting it using a simple HTTP server inside NodeMCU then data can be read using a browser, android app, another NodeMCU, or anything that can create an HTTP request with GET method.

NodeMCU ESP8266 (LoLin NodeMCU V3)

Unlike generic ESP8266 models, this model offers a micro-USB connection using a CH340G (USB to serial chip) naturally soldered to ESP8266. after installing CH340G drivers and ESP8266 drivers for Arduino IDE, this chip can be programmed with Arduino compatible codes with Arduino IDE.

Specs

  • 80-160MHZ RISC microprocessor
  • ~128KB of RAM
  • 802.11 support: b/g/n
  • TCP/IP protocol stack
  • ...

nodemcu

NodeMCU pins breakout

nodemcupins

HC-SR04P Ultrasonic Sensor

This model is the second generation of HC-SR04 sensor, unlike the first model which only can operate at 5V DC, this new version can work with 3.3V DC too so it's perfectly safe to wire the output of this sensor directly to ESP8266 GPIO pins which operate at 0V~3.3V logic levels without using any sort of voltage divider.

Specs

  • Power Supply: 3.3V~5V DC
  • Effective Angle: <15 degrees
  • Ranging Distance: 2cm-400cm
  • Connector Pins: 4-pins header (vcc, gnd, echo, trigger)

HCSR04P

How it works?

TL;DR Full Arduino/C++ code here

ESP8266 wifi stack offers two types, connection mode, and access point mode. in this project, we used the connection mode so ESP8266 automatically tries to connect to the station with the given SSID and password and in this project, we used a static IP for ESP8266 so we can find it more simply in the local area network.

Two sensors are wired to chip through GPIO pins, pin 12 or D6 is the trigger pin for sensor #1 and pin 14 or D5 is the echo pin for sensor #1 and pin 15 (D8) and 13 (D7) for sensor #2. each second data from both sensors is read and mapped to the new range because each sensor send distance between itself and water (something between 0cm to 170cm) so this range is better to be mapped to a more readable range like 100-0) so if the distance is 160 then the water level is almost 90 percent.

Using a simple HTTP server with port 80 data is sent for any client that tries to get data from the root of the server (http://192.168.1.100). Raw Data is like this:

T1 70% 53 T2 85% 28

Which stands for TankerName TankerPercent TankerSensorDistance.

Broweser Client

rawdata

Android Client

There is a simple Android App written in Kotlin that uses OkHttp for getting sensor data and shows it in simple text and battery-like view.

android

waterlevel's People

Contributors

yamin8000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.