fsmeraldi / bleakheart Goto Github PK
View Code? Open in Web Editor NEWAn asynchronous BLE Heart Monitor library with support for additional data from Polar monitors (ECG, accelerometers, etc)
License: Mozilla Public License 2.0
An asynchronous BLE Heart Monitor library with support for additional data from Polar monitors (ECG, accelerometers, etc)
License: Mozilla Public License 2.0
Great work on this bit of software, I have only been going through this off and on for a couple days now, and I have never submitted an issue before. But I was looking over your examples to adapt your software and add some features of my own but I came across one small error when using your Heart rate callback example.
when processing your RR intervals on line 165 in bleakheart.py it is currently:
rr = int.from_bytes(data[offset:offset+2], 'little', signed=False)
Where it never gets the next value in the array. A simple fix would be:
rr = int.from_bytes(data[i:i+2], 'little', signed=False)
If you have time and resources, publishing this on PyPI would be great!
Been a bit since I have updated anything here as I was going through testing BleakHeart on Windows 10 but one issue I did run into right off the bat was the keyboard handler AsnycIO reader on line 67 in the ECG Queue example prevents the program from starting up. While that's a nice feature for sure but my current work around is just commenting out loop.add_reader(sys.stdin, keyboard_handler)
I haven't had the time to fully check why this is an issue on Windows 10 as I am fairly new to AsyncIO so when I get around to doing a deeper dive I will look into it further.
Hi, I am working on some C++ software that gets the ECG data from the Polar H10. I often get a 30 second delay after sending the command to stream and before ECG data is streamed over Bluetooth LE. There is no delay for the RR intervals however - they start coming through immediately. I have just run your ecg_queue.py software and have seen that your software is experiencing the same problem as mine - there is a 30 second delay for ECG data. Do you experience this problem as well? If so, is this something that you have investigated? I'd be interested to hear your thoughts on the matter.
Thank you very much for this repo it is very useful @fsmeraldi !
I have got HR rate to record on my Polar H10 reliably (I am on Windows so had to modify this a little - see https://github.com/WillPowellUk/bleakheart/blob/main/examples/heartrate_queue.py and https://github.com/WillPowellUk/bleakheart/blob/main/examples/ecg_queue_windows.py) however I cannot get ECG to work reliably - it sometimes records data as expected but often it records and immediately disconnects:
Scanning for BLE devices
Connecting to E2:F5:07:72:6D:27: Polar H10 AE60D42F...
After connecting, will print ECG data in the form
('ECG', tstamp, [s1,S2,...,sn])
where samples s1,...sn are in microVolt, tstamp is in ns
and it refers to the last sample sn.
Connected: True
>>> Hit Enter to exit <<<
Request for available ECG settings returned the following:
error_code: 0
error_msg: SUCCESS
SAMPLE_RATE: [130]
RESOLUTION: [14]
Sensor disconnected
Bye.
Do you have any ideas? I have tried taking out polar H10 battery for a full device restart so i believe the problem is on the BLE side. Unsure how to debug something temperamental like this.
Thanks,
Will
When adapting BleakHeart to run on Windows 10 I ran into an issue described here and it is thankfully a simple fix that was already discovered by AsyncIO.
By adding in the main loop:
if 'win32' in sys.platform:
# Windows specific event-loop policy & cmd
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
cmds = [['C:/Windows/system32/HOSTNAME.EXE']]
The issue is resolved!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.