ECE 413 · Fall 2025 · University of Arizona

Heart Track

A low-cost IoT monitor that tracks heart rate and blood oxygen through the day, from the sensor firmware to the web dashboard.

My role: Backend and AWS integration · team of three

  • IoT
  • Firmware
  • Node.js
  • MongoDB
  • Full-stack

The device in 3D

The opening view follows one reading from the breadboard through the Particle cloud and our server to the dashboard on a phone; pick a part from the menu to look at the hardware.

In use: a reading to the phone

How a reading reaches the phone: the Photon 2 publishes it to the Particle cloud, a webhook posts it to our server, and the dashboard fetches it.

Drag to turn the model, scroll to zoom, middle-drag to move it.Drag to turn the model, pinch to zoom, two fingers to move it.

About this model: Particle's Photon 2 model (CC BY-SA 4.0); the rest is drawn for this page

The Photon 2 is Particle's own model from its hardware libraries (CC BY-SA 4.0, and the model file here is shared under the same license), recolored, with a plain label on the P2 module. The MAX30102 is drawn at its datasheet size. No photos of the device survive and the team didn't record which sensor module it used, so the breakout (a generic 7-pin module), the breadboard layout, the wires and their colors are drawn; the four connections, LED colors, thresholds and timings follow the team's firmware. There is no case or strap because the wearable was never built.

The Photon 2 is a Feather-size board, 50.8 × 22.86 mm. Its P2 module (the metal can) holds a Realtek RTL8721DM, an Arm Cortex-M33 at 200 MHz with 2.4 and 5 GHz Wi-Fi and Bluetooth LE, and uses the antenna printed on the board unless one is plugged into the U.FL connector. The JST-PH socket takes a single-cell LiPo, the 10-pin SWD header is for a debug probe, and the blue D7 LED goes unused by the team's firmware. The MAX30102 packs a red LED (660 nm), an infrared LED (880 nm) and a photodetector into a 5.6 × 3.3 × 1.55 mm package: blood absorbs the two colors differently, and the firmware estimates SpO₂ from their ratio. The chip wants 1.8 V for its logic and at least 3.1 V for its LEDs, so breakouts like this one (pins VIN, SDA, SCL, INT, IRD, RD, GND) carry their own regulators and run from the Photon 2's 3.3 V output. The firmware polls the sensor on the default I2C bus (D0 = SDA, D1 = SCL) at 400 kHz, address 0x57, leaving INT, IRD and RD free, and prints a debug log over USB at 9600 baud.

In the "In use" view the phone is a plain drawn shape whose screen is the team's dashboard at phone width, showing sample readings posted through the device endpoint. The messages are abbreviated from the firmware, the server's routes and the web app. The two clouds stand for the Particle cloud and our server on AWS; they are not models of anything.

The idea

Heart Track was meant as a prototype for a wearable monitor: something you wear through the day and touch when it lights up blue, so it can log your heart rate and blood oxygen (SpO₂). A Particle Photon 2 with a MAX30102 optical sensor takes the readings, a Node.js / Express backend on MongoDB stores them, and a web app handles sign-in, devices, a dashboard and daily and weekly charts. We never made it wearable; the breadboard above is as far as the hardware went.

At a glance

Course
ECE 413, Fall 2025
Team
Three; I owned the backend and the AWS deployment
Sensor node
Particle Photon 2 with a MAX30102
Backend
Node.js / Express and MongoDB, on EC2 behind Nginx
Hardware
A breadboard; never made wearable

We built it as a team of three. The hardware and firmware were my teammates' work. I owned the backend and the AWS deployment: the server on EC2 behind Nginx, the data model, the webhook that receives readings from the devices, and the chat feature that answers questions about a user's own measurements.

Follow the data

A reading is due every 30 minutes in the team's design; the interval and time range are set from the web app and stored on the device. When one is due, the status LED turns blue and the firmware polls the sensor over I2C until its red and infrared values both pass 10,000, which means a finger is on it; it gives up after 5 minutes. It then measures for 15 seconds with the LED off, throws away the first 5 while the reading settles, and averages a sample every 200 ms. Blood absorbs the sensor's red and infrared light differently, and SpO₂ is estimated from the ratio of the two.

The numbers

Reading due every30 minin the team's design
Finger detected> 10,000red and infrared both
Gives up after5 min
Measurement15 sfirst 5 s thrown away
Sample every200 ms
Kept offlineup to 300older than 24 hours dropped

The result goes to the Particle cloud as a health_data event, a webhook forwards it to our server, and the device waits for the reply: a green flash means it was stored. With no Wi-Fi, a yellow flash means the reading is kept on the device, up to 300 of them. On reconnecting, the device publishes the stored readings first, about one a second, drops any older than 24 hours and clears the store.

POST /api/chat answer webhook publish store recent readings prompt Web app dashboard and chat Node.js server Express behind Nginx AWS EC2 Tailscale tunnel Local LLM Ollama · phi3:mini MongoDB users · devices · measurements Particle cloud event → webhook Particle Photon 2 firmware Optical sensor IR and red light

Two paths through the same backend: pick one and watch where the data goes.

The backend

Readings arrive by webhook: the device publishes to the Particle cloud, which calls the server, so the device never needs to know where the backend lives. Each measurement is stored against the user's device.

The chat assistant answers questions about your own data. Before a question goes to the model, the server fetches the user's devices and recent measurements and adds them to the prompt. The model runs on our own hardware under Ollama, and the cloud server reaches it through a private Tailscale tunnel.

The architecture as documented for the project, from the device to the tunnel to the local model.

The web app

The frontend is plain HTML, CSS and JavaScript with Chart.js, served by the same Express server. The weekly summary comes from a seven-day aggregation the server runs over the stored measurements; the daily view plots every reading for the day you pick.

Screenshots are from the app running locally in November 2026, in the theme that matches this site. The readings are sample values posted through the device endpoint, not sensor data, and the language model was not running, so the assistant's reply is a scripted stand-in.

Heart Track weekly summary page: four summary cards, a line chart of daily average heart rate and SpO₂, and a table of each day's minimum, maximum and averageHeart Track weekly summary page: four summary cards, a line chart of daily average heart rate and SpO₂, and a table of each day's minimum, maximum and average
The weekly summary: seven-day averages and each day's breakdown.
Heart Track daily detail chart: heart rate against time of day from 6 AM to 10 PM, with the highest reading marked in red and the lowest in greenHeart Track daily detail chart: heart rate against time of day from 6 AM to 10 PM, with the highest reading marked in red and the lowest in green
One day's readings, with the highest marked in red and the lowest in green.
Heart Track dashboard with the Health Assistant chat window open: a question about heart rate and a reply that quotes the average, highest and lowest of the 20 most recent readingsHeart Track dashboard with the Health Assistant chat window open: a question about heart rate and a reply that quotes the average, highest and lowest of the 20 most recent readings
The server built the prompt from the 20 most recent readings as usual; the reply is scripted from them in place of the model's answer.

What I took from it

Put a middleman between the device and the server. Because readings reach us through Particle's webhook, the firmware never holds the server's address, and the backend can move or be redeployed without touching a device.

A language model only knows what you hand it. The chat feature works because the server looks up the user's own readings and puts them in the prompt; the model phrases the answer, it doesn't remember anything. Hosting the model ourselves has its own cost: the feature is only as available as the machine it runs on and the tunnel to it.

If I picked it back up, I would finish what the name promises: a battery, a case and a strap so it can actually be worn, then real readings in place of sample data. The same webhook and retrieval backend would carry over to any sensor that reports a few numbers at a time.

Want the details behind this one, or to talk about similar work?