Inspiration
About 1 in 100 people has epilepsy, and around 3% of them are photosensitive. Flashing light at 3–30 Hz can trigger a seizure: strobes, emergency-vehicle lights, video games, even sunlight flickering through trees. TV broadcasts have flash limits, but the real world has none. The standard advice is to cover one eye and look away, which only works if you notice the flashing in time. And when a seizure does happen, people are often alone. We wanted a wearable that notices the trigger for you, and gets help if a seizure follows.
What it does
FlashGuard is a wearable built on an Arduino UNO Q. It has a light sensor on the cap brim, a movement sensor on the wrist and a pulse sensor.
- Detects flicker: an Edge Impulse model checks the light every half second. If it finds hazardous flashing, the LED matrix warns the wearer to cover one eye.
- Watches for a seizure: for 5 minutes after an exposure, a second Edge Impulse model watches the wearer's movement more closely for seizure-like shaking.
- Checks heart rate: it alerts if the heart rate stays elevated (resting + 15 bpm, 80–90 bpm) for 15 seconds, so it doesn't trigger at rest.
- Alerts a carer: if seizure-like movement continues, a 15-second countdown runs, then the carer alarm sounds on the buzzer with SOS on the LED matrix. It cancels if the movement settles.
Everything runs on the board, offline. Every exposure and alert is logged for the clinic. Nothing on the device flashes: the LED matrix only shows still icons.
How we built it
- Hardware: Arduino UNO Q with a Modulino Light, Modulino Movement, Modulino Buzzer and a MAX30102 pulse sensor.
- Flicker model (Edge Impulse):
- We built a test page that plays a labelled 7-minute schedule into the sensor: flicker at 3–30 Hz in different colours and contrasts, plus steady light, slow blinks, fades and room light. A script lines the recording up with the schedule, so the labelling is automatic.
- Spectral analysis plus a small neural network gives 97% accuracy on held-out test data with zero false alarms. The int8 model is only 4.8 KB.
- It runs on the UNO Q's Linux processor through Arduino's Edge Impulse runner, in about 30 ms per check.
- Movement model (Edge Impulse):
- Classes: Running, Seizure, Sitting, Standing, Walking and Waving.
- It runs directly on the UNO Q's microcontroller as an Edge Impulse Arduino library, in about 13 ms per check. That gives two models on two processors of the same board.
- Heart rate: a beat detector on the microcontroller learns the wearer's resting rate and flags a sustained rise.
- Sensor testing: before training, we measured the light sensor on the board. It takes 36 readings a second (not the 40 in the datasheet), reads the true frequency from 1 to 15 Hz, and still detects faster flicker.
- Tools: a command-line tool for the board, a scripted Edge Impulse pipeline (record → label → upload → train → deploy), and a KiCad test rig.
Challenges we ran into
- Slow sensor: the light sensor reads more slowly than its datasheet says, so flicker above about 18 Hz shows up at the wrong frequency. We measured exactly how, and trained the model on what the sensor really sees.
- Room light: bright room light can drown out a screen's flicker. We normalise each window (divide out the gain, take the log, remove the mean), so the model is independent of brightness and distance.
- Board limits: the board was offline, and its software couldn't flash sketches. We built and flashed from a laptop instead.
- Library crash: one sensor library stopped our sketch from starting, so we wrote our own register-level drivers.
- Power cycling: the latest build doesn't survive a power cycle yet. For now we restart it by re-flashing from the laptop.
Accomplishments that we're proud of
- Two Edge Impulse models on two processors of one board, working together completely offline.
- 97% accuracy on held-out data with zero false alarms.
- A wearable for photosensitive people that never flashes itself.
- A full pipeline built in one weekend, from raw sensor data to a model running on the device, with automatic labelling.
What we learned
- Measure your sensor before you trust the datasheet: it changed how we designed the model.
- Design the data collection so labels come for free: it saved hours.
- Plan everything in advance on an offline device: the models, the libraries and the tools all have to be on the board already.
What's next for FlashGuard
- More training data: real strobes and other screens, recorded in dim rooms.
- Real seizure data: validate the seizure detection on clinical recordings instead of acted movements.
- Wearer-side features: a cancel button and vibration alerts.
- Personalisation: each patient's sensitive frequency range, taken from their EEG test.
- Reliability: fix the power-cycle start-up so it runs without a laptop.
Built With
- edgeimpulseai
- python