Accurately Measure Respiratory Health with This ESP32-Based Device

This wearable mask wirelessly transmits current VO2 max information to iPhones via the Zwift app for aerobic fitness tracking

Fitness tracking

Whether a person is running, cycling, running, or even just sitting still, their body is constantly taking in oxygen, combining it with water and an energy source, and then expelling carbon dioxide. This process, called respiration, is how most organisms get their usable energy, and expending more energy usually increases the amount of oxygen required. This is why measuring the maximum rate of oxygen (VO2 max) consumed can be a great indicator of athletic fitness/performance.

The plan

Instructables user rabbitcreek wanted to create their own VO2 max measurement device that would not only be accurate, but also inexpensive. His plan was to combine an oxygen sensor, a pressure sensor, and a microcontroller into a single device that could compete with a lab-grade VO2 max system, which can cost upwards of around $60,000.

Required components and wiring

The microcontroller for this VO2 max project is an ESP32, and it was selected for several different reasons. First, it contains a fast processor that enables it make fast calculations for real-time monitoring. Second, it has wireless connectivity in the form of WiFi and Bluetooth, which allow it to communicate with a phone for greater portability. And finally, its Arduino-compatibility makes writing code extremely fast. Apart from the ESP32 + 1.14" LCD board, rabbitcreek added a differential pressure sensor and an oxygen sensor that both communicate over the I2C protocol. Power for the entire thing is provided by a 1000mAh battery in order for users to wear the mask for long workouts.

Printing a housing and assembling the device

For the core of the device, several parts were designed and 3D printed from PLA plastic due to its flexibility and lightweight nature. The center is comprised of a venturi tube that lets in air from the outside and passes it to the sensors for measurement. The ESP32 and other electronics all mount to a separate housing, which is combined with the tube, and finally, a respirator attaches to the tube with an adapter. After everything had been soldered together and set within the enclosure, rabbitcreek moved onto the last step of programming the system.

Programming

Two separate programs were created in order to give the options of using either Zwift or a custom iPhone app for tracking sensor data over time. Once the device has booted, the user can enter their weight and then press the "Go" button for their workout to start. In an infinite loop, the ESP32 waits for a drop in pressure caused by a breath and calculates the volume of air taken in. Oxygen levels are then measured every five seconds, and every thirty seconds, the air volume and oxygen values are used to compute the volume of expired O2, the amount of CO2, and most importantly, the VO2 max result.

Tracking VO2 max

After taking his device to a lab at the University of Alaska, rabbitcreek performed several tests that compared his DIY solution to a proper off-the-shelf one. As a pleasant surprise, the unit performed quite well and had only minor errors, making it a suitable alternative for non-medical use. Combined with the Zwift compatibility and built-in screen, this VO2 max system is a highly cost-effective alternative.

To read more about this project, you can visit its write-up here on Instructables.

Evan Rust
IoT, web, and embedded systems enthusiast. Contact me for product reviews or custom project requests.
Latest articles
Sponsored articles
Related articles
Get our weekly newsletter when you join Hackster.
Latest articles
Read more
Related articles