Inspiration

For hospitalized patients at high risk of stroke, every second counts. However, a stroke often causes immediate paralysis or cognitive impairment, making it impossible for a patient to reach for a traditional “nurse call” button.

We were inspired to build a system that doesn't wait for a patient to ask for help, but instead observes environmental and physical indicators that something may be wrong.

Our goal was to design a zero-interaction safety layer that automatically detects distress signals and alerts caregivers immediately.

What it does

CareGuard is a zero-interaction patient monitoring system designed for stroke-risk hospital wards.

Passive Monitoring High-sensitivity motion sensors detect unusual or distress movement patterns without requiring the patient to press any button.

Environmental Context Tracking Temperature and humidity data are continuously recorded and analyzed. Sudden spikes can indicate abnormal room conditions or physiological stress.

Automated SOS Protocol When the system detects an emergency movement pattern, CareGuard automatically:

Captures a visual snapshot of the patient environment

Mints a tamper-proof NFT record on Solana

Stores sensor and spike data in MongoDB Atlas

Sends an alert email to caretakers

Logs the event permanently for auditing

AI Medical Context Assistant A chatbot powered by Gemini and Featherless AI analyzes recent environmental data, spike patterns, and SOS events to provide caregivers with contextual insights about the patient's condition.

Tech Stack

Tech Stack Diagram

Solana Devnet NFT SOS Protocol Pipeline Diagram

Pipeline Diagram

Solana Explore Link: https://explorer.solana.com/address/CGabybQQZuqM8oriZ5KqrYCupdsqqPeRnhDTZRLHiCGe?cluster=devnet

Pinata IPFS Link: https://olive-advanced-catshark-729.mypinata.cloud/ipfs/QmeCMe52McWmUZDGdResB4djCULLwUFNVg5uD3vHa3iCnm

How we built it

CareGuard integrates hardware monitoring, AI analysis, and blockchain event logging into one pipeline.

Hardware Layer

M5Stack motion sensor detects abnormal patient movement

Environmental sensor measures temperature and humidity

Arduino-Compatible C++ firmware code to Pyserial Python listener processes incoming sensor data

Backend Processing

Python FastAPI listener receives serial data from the device

Sensor data is saved to MongoDB Atlas

Spike detection algorithms identify abnormal environmental changes

Emergency Event Handling When an emergency threshold is triggered:

The system captures a webcam snapshot

The image is uploaded to IPFS

An NFT incident record is minted on Solana

Caretakers receive an automatic email alert

The event is logged for audit and verification

AI Context Layer The chatbot pulls the latest:

environment readings

spike data

SOS events

and sends them as context to:

Gemini AI

Featherless AI (Llama 3)

This allows the assistant to explain patient conditions and environmental trends in natural language.

Frontend Dashboard A Next.js dashboard displays:

real-time sensor readings

emergency alerts

NFT records

an AI assistant for caregivers

MLH Track - Solana

We use Solana NFTs to create an immutable record of emergency incidents.

Each SOS event mints a unique NFT containing:

IPFS image capture

timestamp

This provides tamper-proof medical event logging, ensuring that critical incidents can be audited and verified.

Imagine hacker already compromised our system and database, they can attack us by inserting fake image of patient and trigger our SOS trigger system. We prevent that by building this pipeline:

Motion Sensor -> Camera Capture -> Pinata Decentralized IPFS storage for image -> NFT mint on Solana Devnet -> Email alert to caretaker.

This pipeline allows no room for hacker inserting bad data/image to play our SOS trigger protocol.

Our SOS trigger Protocol is fully protected!!

MLH Track - Vultr

The system leverages Vultr Cloud Compute to host our mission-critical backend infrastructure. Because CareGuard is designed for stroke-risk patients, the "heartbeat" of the system cannot depend on local, restricted networks.

The "UTGuest" Pivot We spent several hours debugging our Python SMTP implementation, assuming the issue was with Gmail’s authentication or our library configuration. However, we discovered that the UTGuest WiFi protocol was silently dropping SMTP packets to prevent spam. This blocked our ability to send emergency alerts to caretakers.

