Spira - a Pocket Friendly Spirometer
by xJaagrav in Circuits > Assistive Tech
73 Views, 2 Favorites, 0 Comments
Spira - a Pocket Friendly Spirometer



Spirometers are an important part of the lives of patients suffering from lung related illnesses, cardiothoracic surgery recovering patients and more. It is essential for patients to regularly exercise their lungs with help of these devices in order to recover quick and also have a healthy set of lungs. However with the current devices available in the market, patients tend to forget about exercising their lungs regularly, and more over, these devices are massive and tough to carry around. My goal with this project was to build a sleek and small device that would allow it's users to get the value that a spirometer provides, and use the power of technology to achieve beyond what traditional spirometers offer. By integrating smart features such as reminders, lung exercise games, and real-time feedback through a connected app, this device not only encourages consistent usage but also provides deeper insights into respiratory health. The aim is to make lung rehabilitation and monitoring more accessible, engaging, and effective—anytime, anywhere.
From the image I guess you can tell, Spira is remarkably smaller as compared to traditional spirometers, and I am working on an app that will allow users to use Spira to exercise their lungs.
Supplies
For building Spira, here are the following ingredients you'll need:
- Seeed Studio XIAO MG24 Sense (You could also use XIAO nRF52840 or XIAO ESP32C3). However I have still not found a proper solution to deal with ADC noise with these XIAO SoCs. I expected the noise to be lesser but it's more or less the same similar to the issue I faced in Cardiogram, for this project though you could use a 0.1 µF ceramic capacitor between the VCC and GND of the differential pressure sensor for better results.
- MPX10DP differential pressure sensor: You could also ADP800, this sensor was not available at the time I was looking for pressure sensors, but I see now it's available on robu.in, so I'll try to get this sensor and eventually update this instructable if I see a better outcome. There's also MPX5010DP, which is a newer version of the sensor I ended up using, so you could look into that as well. It is a bit more expensive though. The sensor I got is not only cheaper compared to ADP800 and MPX5010DP, but also sort of outdated.
- Slide Switch SS-12D07 1P2T
- 500 mAh 3.7v battery
Designing and 3D Printing




This has lately become my new passion. I often find myself working hard on designing 3D models, and am actually now aiming to become a professional industrial designer. I think I have a crush on Fusion, feels like a super power to design what I have in my mind and a couple hours later I have it in my hand. Thanks to my previous project, Cardiogram, it won the second prize in the Make It Wearable Contest, I was able to buy myself my own 3D printer. I went with the Bambu Lab A1 Mini with a 0.2mm nozzle, as I've used it earlier at my friend's place.
The 3D model includes of 4 main parts and here I'll explain why I designed them the way I did:
- Nozzle: This piece printed using PETG PRO translucent filament, is the piece that will go into the mouth of the users so you can consider TPU as well for this, as this part is required to be flexible since it will connect directly to our differential pressure sensor. As this pressure sensor does not allow airflow, there's a secondary hole present to allow airflow while recording the air pressure to allow inhaling and exhaling of air, essential for spirometers. For the best quality print, print it vertically with the pipe as the base and added support for the nozzle part. If you see in the image, I have printed the nozzle part with translucent PETG PRO, where as the pipe part using TPU. I needed the pipe part to slightly stretch as it will be essential with fixing on the nozzle of our differential pressure sensor.
- The Toggle Switch: Responsible for turning Spira on/off, this little knob is designed for a very specific type of toggle switch. The switch I am using for this project, I extracted from a broken toy drone. However I have a feeling it's the SS-12D00 1P2T slide switch. You can try out whichever slide switch works for you, though you will need to make sure it fits perfectly by modifying my design. Also if you're using exactly the same switch, then make sure to 3D print the knob such that the handle hole faces upwards.
- The front and rear shell: These two shells are designed in such a way so that they slide on to each other and stay connected to each other with the help of the friction created by the layer lines. It can then easily be slid out in order to access the internals. Print both of them vertically with support as shown in the GIF.
Building the Circuit


Now in this circuit, I used the MPX5100DP sensor, it's because it was the only sensor model present on cirkit designer. However even with my MPX10DP sensor, the connections are exactly the same. If you're using the MPX10DP sensor, then see the other pin diagram I have attached.
I have also implemented a low pass filter in order to filter out noise as much as possible, but you could experiment on your own, whatever works best for your sensor. Also it is recommended to run the sensor at 5V, now the XIAO SoCs do not have a voltage booster or 5V output like the Arduino UNO. However these sensors do work at 3.7V, just that the final analog output will not be accurate enough. Though you can fix it later in code and have custom logic for calculating the pressure at 3.7V. For this project, as this is just an exercising device, I just needed to know the pressure delta, with which we could later on build games for exercising the user's lungs.
One more thing, for the battery you'll notice I added a separate wire with a diode, that will make sure that the battery can be charged by the XIAO MG24 Sense, even when the switch is turned off. It will also make sure that the current does not flow in the reverse direction when the switch is turned off, to avoid the MG24 sense from turning on while it's supposed to be off, while leaving a closed circuit for us to charge the battery using the MG24 Sense's type-C port.
I am learning how to design PCBs so in the following months, I will build custom PCBAs for all my projects to make it easier to build these projects without needing to solder too many wires and components.
Assembling the Final Product


Assembly is pretty straightforward, basically your goal is to cram everything inside our 3D printed casing. Trust me there's enough space for everything. There is a type C port cut out at the bottom of one of the shells on top of which you can super glue or stick your XIAO MG24 Sense, there's a small cavity for the toggle switch as well.
Developing the App & Writing the Firmware

This part is currently a work-in-progress, but I am currently working on a SwiftUI iOS app that will allow users to exercise their lungs and get notifications in a customizable cadence to regularly perform their breathing exercise. The code for it will be done soon, till then here's what I have got so far.
The main features I am working on for this app are:
- Connecting to Spira using BLE
- Setting reminders and frequency of these reminders to remind the user to exercise their lungs
- Exercise sessions where a user must close the rings by vigorously inhaling and exhaling air, the intensity of which will increase with time as the user gets better and their lungs build a higher stamina.
Once I am done with the code, this instructable will be updated with the app and firmware code. Stay tuned!