Skip to content
zanppaPublic

About

DIY VO2Max measurement spirometer

Resources

Stars

4 stars

Watchers

2 watching

Forks

Latest commit

 

History

42 Commits

Folders and files

Repository files navigation

Vo2max

A portable and affordable DIY spirometer project to measure VO2 Max during an excercise. This is still a prototype and heavily in development.

This project turned out to be a complete rewrite and redesign of Ivor Hewitt's VO2max spirometer project, which in turn was based on Rabbitcreek's project.

The main idea was to have a fully 3D printable system, but printing the mask part turned out to be difficult so the current version uses parts from a commercial (but affordable) mask. There are plans to develop a model that can be 3D printed with soft material (TPU/TPE).

Current features:

  • Exhalation volume measurement (with calibration function)
  • Exhalation oxygen level measurement (with calibration function)
  • VE and VO2(max) calculations
  • Ambient pressure and temperature measurement for reducing measurements to STDP
  • Bluetooth LE heart rate sensor support
  • Streaming data over WiFi to computer
  • PC companion program to monitor and record the WiFi stream
  • Recording values to memory buffer (1024 samples, at 15 s calculation interval over 4 hours)
  • Storing recorded values to a file (single file in flash, retained over power off)
  • PC tool to read and store the recorded values
  • Bluetooth Golden Cheetah support as VO2 Master (based on Ihewitt's code)

Main architectural changes in the code:

  • Restructured to use FreeRTOS tasks
  • Time-accurate sampling of sensors, e.g. air flow is measured every 20 ms
  • Lower priority tasks like bluetooth, wifi and display do not interrupt sensor reading
  • Code is divided to "sub modules" for easier upkeep

Usage

This VO2Max measurement device is designed to have two operation modes:

  1. Stand-alone use. In this mode the device is used independently and handles all calculations internally. Values can be monitored from the device's display, and the data is stored to memory (and optionally to flash memory). The stored values can later be transferred to a computer via WiFi.
  2. Real-time monitoring mode. In this mode a computer is connected to the device via WiFi and all measured quantities are transferred to the computer in real time. The computer can record the values and/or do the calculations (of course, also the VO2Max's calculated values are transferred).

For detailed usage info see how-to-use.md.

Hardware

This is a listing of the hardware that is used and supported by the code and 3D models. Some of the hardware were different from the reference projects for availability reasons in the EU, or due to technical reasons like mounting.

  • A rubber (silicone?) half face dust mask with detachable parts, see links/pictures below
  • LilyGo T-Display ESP32 development board with 1.14" display
  • DFRobot SEN0322 Gravity: Electrochemical Oxygen sensor (0-25% Vol, I2C)
  • Sensirion SDP801 Digital +/-500Pa differential pressure sensor, I2C, manifold connection
  • Bosch BMP388 ambient pressure sensor (e.g. DFRobot SEN0251 Gravity: BMP388)
  • Thread forming 2.5x8mm screws (6 pcs) (e.g. Bossard 3034065) and 2.5x16mm screws (2 pcs) (e.g. Bossard 3034077)
  • 14500 size Lithium-ion battery and suitable connection parts (spring terminals or similar)
  • 2 pcs of 4.5 x 1.5 mm O-rings

Where to buy

Most of the necessary electronics components were bought from Mouser.

The display and half mask was bought from Aliexpress. Many stores had similar masks so a random, somewhat professional looking one was selected and the mask that was received was ok. Prepare for a long delivery time, 6 weeks or so.

Links to the main components that were used are below with their price at the time of building (incl. VAT etc.).

Component Source Price
DFRobot Sen0322 Mouser 50.13 €
Sensirion SDP801 Mouser 30.50 €
DFRobot SEN0251 BMP388 Mouser 6.42 €
Lilygo T-Display 16MB CH9102F Aliexpress lilygo Official store 16.18 €
Dustproof half-mask Aliepress CKE-Labour Pro Store $ 6.24

Assembly

Valve assembly

Exhalation and inhalation valves are required. Valve itself consists of two 3D printed parts (body and membrane holder), membrane template and the membrane itself. In addition, inhalation valve needs a counterpart for mounting. Current design uses two different sizes of valves due to how the commercial mask was built.

  1. Print all the valve parts
  2. Using the template, cut the membrane from suitable material. Rubber glove can be used as the membrane. One may experiment with different materials
  3. Insert the membrane into the valve body
  4. Place the membrane holder on the membrane. Carefully push the ends of the holder slightly and rotate the holder into the clips. Take care to ensure that the membrane is still centered and has no wrinkles

I2C distribution board

A simple I2C distribution board is needed to be mounted on top of the Sensirion SDP801 sensor. This also helps in mounting the sensor.

Mill or etch and drill or order the board, and then solder the sensor wires to them. I recommend measuring the wires yourself but the lengths of the wires are roughly:

  • 20 cm for the oxygen sensor
  • 16 cm for the ambient pressure sensor
  • TBD cm for the display/processor

I recommend routing one sensor wire from the backside and other wires from the front.

Also solder 1.3 kOhm pull-up resistors between VDD and SDA and SCL.

Finally the Sensirion SDP801 can be soldered to the distribution board.

Main body assembly

Main body consists of a single 3D-printed main part. Support is needed at the bottom parts and about 6 mm outer brim should be used to ensure that the part stays upright. With a bed-slinger printer, orient the print so that the wide side is parallel to the moving axis.

  1. Print the body and remove all support material
  2. Mount the oxygen sensor on top with 4x 2.5x8mm screws
  3. Mount the ambient pressure/temperature sensor on the side with 2x 8mm screws
  4. Place the O-rings on the recesses of the pressure sensor location
  5. Mount the SDP801 pressure sensor with 2x 2.5x16mm screws
  6. Wire the battery terminals to the T-display battery connector
  7. Install the battery terminals and connect the connector to T-display
  8. Place the display on the front of the unit
  9. Carefully measure cables, cut and solder them, removing parts from the body if necessary during soldering
  10. Use 1.3 kOhm external pull-up resistors for I2C SDA and SCL (preferably soldered to the I2C distribution board)

Note that the battery terminals nor the power switch are currently included in the model. One should find suitable parts for this and glue them in place.

The battery holder might be a bit tight, so some sanding/cutting of the edges may be necessary.

Flashing the firmware

The firmware was built with PlatformIO v core 6.1.18, home 3.4.4. One needs to install lilygo-t-display board (or it may get installed automatically when building...)

Following external libraries are needed:

  • TFT_eSPI (version 2.5.34)
  • NimBLE-Arduino for Bluetooth LE (version 1.4.1)

Other drivers are included in the repository with necessary modifications.

To build the software select following as the board settings:

  • Board: Lilygo-t-display
  • Upload Speed: 921600
  • CPU Frequency: 240Mhz (WiFi/BT)
  • Flash Frequency: 80Mhz
  • Flash Mode: QIO
  • Partition Scheme: Default.csv [4MB with spiffs (1.2MB APP/1.5 SPIFFS)]
  • Core Debug Level: None --> For debugging can set also different values, for release select None
  • PSRAM: No

Disclaimer

This is not a medical device! Use at your own responsibility.

This repository contains code, models and similar for educational purposes only and are supposed to be used for reference. Everything is provided as is, without any warranty. The author is not liable for any damages or other liability arising from use of anything provided here.

Copyright

Copyright 2024, 2025 Lauri Peltonen

Licensed under GPLv3.

Drivers included in this repository may have their own licenses which are included in the relevant source files.

About

DIY VO2Max measurement spirometer

Resources

Stars

4 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages