CMC-Spiro: A Low-Cost, Disposable Spirometer Built During COVID

A Wi-Fi spirometer made from a PVC pipe, a mesh screen and a disposable blood pressure transducer, streaming flow to a browser.
Healthcare
Signal Processing
Author
Published

October 6, 2020

In 2020, spirometry became a problem. Breathing hard into a shared device is one of the easiest ways to spread a respiratory virus, and spirometers were scarce anyway. At CMC Vellore’s Department of Physiology, under Dr. Sathya Subramani and Dr. Suresh R. Devasahayam, I built CMC-Spiro: a spirometer cheap enough that the part the patient breathes through can be thrown away.

Code and CAD files: Zilch123/CMC-Spiro

The CMC-Spiro prototype

How it measures flow

CMC-Spiro is a pneumotachograph. Air flows through a tube with a fine mesh screen across it. The mesh adds a small resistance, so there’s a pressure drop across it, and for the flows in normal breathing that drop is proportional to the flow rate. Measure the pressure difference and you know the flow. Integrate flow over time and you get volume.

The parts are all cheap or already in a hospital:

  • Flow tube: a PVC pipe with a mesh screen. It’s the only part the patient breathes through, so it can be disposable. I also made a 3D model of the flow tube (STL and STEP files are in the repo).
  • Pressure sensor: a disposable blood pressure transducer, the kind used in ICUs for arterial lines. It’s sensitive, cheap, and available in any hospital.
  • ADC: an HX711, a 24-bit ADC designed for load cells. A load cell and a pressure transducer are both Wheatstone bridges, so it works well here too. The first prototype used a 16-bit ADS1115; I switched to the HX711 later.
  • Microcontroller: an ESP8266 (NodeMCU), which reads the ADC and serves the data over Wi-Fi.
  • Power: a phone battery, so the whole thing is portable.

Hardware and software overview

Streaming to a browser

There’s no app to install. The ESP8266 runs a small web server, and its web page is stored in the chip’s flash memory. Open the page from any phone or laptop on the same network, and it connects back to the ESP8266 over a WebSocket.

The firmware loop is short: read the ADC, wrap the value in JSON, broadcast it:

void loop() {
  webSocket.loop();
  server.handleClient();
  xn = cell.read();
  String json = "{\"value\":";
  json += xn;
  json += "}";
  webSocket.broadcastTXT(json.c_str(), json.length());
  delay(10);
}

The page plots the flow live with Plotly and has buttons that follow a spirometry test:

  1. Baseline: record the resting signal, so the zero-flow offset can be subtracted.
  2. Maximal inspiration: the subject breathes in as deeply as they can.
  3. Maximal expiration: the subject breathes out fully. The page then integrates the baseline-corrected flow and shows the volume and the duration.
  4. Download: save the recording as a text file.

The volume comes from the trapezoidal rule on the baseline-corrected signal:

for(i=0; i < (time_auc.length-1);i++){
  tempAUC = 0.5*(baseline_corrected_y[i]+baseline_corrected_y[i+1])*(time_auc[i+1]-time_auc[i]);
  AUC_array.push(tempAUC);
  auc_value += tempAUC;
}

There are keyboard shortcuts too (b for baseline, i for inspiration, e for expiration, d to download), which helps when you’re coaching a subject and don’t want to hunt for buttons.

Calibration

The ADC gives raw counts, not litres per second. To convert, I needed a known flow. The lab had a Douglas volume meter, so I connected CMC-Spiro in line with it and used a vacuum cleaner as the air source, with a tap to control the flow rate.

Calibration setup: vacuum cleaner, flow control tap, Douglas volume meter and CMC-Spiro

At each flow rate I recorded the ADC value and the reference flow, in both directions, since breathing goes both ways. The relationship came out linear, with an R² of 0.989:

ADC values against actual flow rate

So converting counts to flow is a single line:

flow (L/s) = 2.889e-05 × ADC − 239.16

What I learned

  • Hospital parts are underrated. A disposable BP transducer is a precise, cheap, sterile pressure sensor that’s already stocked.
  • The browser is a great display. Serving the UI from the microcontroller meant any phone or laptop could be the screen, with nothing to install.
  • Calibrate against something trusted. The Douglas meter turned raw counts into real units, and showed the sensor was linear across the breathing range.
  • Baseline drift matters. Small offsets add up fast when you integrate flow into volume, so subtracting a fresh baseline before each test was essential.