Skip to content

About

Real-time IoT health monitor — Arduino with HX711 load cells and a pulse sensor streams weight and heart rate through a Node.js serial bridge to Firebase, displayed on a live Apple Fitness–style dashboard with BMI tracking, health insights, and workout plans.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

HealthSync — Real-Time IoT Health Monitor

HealthSync Banner

Arduino Firebase Node.js Chart.js HTML

Live weight, heart rate, and BMI tracking — from Arduino sensors to a beautiful web dashboard in real time.

🏠 Landing Page · 📊 Dashboard · ⚙️ Setup Guide


📸 Preview

Apple Fitness–inspired dark dashboard with live KPI cards, real-time charts, workout recommendations, and health insights.

┌─────────────────────────────────────────────────────────────┐
│  HealthSync Dashboard                          ● LIVE        │
├──────────┬──────────────────────────────────────────────────┤
│          │  Weight      Heart Rate    BMI       Goal        │
│ Sidebar  │  72.4 kg     78 BPM       22.1      2.4 kg      │
│          │  ↓ trending  → stable     Normal ✓  above goal  │
│ Home     ├──────────────────────────────────────────────────┤
│ Dashboard│  Weight over time ────────────────────────────── │
│ Analytics│  ▁▂▃▂▄▅▄▆▇▆▇█  (live Chart.js graph)           │
│ Workouts │                                                   │
│ Insights │  BPM over time ───────────  BMI over time ─────  │
│ Profile  │  ▃▄▂▅▃▄▅▃▄▂▅    ▂▂▃▂▂▂▃▂▂▂▂                   │
└──────────┴──────────────────────────────────────────────────┘

✨ Features

Feature Description
⚡ Real-Time KPI Cards Weight, BPM, BMI and goal weight — updated every 2 seconds with animated transitions and trend arrows
📈 Live Charts 5 Chart.js graphs (weight, BPM, BMI + 2 mini) with last 30 data points
🧠 Health Insights Engine Automatic BMI assessment, BPM risk detection, weight trend analysis
🏋️ Smart Workout Plans 17 workouts across 4 categories, filtered by BMI + age group
🎯 Goal Tracker Set a target weight, see how far you are in real time
🌙 Dark / Light Mode Synced across landing page and dashboard via localStorage
📥 CSV Export Download full history (weight, BPM, BMI) with timestamps
📱 Fully Responsive Works on mobile, tablet, and desktop
🔴 Live Status Badge Pulsing dot shows when data is fresh (< 10s old)
🧪 Demo Mode Simulates live data automatically if Firebase is not yet connected

🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│                    DATA FLOW PIPELINE                        │
└─────────────────────────────────────────────────────────────┘

  ┌──────────────┐     Serial      ┌──────────────┐
  │  Arduino UNO │ ─────────────►  │  bridge.js   │
  │              │   57600 baud    │  (Node.js)   │
  │ • HX711      │                 └──────┬───────┘
  │ • 4 load     │                        │
  │   cells      │                        │ Firebase SDK
  │ • Pulse      │                        ▼
  │   sensor     │               ┌──────────────────┐
  └──────────────┘               │  Firebase        │
                                 │  Realtime DB     │
                                 │                  │
                                 │  data/           │
                                 │  ├── weight: 72.4│
                                 │  └── bpm: 78     │
                                 └────────┬─────────┘
                                          │
                                          │ db.ref("data").on("value")
                                          ▼
                                 ┌──────────────────┐
                                 │  index.html      │
                                 │  (Live Dashboard)│
                                 │                  │
                                 │ • KPI Cards      │
                                 │ • Chart.js graphs│
                                 │ • Health Insights│
                                 │ • Workout Recs   │
                                 └──────────────────┘

🛠️ Hardware

Component Purpose Connection
Arduino UNO Microcontroller USB to PC
HX711 Module Load cell amplifier Pins D4, D5
4× Load Cells Weight measurement Via HX711
Pulse Sensor Heart rate (BPM) Pin A0
I²C LCD (16×2) Local display SDA/SCL

Wiring Summary

Arduino UNO
├── D4  → HX711 DOUT
├── D5  → HX711 SCK
├── A0  → Pulse Sensor Signal
├── 5V  → VCC (all modules)
└── GND → GND (all modules)

I²C LCD → Address 0x27 (SDA/SCL)

📁 Project Structure

health-project/
│
├── landing.html          # Home page — project overview
├── index.html            # Live dashboard
├── styles.css            # Shared theme (Apple Fitness dark)
├── script.js             # Firebase listener + all dashboard logic
│
└── bridge/
    ├── bridge.js         # Node.js Serial → Firebase bridge
    └── package.json      # Dependencies (serialport, firebase)

🚀 Getting Started

Prerequisites

  • Node.js v16+
  • Arduino IDE
  • Firebase account (free Spark plan works)

Step 1 — Flash Arduino

  1. Open arduino/health_monitor.ino in Arduino IDE
  2. Install required libraries via Library Manager:
    • HX711_ADC
    • LiquidCrystal_I2C
    • PulseSensorPlayground
  3. Upload to your Arduino UNO
  4. Open Serial Monitor at 57600 baud
  5. Send t to tare the scale, then enter your calibration weight in grams

