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

Overview

WaterLevel

Preface

This project aims to finding 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 browser, android app, another NodeMCU or anything that can create a 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 second generation of HC-SR04 sensor, unlike 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 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 or access point mode. in this project we used the connection mode so ESP8266 automatically tries to connect to the station with given SSID and password and in this project we used a static ip for ESP8266 so we can find it more simply in local area network.

Two sensors are wired to chip through GPIO pins, pin 12 or D6 is trigger pin for sensor #1 and pin 14 or D5 is echo pin for sensor #1 and pin 15 (D8) and 13 (D7) for sensor #2. each second data from both server is read and mapped to new range because 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 distance is 160 then 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 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

You might also like...
Square’s meticulous HTTP client for the JVM, Android, and GraalVM.

OkHttp See the project website for documentation and APIs. HTTP is the way modern applications network. It’s how we exchange data & media. Doing HTTP

A type-safe HTTP client for Android and the JVM

Retrofit A type-safe HTTP client for Android and Java. For more information please see the website. Download Download the latest JAR or grab from Mave

Volley is an HTTP library that makes networking for Android apps easier and, most importantly, faster.

Volley Volley is an HTTP library that makes networking for Android apps easier and, most importantly, faster. For more information about Volley and ho

πŸš€ A Complete Fast Android Networking Library that also supports HTTP/2 πŸš€
πŸš€ A Complete Fast Android Networking Library that also supports HTTP/2 πŸš€

Fast Android Networking Library About Fast Android Networking Library Fast Android Networking Library is a powerful library for doing any type of netw

The easiest HTTP networking library for Kotlin/Android

Fuel The easiest HTTP networking library for Kotlin/Android. You are looking at the documentation for 2.x.y.. If you are looking for the documentation

An android asynchronous http client built on top of HttpURLConnection.

Versions 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 Version 1.0.6 Description An android asynchronous http client based on HttpURLConnection. Updates U

πŸš€ A Complete Fast Android Networking Library that also supports HTTP/2 πŸš€
πŸš€ A Complete Fast Android Networking Library that also supports HTTP/2 πŸš€

Fast Android Networking Library About Fast Android Networking Library Fast Android Networking Library is a powerful library for doing any type of netw

Arkhota is a web (HTTP/S) brute forcer for Android.
Arkhota is a web (HTTP/S) brute forcer for Android.

Arkhota is a web (HTTP/S) brute forcer for Android.

Asynchronous Http and WebSocket Client library for Java

Async Http Client Follow @AsyncHttpClient on Twitter. The AsyncHttpClient (AHC) library allows Java applications to easily execute HTTP requests and a

Comments
  • Configure Renovate

    Configure Renovate

    WhiteSource Renovate

    Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

    🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.


    Detected Package Files

    • gradle.properties (gradle)
    • settings.gradle (gradle)
    • build.gradle (gradle)
    • app/build.gradle (gradle)
    • gradle/wrapper/gradle-wrapper.properties (gradle-wrapper)

    Configuration Summary

    Based on the default config's presets, Renovate will:

    • Start dependency updates only once this onboarding PR is merged
    • Enable Renovate Dependency Dashboard creation
    • If semantic commits detected, use semantic commit type fix for dependencies and chore for all others
    • Ignore node_modules, bower_components, vendor and various test/tests directories
    • Autodetect whether to pin dependencies or maintain ranges
    • Rate limit PR creation to a maximum of two per hour
    • Limit to maximum 10 open PRs at any time
    • Group known monorepo packages together
    • Use curated list of recommended non-monorepo package groupings
    • Fix some problems with very old Maven commons versions
    • Ignore spring cloud 1.x releases
    • Ignore web3j 5.0.0 release
    • Ignore http4s digest-based 1.x milestones
    • Use node versioning for @types/node
    • Limit concurrent requests to reduce load on Repology servers until we can fix this properly, see issue 10133
    • Do not upgrade from Alpine stable to edge

    πŸ”‘ Would you like to change the way Renovate is upgrading your dependencies? Simply edit the renovate.json in this branch with your custom config and the list of Pull Requests in the "What to Expect" section below will be updated the next time Renovate runs.


    What to Expect

    With your current configuration, Renovate will create 9 Pull Requests:

    Update dependency androidx.constraintlayout:constraintlayout to v2.1.3
    Update dependency com.squareup.okhttp3:okhttp to v4.9.3
    • Schedule: ["at any time"]
    • Branch name: renovate/com.squareup.okhttp3-okhttp-4.x
    • Merge into: main
    • Upgrade com.squareup.okhttp3:okhttp to 4.9.3
    Update dependency androidx.appcompat:appcompat to v1.4.1
    • Schedule: ["at any time"]
    • Branch name: renovate/androidx.appcompat-appcompat-1.x
    • Merge into: main
    • Upgrade androidx.appcompat:appcompat to 1.4.1
    Update dependency androidx.core:core-ktx to v1.7.0
    • Schedule: ["at any time"]
    • Branch name: renovate/androidx.core-core-ktx-1.x
    • Merge into: main
    • Upgrade androidx.core:core-ktx to 1.7.0
    Update dependency com.android.tools.build:gradle to v7.1.2
    Update dependency com.google.android.material:material to v1.5.0
    Update dependency gradle to v7.4.1
    • Schedule: ["at any time"]
    • Branch name: renovate/gradle-7.x
    • Merge into: main
    • Upgrade gradle to 7.4.1
    Update dependency org.jetbrains.kotlin:kotlin-gradle-plugin to v1.6.10
    Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-android to v1.6.0

    🚸 Branch creation will be limited to maximum 2 per hour, so it doesn't swamp any CI resources or spam the project. See docs for prhourlylimit for details.


    ❓ Got questions? Check out Renovate's Docs, particularly the Getting Started section. If you need any further assistance then you can also request help here.


    This PR has been generated by WhiteSource Renovate. View repository job log here.

    opened by renovate[bot] 1
