Data processing from the heart sensor

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.

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

Demo Flow (use CTRL-I to import)

[{"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

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