Vultr was our lifesaver. By deploying our SMTP microservice into a Docker container on a Vultr instance (216.128.151.5), we moved our "Emergency Outbox" to an unrestricted, high-availability cloud environment. This ensured that when the motion sensor detects a stroke event, the alert is dispatched instantly, regardless of local hospital network restrictions.

Scalable Infrastructure Email Alert Microservice: Hosted on Vultr to bypass local ISP port blocking.

API Endpoints: Fast, low-latency communication between the Arduino hardware and the caregiver dashboard.

Remote Monitoring: Vultr’s global infrastructure allows caretakers to monitor patient vitals from anywhere in the world.

Live Diagnostic Test To verify the health of our Vultr-hosted alert system, we use the following curl command to trigger a test email:

Bash curl -X POST http://216.128.151.5:8000/send-email \ -H "Content-Type: application/json" \ -d '{ "to_email": "your_email@gmail.com", "subject": "Vultr Alert: Motion Detected", "body": "CareGuard detected a high-intensity motion event. Please check the patient immediately." }'

This is example curl to test the endpoint of our python backend on Vultr

MLH Track - Gemini

We integrated Google Gemini AI to analyze patient room conditions.

Gemini receives:

recent environmental data

spike detection events

SOS protocol status

It then generates natural-language insights for caregivers, helping them understand whether room conditions may be contributing to patient distress.

MLH Track - MongoDB Atlas

MongoDB Atlas stores all real-time sensor and system data.

Collections include:

env_data – temperature and humidity readings

spike_data – detected environmental spikes

caretakeremails – alert recipients

mintednfts – blockchain incident records

MongoDB makes it easy to query historical trends and provide context to the AI assistant.

Featherless.AI API

We used Featherless AI to run an open-source Llama-3 model for conversational analysis.

The Featherless endpoint receives:

recent environmental readings

spike detection data

SOS protocol status

This allows the chatbot to explain patterns like:

temperature spikes

humidity anomalies

recent emergency events

while giving caregivers a second AI perspective alongside Gemini.

We explored options to access Featherless.AI API for free. We found accessing Llama through Featherless AI via HuggingFace with free HuggingFace token and daily limit usage. Our chatbot is powered by user choice of Gemini or Featherless.AI (Llama)

Challenges we ran into

Sensor Sensitivity vs False Alarms Calibrating the motion sensor was difficult. Patients move frequently while adjusting in bed, so we had to distinguish normal motion from true distress signals.

Zero-Touch Reliability Because patients cannot interact with the system, reliability was critical. We designed a robust background listener to ensure events were never missed.

Contextual AI Understanding AI models needed structured environmental context to give meaningful responses. We built a pipeline that feeds recent sensor history and spike detection results into the AI prompt.

Hardware + Cloud Integration Combining IoT sensors, Python listeners, blockchain minting, and AI APIs required careful coordination between multiple systems.

Accomplishments that we're proud of

Building a fully automated SOS system requiring zero patient interaction

Successfully integrating IoT sensors, AI, and blockchain logging

Creating an AI assistant that interprets real-time medical environment data

Designing a system that could potentially reduce stroke response time in hospitals

What we learned

Through this project we learned:

how to integrate hardware sensors with cloud backends

how to structure AI prompts using real-time database context

how blockchain can be used for tamper-proof medical event logs

the importance of reliability and fail-safe design in healthcare systems

What's next for CareGuard

Future improvements include:

Computer Vision Stroke Detection Using camera analysis to detect facial asymmetry or body posture changes.

Patient Vital Integration Adding wearable sensors for heart rate, oxygen saturation, and blood pressure.

Predictive AI Alerts Using machine learning to predict stroke risk before symptoms appear.

Hospital System Integration Connecting CareGuard to existing hospital monitoring systems and nurse dashboards.

Built With

Share this project:

Updates