Owner
YaMiN
Android, Kotlin, Java, C#, Raspberry Pi enthusiast
YaMiN
Android Easy Http - Simplest android http request library.

Android Easy Http Library 繁體中文文ζͺ” About Android Easy Http Library Made on OkHttp. Easy to do http request, just make request and listen for the respons

null 13 Sep 30, 2022
Simple kafka client for monitoring topic events. Client has UI powered by Darklaf

kafka-client Simple kafka client for monitoring topic values. How to start $ java -jar kafka-client-1.0.jar How to use specify kafka hosts in config.y

Salavat 0 Jun 3, 2022
Asynchronous socket, http(s) (client+server) and websocket library for android. Based on nio, not threads.

AndroidAsync AndroidAsync is a low level network protocol library. If you are looking for an easy to use, higher level, Android aware, http request li

Koushik Dutta 7.3k Jan 2, 2023
HTTP Server for Android Instrumentation tests

RESTMock REST API mocking made easy. RESTMock is a library working on top of Square's okhttp/MockWebServer. It allows you to specify Hamcrest matchers

Andrzej Chmielewski 750 Dec 29, 2022
Pluto is a on-device debugger for Android applications, which helps in inspection of HTTP requests/responses, capture Crashes and ANRs and manipulating application data on-the-go.

Pluto Pluto is a on-device debugger for Android applications, which helps in inspection of HTTP requests/responses, capture Crashes and ANRs and manip

Mocklets 8 Aug 22, 2022
HttpMocker is a simple HTTP mocking library written in Kotlin to quickly and easily handle offline modes in your apps

HttpMocker HttpMocker is a very lightweight Kotlin library that allows to mock HTTP calls relying on either OkHttp or the Ktor client libraries. It ca

David Blanc 174 Nov 28, 2022
super simple library to manage http requests.

HttpAgent super simple library to manage http requests. Gradle dependencies { implementation 'com.studioidan.httpagent:httpagent:1.0.16@aar' } No

idan ben shimon 32 Oct 24, 2021
MVVM with simple HTTP Request Example

Minimum MVVM Koin (Kotlin Dependency Injection) Coroutines View Model Lifecycle News API Retrofit Rx Java Rx Android OkHttp Client Result ScreenShot 1

Faisal Amir 6 Dec 1, 2022
Ktorfit - a HTTP client/Kotlin Symbol Processor for Kotlin Multiplatform (Js, Jvm, Android, iOS, Linux) using KSP and Ktor clients inspired by Retrofit

Ktorfit is a HTTP client/Kotlin Symbol Processor for Kotlin Multiplatform (Js, Jvm, Android, iOS, Linux) using KSP and Ktor clients inspired by Retrofit

Jens Klingenberg 637 Dec 25, 2022
Helmet secures your spring Webflux or MVC app by setting various HTTP headers

Helmet Helmet secures your spring Webflux or MVC app by setting various HTTP headers. This is a 1:1 copy of Helmet.js Quick start Add https://jitpack.

DuΕ‘an 1 Oct 28, 2021