Liquid Soap Level

by erdincilkin in Circuits > Arduino

163 Views, 0 Favorites, 0 Comments

Liquid Soap Level

IMG_1872.jpg
IMG_1872.jpg
IMG_1865.jpg
IMG_1798.jpg
IMG_1792.jpg
IMG_1866.jpg
IMG_1867.jpg
IMG_1865.jpg

A liquid Soap Level Monitoring System is designed to monitor the liquid Soap level in a tank or reservoir. It utilizes the NodeMCU ESP-12F development board, which is equipped with the ESP8266 Wi-Fi module. The system uses ultrasonic sensors connected to the NodeMCU board to measure the distance between the liquid Soap surface and the sensor. By calculating the difference between the tank depth and the measured distance, the system determines the water level.

The NodeMCU ESP-12F connects to the Blynk platform using the Blynk library, allowing you to remotely monitor the water level from a mobile app or web dashboard. The Blynk app provides a graphical representation of the water level, displaying it as a percentage. Additionally, the system sends the liquid Soap level data to the serial monitor for debugging purposes.

NOTE: BATTERY IS OPTIONAL

Supplies

IMG_1868.jpg
  • NodeMCU ESP-12F: The development board is based on the ESP8266 Wi-Fi module.
  • Ultrasonic Sensors: Used to measure the distance between the liquid Soap surface and the sensor.
  • Blynk Platform: Enables remote monitoring and control of the water level via a mobile app or web dashboard.

Hardware Setup:

IMG_0095.PNG
IMG_1870.jpg
IMG_1869.jpg
IMG_1871.jpg


  • Connect the trig pin of the ultrasonic sensor to D5 on the NodeMCU board.
  • Connect the echo pin of the ultrasonic sensor to D6 on the NodeMCU board.
  • Connect the VCC and GND pins of the ultrasonic sensor to the appropriate power and ground pins on the NodeMCU board.


Blynk Setup:

Ekran Resmi 2023-06-11 22.41.12.png
Ekran Resmi 2023-06-11 22.40.32.png
  • Install the Blynk app on your smartphone or tablet.
  • Create a new project in the Blynk app and note down the authentication token.
  • Add a value display widget (e.g., Gauge) in the Blynk app to visualize the liquid Soap level percentage.
  • Obtain the Blynk template ID and name for your project.


Code Upload

Ekran Resmi 2023-06-11 22.42.04.png
Ekran Resmi 2023-06-11 22.42.14.png
  • Open the Arduino IDE and create a new sketch.
  • Copy the provided code into the sketch.
  • Replace the placeholder values with your Blynk authentication token, Wi-Fi SSID, and password.
  • Upload the code to the NodeMCU board.


#define BLYNK_TEMPLATE_ID "TMPL6gKWFROIu"

#define BLYNK_TEMPLATE_NAME "liquid Soap level"

#define BLYNK_AUTH_TOKEN "ZcFjGkSK7qCg0JWFJm-3IziHy7uParIm"


#define BLYNK_PRINT Serial


#define trig D5

#define echo D6

#include <ESP8266WiFi.h>

#include <BlynkSimpleEsp8266.h>


BlynkTimer timer;

long tankDepth = 24;

char ssid[] = "Erdinc iphone (2)";

char pass[] = "12345678";


void waterLevel() {

 digitalWrite(trig, LOW);

 delayMicroseconds(2);

 digitalWrite(trig, HIGH);

 delayMicroseconds(10);

 digitalWrite(trig, LOW);

 long t = pulseIn(echo, HIGH);

 long cm = t / 29 / 2;


 double level = tankDepth - cm;


 if (level > 0) {

  long percentage = ((level / tankDepth)) * 100;

  Blynk.virtualWrite(V0, percentage);

  Serial.println(percentage);

 }

 else {

  Blynk.virtualWrite(V0, 0);

 }

}


void setup() {

 pinMode(trig, OUTPUT);

 pinMode(echo, INPUT);

 Serial.begin(9600);

 delay(100);

 Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

 timer.setInterval(10L, liquid Soap);

}


void loop() {

 Blynk.run();

 timer.run();

}

Testing

IMG_0252.jpg
IMG_0253.jpg
  • Power up the NodeMCU board.
  • Open the Serial Monitor in the Arduino IDE to view the debug messages.
  • Launch the Blynk app on your smartphone or tablet.
  • Connect the app to the project using the Blynk template ID.
  • You should now be able to see the liquid Soap level percentage displayed on the Blynk app in real-time.