Inspiration
The inspiration for creating Mr. Breathe, the smart spirometer, was our observation of the lack of affordable, intelligent spirometers. Budget, analog spirometers are cheap but are not personalized to specific patient demographics (e.g., height, weight, sex) and thus are less accurate. "Smart" digital spirometers bundle expensive technology and cost thousands of dollars, meaning that individuals and underserved communities struggle to purchase them to preventatively diagnose themselves. Mr. Breathe is a spirometer that's both affordable and intelligent, that interfaces with already commonly-available technologies (i.e., smartphones with Bluetooth connections) to provide machine learning-powered patient risk analysis.
What it does
Mr. Breathe is a spirometer that collects breath flow data from users and sends it, along with profile information configured in our mobile app, to a secure machine learning model that computes risk factors for a variety of respiratory diseases, such as asthma or COPD (chronic obstructive pulmonary disease). These risk factor assessments can be initiated and conveniently viewed on the mobile app.
How we built it
Mr. Breathe's software and hardware components can be broken down into four overarching components:
- Edge Device: The Mr. Breathe spirometer acts as an edge device that collects user breath flow data when blown through and sends it to the Mr. Breathe mobile app via Bluetooth.
- The edge device is an Arduino Uno R3 with a Bluetooth module
- The device is housed in a 3-D printed chassis designed in OnShape
- When the user blows into the spirometer, a fan connected to a motor is spun
- The voltage of the motor is utilized to compute the user's breath flow
- On-device C++ code relays the breath flow to the mobile app via Bluetooth Low Energy
- Mobile App: The Mr. Breathe mobile app allows initiating and stopping risk factor assessments, which involve collecting breath flow data from the edge device and sending it to our backend.
- The mobile app was developed using React Native and was bundled using Expo Go.
- The Gluestacks component library was utilized to speed up frontend development.
- The mobile app communicates to our backend via REST API.
- User Management API: The User Management API is the portion of the backend responsible for authenticating and receiving requests from the frontend. When a request is received from the frontend, the backend retrieves user data from a PostgreSQL database and forwards relevant information and the breath data to the Model API.
- The User Management API queries and updates a PostgreSQL database containing user demographic information.
- The database interfacing and API logic is written in Java using Spring Boot and is packaged using Maven.
- The API specification is defined using OpenAPI (Swagger), which allows for a GUI webpage to test endpoints.
- Due to time constraints, instead of doing a multi-container cloud deployment, the entire backend was run using Docker Compose and tunneled using InstaTunnel.
- Model API: The Model API performs inference on the breath data and user profile information, returning a list of risk factors for various respiratory diseases.
- The Model API performs inference using a custom neural network trained using PyTorch.
- R was utilized for data analysis during the model training process.
- The API endpoint logic was written using FastAPI.
- The API specification is defined using OpenAPI and also has a GUI webpage to test endpoints.
- The Model API runs on a Docker container as a part of a multi-container application managed using Docker Compose.
Challenges we ran into
We ran into several challenges when building Mr. Breathe.
The first and most apparent one was the disconnect between team members that was a natural product of the division-of-labor strategy we utilized. With Ved working on the edge device, Rohan building the frontend, Kedar architecting the backend, and Shrey training the AI model, coupled with our limited availabilities, we built our respective tools with some assumptions about what inputs/outputs the connected services required. When it came time to bring everything together, some parts of the project broke and a lot of refactoring was required.
The second was the limited RAM available on the Arduino Uno. The Uno only has 2 KiB of RAM, which is a laughably small amount for sending voltage data through Bluetooth. We had to wrack our brains for a number of optimizations to ensure that our code ran on such an incredibly small amount of RAM.
Accomplishments that we're proud of
We're proud of successfully building a project that covers embedded programming, full-stack development, and machine learning. It required all of us to come together as a team and combine all of our specialties to make the product work in such a short amount of time.
We're also proud of our teamwork. Although there were some hiccups in integrating all of the moving parts together, everybody in the team put their best effort, and we were able to receive and give feedback productively.
What we learned
This project challenged us to learn new technologies to bring Mr. Breathe to life:
- Ved sharpened his CAD skills and furthered his knowledge on circuit design to design the hardware components of Mr. Breathe.
- Rohan learned the technologies that go into creating a cross-platform mobile app, as well as the design philosophies and quirks behind the React family of frameworks.
- Kedar furthered his SQL knowledge and added a new framework (Spring Boot) to his backend development toolkit, as well as how to design APIs from a microservices perspective instead of just from a frontend-backend viewpoint.
- Shrey adapted his machine learning model design philosophy from a pure research perspective to applied machine learning, processing noisy, real-world data to still provide accurate inferences and predictions.
What's next for Mr. Breathe
There are several steps we want to take to transform Mr. Breathe from a hackathon MVP to a production-ready product:
- Cloud Deployments: We want to translate our multi-container, locally hosted Docker Compose deployment to a cloud-hosted Kubernetes cluster.
- More Detection: We want to expand the number of respiratory diseases Mr. Breathe can perform risk analyses for.
- Smaller Size: We want to shrink the size of the Mr. Breathe spirometer to make it more accessible.
Built With
- 3d-printing
- arduino
- c++
- cad
- docker
- expo.io
- fastapi
- gluestacks
- instatunnel
- java
- jupyter
- lungs
- make
- maven
- onshape
- postgresql
- pydantic
- python
- pytorch
- r
- react-native
- spring
- typescript
Log in or sign up for Devpost to join the conversation.