GithubHelp home page GithubHelp logo

fsmeraldi / bleakheart Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 9.0 38 KB

An asynchronous BLE Heart Monitor library with support for additional data from Polar monitors (ECG, accelerometers, etc)

License: Mozilla Public License 2.0

Python 100.00%
accelerometer asyncio ble ecg heart-rate heart-rate-monitor heart-rate-sensor heart-rate-variability

bleakheart's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bleakheart's Issues

RR interval duplication in printing.

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)

Publish on PyPI

If you have time and resources, publishing this on PyPI would be great!

AsyncIO issue prevents programs from running

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.

30 second delay in ECG data

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.

ECG Recorder Immediately Disconnects

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

AsyncIO Windows 10 specific issue

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.