Hacker News new | ask | show | jobs
by jononor 707 days ago
There exists ready made BLE beacon hardware with accelerometer, which is excellent for an application like this. Many with NRF52 and LIS2/LIS3, for example. A well documented option is RuuviTag. May others from Moko, Minew, HolyIot etc. CR2032 battery would be great for small size. However one would have to write custom firmware, as the stock firmware just extracts orientation from the accelerometer, or notifies on any movement, which is not useful in this case. Zephyr RTOS has excellent support for the typical accelerometers and NRF52 - though it will be a step learning curve if one has never done any embedded. Conceptually the firmware is simple. Initialize accelerometer, say to 20 Hz sample rate, using FIFO. Sleep for 1 seconds, wake up, fetch accelerometer data from FIFO. High pass filter the samples, compute FFT to get energy at different frequencies. Stuff the FFT coefficients into a BLE advertisement packet, send N=4 times. Go back to sleep, repeat.
2 comments

> There exists ready made BLE beacon hardware with accelerometer, which is excellent for an application like this.

I didn't know that and it's a great start. If I get something like the MOKOSmart M1 Ultra Thin Beacon Tag [1], will I be able to send accelerometer data to let's say a Raspberry Pi, process it further, and send a push notification when needed?

[1] https://www.mokosmart.com/beacon-tag/

You would need to write custom firmware. Which means access at least to the pin mappings. Moko dos not publish them openly. Ruuvi however does. One would also need a Nordic 52 Development Kit in practice. Other devices like ESP32 are not as power efficient but more beginner friendly.
I also think this is a better solution compared to the other suggesions. ML for audio and computer vision are both very interesting but absolutely not easy / short projects, from my limited experience it was never as straightforward as you'd expect. Reflections, inconsistent lighting conditions, echo, multipath propagation are all very unpredicatble factors that require a ton of math and signal (pre)processing to solve. Compared to this, I think one can boge together an ugly prototype to send data to a server over wifi / BLE in a few days even with close to zero electronics experience.

> though it will be a step learning curve if one has never done any embedded

For someone who has not previously worked with hardware I'd suggest to buy first a cheap Arduino-compatible board like this one [1] with BLE and WiFi instead of professional hardware. Although not as efficient, calls to hardware sensors are much simpler and well documented for example here [2, 3]. For the filtering part jononor is talking about I'd suggest this chapter 10 of this book [4] complemeted with more accessible resources like this video [5] (the book is to dig deeper into the maths, but not strictly necessary).

Then once you have this you can be as fancy as you want on the server side with ML models etc, but I suspect that since the seizures are rather long (minutes) just looking at the mean frequency about 15 ~ 30 seconds could already be a pretty good indicator.

[1]: https://www.lilygo.cc/products/t-energy-s3

(This is the first board I found, but I'm sure are also other smaller boards with ESP32 or ESP8266 using a CR2032 battery like https://hackaday.com/2019/02/22/a-coin-cell-powers-this-tiny... on AliExpress / BangGood / etc.)

[2]: https://www.arduino.cc/reference/en/libraries/arduinoble/

[3]: https://docs.arduino.cc/built-in-examples/sensors/ADXL3xx/

[4]: http://eceweb1.rutgers.edu/~orfanidi/intro2sp/orfanidis-i2sp...

http://eceweb1.rutgers.edu/~orfanidi/intro2sp/

[5]: https://www.youtube.com/watch?v=uNNNj9AZisM

These are extremely helpful resources, now I have somewhere to start! The ESP32_CoinCell project looks very promising, since I'm mostly worried about the size and weight of whatever I'll put on the collar. Thank you so much!