The Glucose Monitor is an advanced breath-based glucose monitoring system that utilizes a Raspberry Pi, sensors, machine learning, and a graphical user interface (GUI) to estimate glucose levels non-invasively. This project is ideal for demonstrating skills in hardware integration, machine learning, and software development.
The system predicts glucose levels based on acetone levels detected in breath using a Random Forest regression model. It features real-time monitoring, data logging, and visualization capabilities.
- Sensor Integration: Reads acetone levels using the MQ-138 sensor connected to a Raspberry Pi via MCP3008 ADC.
- Machine Learning: Predicts glucose levels using a trained Random Forest regression model.
- Interactive GUI: Displays real-time glucose level estimates with a Tkinter-based interface.
- Data Logging: Logs sensor readings and predictions to a CSV file for later analysis.
- Expandable Architecture: Modular codebase for easy extension and scalability.
- Real-Time Updates: Continuously updates glucose level predictions every 2 seconds.
Glucose_Monitor/ ┣━ main.py # Main program entry point ┣━ gui.py # GUI-related code ┣━ sensor.py # Sensor reading logic ┣━ model.py # Machine learning model training and prediction ┣━ utils.py # Utility functions (data logging, alerts) ┣━ data/ ┃ ┗━ glucose_log.csv # Logs of glucose readings ┣━ requirements.txt # Python dependencies ┗━ README.md # Project documentation
This project requires the following hardware and software:
- Raspberry Pi (any model with GPIO support)
- MQ-138 gas sensor (for acetone detection)
- MCP3008 ADC (Analog-to-Digital Converter)
- Jumper wires and breadboard
- Python 3.7 or higher
- Libraries (see
requirements.txt)numpypandasscikit-learnmatplotlibRPi.GPIOtkinter
- Clone this repository:
git clone https://github.com/yourusername/Glucose_Monitor.git cd Glucose_Monitor
- Install the required Python libraries:
pip install -r requirements.txt
- Set up your Raspberry Pi hardware:
- Connect the MQ-138 sensor to the MCP3008 ADC.
- Wire the MCP3008 to your Raspberry Pi GPIO pins as specified in
sensor.py.
- Run the program:
python main.py
- Launch the program by running
main.py. - The GUI will display real-time glucose level predictions based on acetone readings from the sensor.
- The system updates every 2 seconds.
- All sensor readings and predicted glucose levels are automatically saved to
data/glucose_log.csvfor future analysis.
- You can extend the project to send alerts via email or SMS if glucose levels exceed safe thresholds (see
utils.pyfor customization).
- Sensor Reading:
- The MQ-138 sensor measures acetone levels in breath.
- The Raspberry Pi reads these values via MCP3008 ADC.
- Machine Learning Model:
- A Random Forest regression model predicts glucose levels based on acetone values.
- The model is trained on simulated data but can be updated with real-world data.
- GUI:
- A Tkinter-based GUI displays real-time glucose estimates.
- Users can monitor their predicted glucose levels interactively.
- Data Logging:
- Sensor readings and predictions are logged into a CSV file for analysis and visualization.
Here are some potential ways to expand this project:
- Cloud Integration:
- Send data to a cloud platform (e.g., AWS IoT or Firebase) for remote monitoring.
- Mobile App:
- Create an Android/iOS app to display real-time glucose data.
- Improved Machine Learning:
- Use more advanced models like Gradient Boosting or Neural Networks.
- Real Data Integration:
- Train the model with real-world breath-based glucose datasets.
- Alerts & Notifications:
- Integrate Twilio or an email API to send notifications when glucose levels are abnormal.
This project is open-source under the MIT License.
Special thanks to open-source contributors and developers who maintain libraries like Scikit-learn, Matplotlib, and RPi.GPIO, which made this project possible.