Hey, I'm Harry Cheng

pFoG

Grand Prize & Hacker’s Choice @ UC Berkeley AI Hackathon 2025

Timeline
June 2025
Built with
PyTorch, ESP32, Flask, Next.js

pFoG is a wearable medical aid device that tackles Freezing of Gait (FOG) in people with Parkinson's disease. It reads motion data from the leg, predicts a freezing episode with a 1D-CNN and LSTM model, and delivers targeted muscle stimulation to the frozen leg so the patient can resume walking.

It comes with a web interface that eases data collection and labeling, and lets users fine-tune a model on their own walking data.

The pFoG wearable device
The pFoG prototype: an ESP32-driven wearable that reads gait data and triggers stimulation.

Inspiration

It started with a stick.

A family member of one of our teammates has Parkinson's and experiences Freezing of Gait. Recent research shows that targeted muscle stimulation can help, and we had seen it informally: gently poking the back of his leg with a stick during an episode helped him move again.

What if a wearable could notice the freeze and deliver that poke on its own?

How it works

Sense, predict, poke.

An Adafruit MPU-6050 IMU on the leg streams accelerometer and gyroscope data to an ESP32. A 1D Convolutional Neural Network extracts spatial features from the signal, which feed into a Long Short-Term Memory model that predicts whether a freezing episode is starting. When FOG is detected, a servo-actuated arm delivers localized muscle stimulation to the leg, mimicking the physical poke and helping the patient resume walking.

Because gait varies from person to person, the web interface lets a patient record and label their own walking data and fine-tune the model on it.

Model architecture

The model takes windows of 256 IMU samples across six channels (three accelerometer, three gyroscope). Three 1D convolution blocks, each with batch normalization and max pooling, extract spatial features while halving the sequence length at every step. The result is transposed and fed to an LSTM with 128 hidden units to capture temporal patterns, and a small dense head with dropout classifies the window as walking, standing, or freezing.

Diagram of the CNN-LSTM model: an input layer, three 1D convolution blocks, a transpose, an LSTM layer, and a classification head
The CNN-LSTM architecture: three Conv1d blocks for feature extraction, an LSTM for sequence modeling, and a three-class classification head.

Features

  • Real-time FOG detection with a 1D-CNN and LSTM, at over 90% accuracy
  • Servo-actuated muscle stimulation for gait recovery
  • Web interface for data collection and labeling
  • Model selection and personalization (fine-tuning)

Challenges

No printer, noisy data.

We had no 3D printer of our own and had to borrow access, and the mechanical assembly was improvised from the materials on hand. Debugging UART serial communication between the sensor board and the model ate a lot of time. On the modeling side, the data was limited and noisy, so training a model that generalizes across different walking patterns without overfitting was the hardest part.

Awards

  • Grand Prize, Social Impact Track at UC Berkeley AI Hackathon 2025
  • Hacker's Choice Award at UC Berkeley AI Hackathon 2025

Tech stack

Frontend
  • React
  • Next.js
  • Tailwind CSS
Backend
  • Python
  • Flask
  • PyTorch
  • Google Cloud
Hardware
  • ESP32
  • MPU-6050 IMU
  • Servo