# Data processing from the heart sensor

**URL:** https://discourse.nodered.org/t/data-processing-from-the-heart-sensor/77302
**Category:** General
**Created:** [6 April 2023 07:40 UTC](https://discourse.nodered.org/t/data-processing-from-the-heart-sensor/77302 "2023-04-06T07:40:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tsuratolya](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tsuratolya/32/59853_2.png) [@tsuratolya](https://discourse.nodered.org/u/tsuratolya)
#### Post date: [6 April 2023 07:40 UTC](https://discourse.nodered.org/t/data-processing-from-the-heart-sensor/77302/1 "2023-04-06T07:40:54Z")

</div>

I receive data from a heart sensor like this "22,76,55,4" (Byte 0 - flags: 22 (0001 0110); 71 is the number of heart beats per minute; 137, 3 are two RR-Interval numbers that must be summed in binary, converted to decimal and divided by 1024) [55, 4] equals 1079 (55 + 4\<\<8) R0: 1.05 s = (1079/1024). Sometimes they happen when you move "22,71,84,2,81,2". I need to convert the data and get RR-Interval 0, RR-Interval 1 (if it exists). The task is not simple. All I've learned is to break numbers. Please help me to get the necessary information. I think this example will be useful to someone else.

 ![heart](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/d/6d7d2c2b44a607ad18f25be28fa3e5a4317cc2a2.png)

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [6 April 2023 08:55 UTC](https://discourse.nodered.org/t/data-processing-from-the-heart-sensor/77302/2 "2023-04-06T08:55:45Z")

</div>

I am struggling to make sense of the numbers you provided (probably me, but it doesnt read well - sorry)

Perhaps something like this works for you?...

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/1/31322b5b09fbe1dc35a69a0466b06de85e806aa9.png)

Demo Flow (use `CTRL-I` to import)

```auto
[{"id":"73f5506ae06babdf","type":"buffer-parser","z":"de82ce801a7bf934","name":"","data":"payload","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"bool","name":"flags","offset":0,"length":8,"offsetbit":0,"scale":"1","mask":""},{"type":"uint8","name":"BPM","offset":1,"length":1,"offsetbit":0,"scale":"1","mask":""},{"type":"int16le","name":"RR","offset":2,"length":1,"offsetbit":0,"scale":"/ 1024","mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"return","multipleResult":false,"fanOutMultipleResult":false,"setTopic":true,"outputs":1,"x":1130,"y":1040,"wires":[["2007197029ce242c"]]},{"id":"2007197029ce242c","type":"debug","z":"de82ce801a7bf934","name":"parsed","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1270,"y":1040,"wires":[]},{"id":"88463f7e26fc083b","type":"inject","z":"de82ce801a7bf934","name":"[22,76,55,4] (0x16 0x4C 0x37 0x04)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[22,76,55,4]","payloadType":"bin","x":1180,"y":980,"wires":[["73f5506ae06babdf"]]}]

```

PS, you will need to install `node-red-contrib-buffer-parser`

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [5 June 2023 08:56 UTC](https://discourse.nodered.org/t/data-processing-from-the-heart-sensor/77302/3 "2023-06-05T08:56:45Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
