8000
Skip to content

Latest commit

 

History

153 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MediCare: Smart Cold Storage and Inventory for Clinical Medications

Prototype system for monitoring fridge temperature and tracking medication shelf life at St. Olav's Hospital's physical-medicine outpatient clinic, in order to reduce avoidable waste of local anesthetics.

Elias Drøpping, Arya Raeesi, Jon Arne Lund,
Sven Kristian Helland, Henrik Alstadhaug, Asil Zogby
All authors contributed equally to this work.

TTT4270 Elektronisk systemdesign, prosjekt — NTNU, Spring 2024

Project Report (PDF)

Overview

The physical-medicine outpatient clinic at St. Olav's University Hospital stores local anesthetic (lidocaine) and cortisone in a refrigerator that must stay between 2 and 6 °C. Today, the fridge temperature is logged by hand once a day, open-vial shelf life (usable for 3 days after opening) is written on each vial with a pen, and unopened-vial expiry dates are tracked manually by the secretaries.

This manual routine is a source of avoidable waste (svinn) and patient risk. If the fridge door is left ajar overnight, or the unit fails after the daily check, the problem is not discovered until the next manual reading — by which point the medication may already be unsafe. Hand-written dates and mental arithmetic are easy to get wrong in a busy clinical day.

MediCare is a hardware-and-software prototype that automates these three tasks so the staff no longer have to remember, write, or calculate dates by hand.

Core Idea

The problem decomposes into three independent subsystems, each targeting one failure mode of the current routine:

Subsystem What it does Key requirements
Temperature monitoring Measures fridge temperature continuously, stores it in a database, shows live and historical values on a web page, and sends an SMS alert when the temperature leaves the 2–6 °C band. E, F, G, H, I
Open-medication rack Starts a countdown when an opened vial is placed in its holder and shows a green/red LED indicating whether the 3-day open shelf life has expired. B, E
Rotating rack (unopened) Reads the expiry date from the package QR code, rotates so the soonest-to-expire vial is always at the front, and lights an LED when the front vial has expired. B, C, D

Together these enforce correct storage and surface expiry information automatically, removing the hand-written-date error sources described in the report.

Project Goals

  • Continuously verify that medication is stored within the required 2–6 °C range and alert staff immediately on deviation.
  • Persist temperature history so the clinic can document compliance and review what actually happened over time.
  • Replace hand-written open-vial dates with an automatic countdown and a clear green/red indicator.
  • Make the vial closest to expiry the easiest one to reach, so stock is used in the right order.
  • Reduce avoidable waste of expensive, short-shelf-life anesthetic without changing the staff's day-to-day workflow.

System Architecture

System architecture

Layer Location in repo Stack
Temperature sensing i2c/ C, Bosch BME680 / BME68x driver
Backend API react-app-elsys/server/ Node.js, Express, MySQL
SMS ale 85C0 rts react-app-elsys/server/sms.py Python, ClickSend
Web frontend react-app-elsys/src/ React, TypeScript, Vite
Open-vial rack motor/, arduino/CountDown/, arduino/stativ/ Python (RPi.GPIO), Arduino C++
Rotating rack camera/, motor/ Python, OpenCV, servo (PWM)

Data Pipeline

The temperature subsystem is the most fully developed and follows this flow:

  1. The microcontroller reads the BME680 sensor over I2C.
  2. Readings are written to the MySQL temperatur table every 10 seconds.
  3. The Express server exposes the data through a small REST API:
    • /api/lasttemperature — most recent reading.
    • /api/data — average temperature over the last hour.
    • /api/data2 — down-sampled array for the live graph.
    • /api/data1 — weekly report: per-day average, min, max, and minutes spent out of range.
  4. The React frontend polls these endpoints, colors the displayed temperature (red/blue out of range, green in range), and offers a downloadable weekly CSV report.
  5. When the running average leaves the allowed band, server.js triggers sms.py, which sends an SMS alert to designated staff via ClickSend.

Why This Matters

Local anesthetic is expensive, has a short open shelf life, and becomes ineffective or unsafe when stored at the wrong temperature. The current paper-based routine cannot catch a fault until the next manual check, and relies on staff correctly writing and calculating dates under time pressure. Automating temperature monitoring and expiry tracking closes those gaps directly: it shortens the time-to-detection of a cold-chain failure from up to a day down to minutes, and it removes the hand-written-date error sources entirely.

Validation

The report (Section 5) documents verification and validation of the prototype:

  • Temperature accuracy was checked against a reference to confirm the system requirement of at most 0.5 °C deviation from the true temperature.
  • Web page and reporting were verified to display live values, color-code out-of-range readings, and produce the downloadable weekly report.
  • Open-vial rack was tested for correct countdown and green/red transition at the 3-day boundary.
  • Rotating rack was tested for QR expiry reading and rotating the soonest-to-expire vial to the front.

The temperature subsystem is the most complete. The two rack subsystems are working prototypes; user requirement J (full inventory control over the entire stock) was scoped out due to budget, time, and equipment constraints, with a proposed design sketched in the report's appendix.

Repository Layout

i2c/             BME680 / BME68x temperature sensor drivers (C)
react-app-elsys/ Web app: React + Vite frontend, Express + MySQL backend, SMS script
camera/          OpenCV QR-code reading for the rotating rack
motor/           Servo and LED control (Raspberry Pi GPIO)
arduino/         Countdown timer and rack control (Arduino / PlatformIO)
plotting/        Supporting analysis scripts
docs/            MediCare.pdf project report

Acknowledgements

We thank the staff at St. Olav's University Hospital's physical-medicine outpatient clinic — in particular Lise Marita Aune — for describing their workflow and storage routines, which formed the basis for the user requirements and the focus of this project. This work was carried out as part of the course TTT4270 Elektronisk systemdesign at NTNU.

License

This project is licensed under the MIT License. See LICENSE for details.

About

Smart medical-fridge system for anesthetic storage: live temperature monitoring, expiry tracking, and SMS cold-chain alerts (BME680, Raspberry Pi, Express/MySQL, React).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0