Close

uECG for EMG

A project log for uECG - small open source wireless ECG sensor

It's cheap, doesn't use a specialized heart rate AFE and can blink LEDs with your pulse :)

olya-gryOlya Gry 11/22/2020 at 17:120 Comments

Before moving on to the technical details of today's update, here’s the background story. More than a year ago, more or less at the same time we were finishing uECG, we began to develop uEMG. In parallel with this, having launched a crowdfunding company, we made a promo video where we showed that uECG can be used to measure electromyography.

A couple of months ago, a person wrote to us and said that he saw that video and needed a device to measure EMG. We really wanted to have time to finish uEMG this year, but life circumstances (and pandemic) forced us to deal with other issues... So we suggested him to use uECG to measure EMG. For this, we have significantly updated the software part and now we are also working on improving the UI.

That actually required rewriting the whole radio stack - previous protocol had a major bug, and overall wasn’t well suited for multiple devices. We ended up making a kind of a library with all the important functions we use in most projects - radio, timer, UART - all our further code will use it (and so its functionality would be growing over time). The main difference vs Nordic’s softdevice approach is full control over what is happening and when exactly (so for instance radio processing won’t interrupt time-critical interactions with peripherals), and clear understanding of what exactly is happening under the hood.

Changes are so significant that we decided to add a bit more functions into uECG firmware and call it Mark II (even though hardware is the same, so all previous devices can be upgraded). The new version of this firmware will be released soon. 

Now for the EMG part: each device performs on-board 8-points FFT calculation and uses relation of spectral bins 1-3 vs bin 0 to determine EMG activity level (since a lot of EMG signal is located at 100+ Hz area, and not a lot of random noise appears there). This calculated level is indicated with LED colors - at first we tried to encode it in brightness level alone, but it wasn’t clear enough, so at first it increases brightness of blue channel, and with further rise goes into pink and then cyan colors, thus making it easier for visual interpretation. And it’s also sent out to the base station, together with calculated spectrum. 

New radio protocol now implements discovery, and the base station polls data from all discovered devices within a short cycle (2 milliseconds per device). Sometimes packets are lost, so practical latency is often 2-3 times higher than the best case scenario, but still it’s quite close to realtime.

We have made a video where you can see our jack-of-all-trades, master of none Dmitry playing the piano, with simultaneous recording of data from devices (ordinary charts represent calculated EMG levels, and spectral charts show the FFT data calculated on-board).

Happy viewing!

Discussions