Code Monkey home page Code Monkey logo

Comments (21)

fanoush avatar fanoush commented on August 23, 2024

@atc1441 has good example here
https://github.com/atc1441/D6-arduino-nRF5/blob/master/libraries/D6Examples/examples/HeartRateTest/HeartRateTest.ino#L428

There are two parts of the problem:

  1. read raw values from the sensors - that is working and we have pretty good knowledge which registers from datasheet are needed.

  2. process raw data into heart rate - for this there is closed source static library for cortex M4 - it is not freely available but is provided by manufacturer free of charge (after signing NDA?) This library can be found in some github projects near the pxialg.h header file and works fine but it is not clear what is exact status of this library. However as I understand it with knowledge mentioned in 1. it is possible to have good approximation even without this library.

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

Oh, just noticed that you talk about HRS3300, not PAH8001, sorry. Anyway, I searcher for it recently and found some very similar library also for HRS3300, it has similar calls to process raw data together with accelerometer data just like the pxialg API. But no, I didn't try to read it yet.

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

search github for hrs3000 (not hrs3300) and you will find the project with example, there is also keil library there

from ds-d6.

corteXnzt avatar corteXnzt commented on August 23, 2024

Hello fanoush, yeah PAH8001 has already an engine built in so you just fetch the data. But with this HRS3300 only the raw values are stored on register. I misunderstood the datasheet or Must be lost from translation.

Anyway did search last night here in github and not showing any results on mobile. Searched again this morning on PC and found what you are pointing. Actually I'm using the arduino platform based so I need to port this to work with Arduino. Thank you very much fanoush! I'll start working on this. Closing this issue (not actually but a question).

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

OK, if you get something working, please don't hesitate to share. BTW which device you have?

I will keep this issue open for future progress since HRS3300 is not working yet and people searching for it later will see it and will not create another issue.

from ds-d6.

corteXnzt avatar corteXnzt commented on August 23, 2024

I'm using a B57 Smart bracelet
https://www.amazon.com/Smart-Waterproof-smartwatch-Multiple-Wearable/dp/B07LB1VR1J

I can access all parts including the accelerometer raw values at this moment. With the HRS3300 I had written already a library to access enable and disable it and read the HRS and ALS register.

I spent the whole morning till this afternoon exploring the code but unfortunately based on my findings the source code in the kiel has dependencies that is not included on the whole project. I first started understanding the code and proceed with porting it with arduino but when I can't trace some extern functions I moved to SES to compile the whole project but I found out that it really has missing parts.

Based on the functions on that library it sends the HRS and ALS data to a function that calculates the BP and heart rate which is declared as extern function. Tried searching that function but I guess that is already proprietary as I can't find anything. I think their function is good even though I don't know yet what inside of it since they used the ALS in that function in calculating the BP and HR and there is also a function which take account the accel values in calculation.

My plan now is adapting my i2c code to the heart rate sensors that are read by analog which is common to manufacturers like adafruit and dfrobot.
readAnalog>>> value>>>calculate BPM
to
i2c read analog values written on register>>>value>>>calculate BPM

Or if you have other suggestions? Thanks again for the help.

from ds-d6.

atc1441 avatar atc1441 commented on August 23, 2024

Hi please share your current code with me i want to take a look at it.

I got some devices with this heartrate sensor

I can Look in about ten hours into it

from ds-d6.

atc1441 avatar atc1441 commented on August 23, 2024

Please try to send the raw data to serial and use the serial Plotter to watch how it looks

from ds-d6.

corteXnzt avatar corteXnzt commented on August 23, 2024

I have closed the device so I have no access to the serial UART port currently. Im debugging thru the ble UART. I'll try later this night with larger screen on ipad since I can't visualize it over the phone since the screen is too small.

Pardon the way this library is written since this is the first library I have made. I welcome corrections and suggestions. I uploaded it a moment ago.

https://github.com/corteXnzt/hrs3300_test

from ds-d6.

corteXnzt avatar corteXnzt commented on August 23, 2024

Here are some screenshots at 3ms interval. Lower than that I get some packet loss. Some looks like a pulse signal to me.
IMG_0482
IMG_0483

from ds-d6.

atc1441 avatar atc1441 commented on August 23, 2024

you could try to only send every 10th messaurement and then it should look better, or you could also take an averrage of the last 10 messauerements and only send that. just to see how it looks.

from ds-d6.

atc1441 avatar atc1441 commented on August 23, 2024

by the way, what happens if you change the width ?

from ds-d6.

atc1441 avatar atc1441 commented on August 23, 2024

First tests looking good

HRS3300

your data also looks good, but just with to less width i think

from ds-d6.

atc1441 avatar atc1441 commented on August 23, 2024

I made a basic HRS3300 library for Arduino/nRF52 please look here: https://github.com/atc1441/HRS3300-Arduino-Library.

you can replace the serial with bleserial and it should print the Heartrate to ble.

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

Wow, very nice, thanks. So fortunately just the __hardfp_sqrt definition fix for Keil library was needed like with pah8001 library.

from ds-d6.

atc1441 avatar atc1441 commented on August 23, 2024

Not exactly. This time it was __hardfp_sqrt and not __hardfp_sqrtf so not for float, but yes kind of the same.

Also the hrs does not have a seperate define file for the library it is all within some other functions mixed up.

Made a short demo video: https://youtu.be/I8Ch9Db_a7M

from ds-d6.

corteXnzt avatar corteXnzt commented on August 23, 2024

So that what's missing with that library. Tested your library just now atc1441. This is good, haven't compared the BP yet with another smart band but by quick test I can read from 60-83 bpm. Thank you very much for immediate testing and library!

Question:
How did you edit the compiled lib? And I tried adding that on the segger embedded studio just in case I want to move away from arduino later on, now one of the error is >>undefined......\HRM\hrs3300_alg_dynamic.c:(i.Hrs3300_alg_send_data+0x5a): undefined reference to `__hardfp_sqrt'
which pertains to what you two are discussing.

from ds-d6.

atc1441 avatar atc1441 commented on August 23, 2024

No problem, i wanted to do it anyway, and now was the right time^^

The timing is quite importand, so you need to pull at exactly 40ms or another value, but everytime the same persiod.

I did not edit the compiled library, but it is possible to do it. extract the o file change the needed hex values in binary and combine it again with gcc ar or what it name was.

for the sqrt you need to add this somewhere: https://github.com/atc1441/HRS3300-Arduino-Library/blob/master/src/HRS3300lib.cpp#L4

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

one could also add this one line __hardfp_sqrt method directly to the library, but it doesn't matter much as it is in the source that comes with it

from ds-d6.

corteXnzt avatar corteXnzt commented on August 23, 2024

The timing is quite importand, so you need to pull at exactly 40ms or another value, but everytime the same persiod.

Ok noted on this.

I added that line and the error is gone. Thanks again to both of you. Cheers!

from ds-d6.

dariosalvi78 avatar dariosalvi78 commented on August 23, 2024

Hello! Any plan to include this into the Espruino-compatible bundle?

from ds-d6.

Related Issues (16)

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.