You should see output like:

Weight: 65.20 kg | BPM: 78
Weight: 65.21 kg | BPM: 79

Step 2 — Create Firebase Project

  1. Go to console.firebase.google.com
  2. Click Add Project → give it a name
  3. Go to Realtime Database → Create Database
  4. Select Start in Test mode → Enable
  5. Go to Rules tab → paste this → Publish:
{
  "rules": {
    ".read": true,
    ".write": true
  }
}
  1. Go to ⚙️ Project Settings → Your apps → Add web app </>
  2. Copy your firebaseConfig object

Step 3 — Add Firebase Config

Open script.js and replace the config at the top:

const firebaseConfig = {
  apiKey:            "YOUR_API_KEY",
  authDomain:        "YOUR_PROJECT.firebaseapp.com",
  databaseURL:       "https://YOUR_PROJECT-default-rtdb.firebaseio.com",  // ← add manually
  projectId:         "YOUR_PROJECT_ID",
  storageBucket:     "YOUR_PROJECT.appspot.com",
  messagingSenderId: "YOUR_SENDER_ID",
  appId:             "YOUR_APP_ID"
};

Open bridge/bridge.js and paste the same config + set your COM port:

const SERIAL_PORT = "COM3";   // Windows: COM3, COM4 etc.
                               // Mac/Linux: /dev/ttyUSB0 or /dev/ttyACM0

How to find your COM port:

  • Windows → Device Manager → Ports (COM & LPT) → look for CH340 or Arduino
  • Mac → ls /dev/tty.* in Terminal
  • Linux → ls /dev/ttyUSB*

Step 4 — Run the Bridge

cd bridge
npm install
node bridge.js

Expected output:

✅ Listening on COM3 at 57600 baud...
Arduino → Weight: 65.20 kg | BPM: 78
✅ Pushed → weight: 65.2 | bpm: 78

⚠️ Close Arduino IDE's Serial Monitor before running bridge.js — both cannot use the same COM port simultaneously.


Step 5 — Open the Dashboard

Open landing.html in your browser → click Open Dashboard →

Or open index.html directly.

Your data will appear live within 2 seconds of the bridge running. ✅


📊 Dashboard Sections

Section What it shows
Dashboard Live KPI cards + mini sparkline charts
Analytics Full-size weight, BPM and BMI graphs over time
Workouts Filtered plans by BMI category + age group
Insights Auto-generated health observations
Profile Height, age, gender, goal weight input

🏥 Health Logic

BMI Calculation

BMI = weight (kg) / height (m)²
BMI Range Category Colour
< 18.5 Underweight 🔵 Blue
18.5 – 24.9 Normal 🟢 Green
25 – 29.9 Overweight 🟡 Amber
≥ 30 Obese 🔴 Red

BPM Ranges

BPM Status
< 60 Low (athlete level)
60 – 100 Normal ✓
101 – 120 Elevated ⚠️
> 120 High 🚨

🔧 Firebase Data Format

The bridge writes to Firebase in this exact structure:

{
  "data": {
    "weight": 65.2,
    "bpm": 78
  }
}

The dashboard listens to db.ref("data") and updates on every change.


🔒 Security Note

Never push your real Firebase credentials to a public GitHub repository.

Before pushing to GitHub, replace your credentials in script.js and bridge.js with placeholders:

const firebaseConfig = {
  apiKey: "YOUR_API_KEY_HERE",
  databaseURL: "YOUR_DATABASE_URL_HERE",
  // ...
};

Or simply keep your repository private.


🧰 Tech Stack

Layer Technology
Microcontroller Arduino UNO (C++)
Weight sensor HX711 + 4× load cells
Heart rate Pulse Sensor (analog)
Serial bridge Node.js + serialport npm
Database Firebase Realtime Database
Frontend Vanilla HTML + CSS + JavaScript
Charts Chart.js 4.4.0 (CDN)
Fonts DM Sans + Instrument Serif (Google Fonts)

🐛 Troubleshooting

Problem Fix
bridge.js — port error Close Arduino IDE Serial Monitor first
bridge.js — wrong port Check Device Manager (Windows) or ls /dev/tty.* (Mac)
Dashboard shows demo data Your Firebase databaseURL is missing or wrong in script.js
Weight reads 0 or wrong Send r in Serial Monitor to recalibrate
BPM always 0 Ensure finger is firmly on pulse sensor, wait 10–15 seconds
Firebase permission denied Set rules to ".read": true, ".write": true in Firebase console

📄 License

This project is open source and available under the MIT License.


🙌 Acknowledgements


Made with ❤️ for IoT health monitoring

HealthSync — Your body speaks. We listen in real time.

About

Real-time IoT health monitor — Arduino with HX711 load cells and a pulse sensor streams weight and heart rate through a Node.js serial bridge to Firebase, displayed on a live Apple Fitness–style dashboard with BMI tracking, health insights, and workout plans.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages