Introduction
Hospitals often rely on manual monitoring of IV drips, which can lead to delays, overflows, or empty bottles if not attended to promptly. Nurses must frequently check IV bags to ensure timely replacements—a task that is both time-consuming and prone to human error. This project aims to automate the monitoring process by using an ESP32, an HX711, and a load cell to track the weight of an IV bag in real time. When the fluid level drops below a certain threshold, the system sends alerts, helping prevent complications and reducing the workload on medical staff.
This system is ideal for:
- Hospital automation
- Remote healthcare monitoring
- Reducing nurse workload
Hardware Components and Circuit Design:
- ESP32 Dev Board: Main microcontroller with Wi-Fi
- HX711 Module: 24-bit ADC amplifier for load cell readings
- Load Cell: Measures IV fluid weight
- 16x2 LCD (I2C): Displays IV volume and percentage
- Buzzer: Sounds alert when IV bag is low
- Jumper Wires: For connections
- Breadboard (optional): For prototyping
- USB Cable: To upload code and power ESP32
The images below show the complete wiring of the IV Bag Monitoring System using ESP32, HX711, load cell, LCD, and buzzer.
Code Overview & Working:
Libraries Used:
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <LiquidCrystal_I2C.h>
#include "HX711.h"
- WiFi & Blynk: Enables ESP32 to connect to the internet and transmit notifications.
- LCD I2C: Shows the measured weight and fluid level percentage.
- HX711: Acts as an interface between the load cell and ESP32 for accurate weight measurement.
Pin Definitions:
#define DOUT 23
#define CLK 19
#define BUZZER 25
WiFi & Blynk Credentials:
char auth[] = "..."; // Blynk Auth Token
char ssid[] = "..."; // WiFi Name
char pass[] = "..."; // WiFi Password
Setup Function:
void setup() {
scale.begin(DOUT, CLK); // HX711 pins
Serial.begin(115200); // Start Serial Monitor
lcd.init(); lcd.backlight(); // LCD Setup
pinMode(BUZZER ,OUTPUT); // Buzzer Pin
scale.set_scale(); scale.tare(); // Calibration
Blynk.begin(auth, ssid, pass); // Connect to Blynk
lcd.setCursor(3, 0);
lcd.print("IOT Based IVBag");
lcd.setCursor(5, 1);
lcd.print("Monitering System");
delay(2000); lcd.clear();
}
- Sets up the LCD display, load cell (scale), and buzzer.
Establishes a connection with the
Blynk server.
Loop Function:
void loop() {
Blynk.run();
measureweight(); // Check weight and update
}
measure weight() – Main Function:
scale.set_scale(calibration_factor);
weight = scale.get_units(5); // Average of 5 readings
- Calibrates and reads weight.
- Converts weight to mL (
liter = weight * 1000
).
val = map(val, 0, 505, 0, 100); // Maps mL to 0-100%
Display Output:
lcd.print("IV BOTTLE: "); lcd.print(liter); lcd.print("mL");
lcd.print("IV Bag Percent: "); lcd.print(val); lcd.print("%");
Buzzer Alert Logic:
if (val <= 50 && val >= 40){
Blynk.logEvent("iv_alert","IV Bottle is 50%");
digitalWrite(BUZZER, HIGH); delay(50);
digitalWrite(BUZZER, LOW); delay(50);
}
else if (val <= 20){
Blynk.logEvent("iv_alert","IV Bottle is too LOW");
digitalWrite(BUZZER, HIGH);
}
else{
digitalWrite(BUZZER, LOW);
}
- Below 20%: Constant buzzer + alert.
- Between 40% and 50%: Quick beep + alert
- Above 50%: No buzzer.
Send Data to Blynk:
Blynk.virtualWrite(V0,liter);
Blynk.virtualWrite(V1,val);
- Send IV level (mL) to V0.
- Send IV percentage to V1 (for dashboard display).
Outputs and Results:
TUTORIAL FOLLOWED:
Here’s a detailed walkthrough of the project in action. The tutorial video demonstrates the setup, working, and results to help you easily replicate the build.
Comments