Max8 Polar H7 Heart Rate Monitor Progrom

Bradley Martin's icon

Hello Max8 developers and forum users!

I am a university student in need of some programming assistance. I am creating a Maxmsp software where real-time heartbeat is used to control the volume of music tracks in a song. I’m looking at getting some assistance with connecting the heart rate monitor to the Max8 program. I am using a Polar H7 Bluetooth Heart Rate Monitor, which I have already been able to pair to my Windows PC. I have already worked out the audio parts of the program, I just need a way to connect, record and display the heart rate in Max8 in real time. Thank you all very much for your time and I hope to hear from you all soon!

Cheers!

Source Audio's icon

If Max serial object can't recognise that device,
you can try ble max external created by Matthew Hamilton

https://github.com/mhamilt/maxmsp-ble

Bradley Martin's icon

I'm not sure how the Serial Port works exactly, so I might try the BLE max eternal package for now.

Bradley Martin's icon

If Max serial object can't recognise that device, you can try ble max external created by Matthew Hamilton

Downloaded the BLE program and while I think I found the HRM on it, I'm not sure exactly how to go from here. What sort of code would I need to create to extract the bpm from the device and place it into a Max8 number box?

Source Audio's icon

I have no idea, don't have that sensor

Bradley Martin's icon

Fair enough

mhamilt's icon

Very late to this, but let me know if you still need help

Thomas's icon

@MHAMILT hi ! is it possible to pair 2 devices working at the same time (2 Polar heart rate monitor) ?

mhamilt's icon

That should be possible, I’d recommend downloading the latest objects from GitHub as I haven’t had a chance bundle update on the Max Package Manager.

https://github.com/mhamilt/maxmsp-ble/releases

basic breakdown of what you’ll need to do

1. search for the devices and keep a record of the device index or device UUID
2. identify which Service / Characteristic you need
3. send a read message to each device with the Serv / Char pair
4. use a couple of route objects to direct the data to the right place
5. use a byte-cast object to wrangle the data into the correct format.

What you’ll need to hand is the data sheet for the BLE device you are using to make finding the right services and characteristics easier

you might also want to download a tool like LightBlue or BluefruitConnect to make poking around the Bluetooth messages a little easier.

Thomas's icon

3. send a read message to each device with the Serv / Char pair
i don't understand what is Serv / Char pair
i 've identified my service HRM i found on a different software : 180D 2A37
if i subscrib it : device 1 subscribe 180D 2A37
i have some data like that :
22 73 25 3
22 73 88 3
22 73 107 3
22 72 66 3 91 3

i tried to read this data with byte-cast, but it's not understanding

Thomas's icon

ok i understood, the heart BPM is here ! it's 73 the second number
so now i will try with two HRM
Thank's again Mister Hamilt

Jose Navarrro's icon

Hi,
I'm using exactly the same staff: Polar H10 with "max-ble".
And it's works. Great and Thank you !!

@Thomas: after subcribe to 180D 2A37 I receive allways 4 integers like 16 50 120 4 where the second one is the Heart Rate (How you told ;-).
Did you find out what the other integers mean?

@Hamilt: I need to check the device number to subcribe the service and this is not so cool when I know exactly the device I'm using. Could you connect the device with the UUID and subcribe the service directly? For instance like: device "CE41864F-70F3-CA65-9684-B9BF3FFFCA64 subscribe 180D 2A37"

Thanks Mr Hamilt & Thomas