Add Digi key my-list : https://www.digikey.in/en/mylists/list/AHHRJBQX17
Portable ventilator system that combines real-time patient monitoring, automated ventilation control and cloud connectivity. The device collects data from multiple sensors such as heart rate, ECG and temperature, filters it, and applies safety checks to detect abnormal conditions. Based on this data, the ESP32 controls a motor-driven Ambu bag mechanism to maintain accurate and safe ventilation. All readings are synced to a secure cloud dashboard, allowing doctors to monitor patients remotely . Designed for scalability, it can be deployed from prototypes to rural centers and large-scale healthcare environments.

Technical Approach:

1. Input Layer – Patient Data Collection
The system collects all necessary patient parameters from different sensors:
- ECG Sensor – captures cardiac signals.
- Airflow Sensor – measures inhalation/exhalation airflow..
- Temperature & Pressure Sensor (BMP280) – monitors pressure inside the Ambu bag and patient temperature.
- Pulse Oximeter – measures SpO₂ (oxygen level) and heart rate.
All these signals move into the processing section.
2. Data Acquisition and Filtering
This block reads raw sensor data and removes:
- noise
- fluctuations
- invalid spikes
It prepares clean, stable data for decision-making.
3. Safety Checks & Thresholds
The system checks if any reading crosses safety limits:
- Low/high oxygen level
- High pressure
- Abnormal heart rate
- Faulty airflow
If anything becomes unsafe → an abnormal value alert is triggered.
4. Motor Control Logic (Ventilation Control)
Using the safe and filtered sensor data:
- ESP32 adjusts the servo motor
- Motor compresses the Ambu bag accurately
- Control is based on:
- pressure
- patient needs
- manual or automated mode
This ensures stable and safe ventilation.
5. IoT & Cloud Layer
The ESP32 sends all processed data to the cloud:
→ Blynk Cloud
- Live dashboards
- Secure login
- Graphs and trends
→ Firebase
- Stores the data
- Allows doctors to view real-time parameters remotely
8. Deployment and Scalability Layer
After prototype testing:
- Prototype Phase
- Pilot Testing in Rural Health Centers
- Large-Scale Deployment
- CSR and Government Integration
Code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#include "MAX30105.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// ====================== I2C PINS (ESP32-C6) ======================
#define I2C_SDA 6
#define I2C_SCL 7
// ====================== LCD ======================
LiquidCrystal_I2C lcd(0x27, 16, 2);
// ====================== OLED ======================
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
// ====================== Sensors ======================
Adafruit_BMP280 bmp;
MAX30105 particleSensor;
// ====================== PINS ======================
const int ecgPin = 4; // ECG analog OUT
const int buzzer = 18;
const int led = 23;
// ====================== ECG GRAPH VARS ======================
int ecgX = 0;
int prevX = 0;
int prevY = 32; // center line
unsigned long lastGraph = 0;
// ====================== BPM DETECTION VARS ======================
unsigned long lastBeat = 0;
int bpm = 0;
// ====================== LCD Update Timer ======================
unsigned long lastLCD = 0;
// ====================== SETUP ======================
void setup() {
Serial.begin(115200);
// I2C INIT
Wire.begin(I2C_SDA, I2C_SCL);
pinMode(buzzer, OUTPUT);
pinMode(led, OUTPUT);
// ---------------- LCD ----------------
lcd.init();
lcd.backlight();
lcd.clear();
lcd.print("Initializing...");
delay(1000);
// ---------------- OLED ----------------
if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println("OLED Failed!");
}
oled.clearDisplay();
oled.display();
// ---------------- BMP280 ----------------
if (!bmp.begin(0x76)) {
lcd.clear();
lcd.print("BMP280 Error!");
while (1);
}
// ---------------- MAX30105 ----------------
if (!particleSensor.begin(Wire, I2C_SPEED_STANDARD)) {
lcd.clear();
lcd.print("MAX30105 Error!");
while (1);
}
particleSensor.setup();
particleSensor.setPulseAmplitudeRed(0x2F);
particleSensor.setPulseAmplitudeIR(0x2F);
lcd.clear();
lcd.print("System Ready");
delay(800);
lcd.clear();
}
// ====================== ECG GRAPH (FULL SCREEN FIXED) ======================
void drawECG(int val) {
// --- Auto Scaling Values ---
int minVal = 1500; // adjust if needed
int maxVal = 2500;
// clamp signal
if (val < minVal) val = minVal;
if (val > maxVal) val = maxVal;
// map to full OLED height
int y = map(val, minVal, maxVal, SCREEN_HEIGHT - 1, 0);
// draw line from previous point
oled.drawLine(prevX, prevY, ecgX, y, SSD1306_WHITE);
prevY = y;
prevX = ecgX;
ecgX++;
// clear screen on right edge
if (ecgX >= SCREEN_WIDTH) {
ecgX = 0;
prevX = 0;
oled.clearDisplay();
}
oled.display();
}
// ====================== LOOP ======================
void loop() {
// ----- Read sensors -----
float temperature = bmp.readTemperature();
float pressure = bmp.readPressure() / 100.0;
long irValue = particleSensor.getIR();
// ----- BPM Detection (Simple Peak Detect) -----
if (irValue > 50000) {
unsigned long now = millis();
int dt = now - lastBeat;
if (dt > 350) {
bpm = 60000 / dt;
lastBeat = now;
}
}
// ----- ECG Read -----
int ecgValue = analogRead(ecgPin);
// ----- ECG Graph Update -----
if (millis() - lastGraph > 8) {
lastGraph = millis();
drawECG(ecgValue);
}
// ----- LCD Update -----
if (millis() - lastLCD > 1000) {
lastLCD = millis();
lcd.setCursor(0,0);
lcd.print("BPM:");
lcd.print(bpm);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print("T:");
lcd.print(temperature,1);
lcd.print("C ");
lcd.print("P:");
lcd.print(pressure,1);
lcd.print(" ");
}
// ----- Serial Monitor -----
Serial.print("ECG=");
Serial.print(ecgValue);
Serial.print(" BPM=");
Serial.print(bpm);
Serial.print(" Temp=");
Serial.print(temperature);
Serial.print("C Press=");
Serial.println(pressure);
}
Output:


Conclusion:
The Portable ventilator system demonstrates a reliable, intelligent, and affordable solution for delivering safe respiratory support. By integrating multi-sensor monitoring, automated motor-driven ventilation, and cloud-based remote access, it ensures continuous and accurate patient care. Its portable design and battery backup make it suitable for rural clinics, emergency settings, and low-resource environments. Overall, the system offers a scalable, practical, and impactful approach to improving accessible healthcare.

Final work:

video:
