Can you clarify your question more? What do you mean that there is an AC and DC signal? The values you are reading from the FIFO are ADC counts for the IR and Red LEDs respectively?
PS: Based on the data in the image, it looks like you have the Low and High bytes flipped for endianness, as the Low bytes are not changing as much compared with the High bytes changing widely
Yes, these are the ADC counts for IR and Red LEDs. In order to get 1 complete sample we have to read the data register four times. Out of these 4 bytes, the 1st 2 bytes represent IR data and the next two represent Red LED's data (i've plotted it as 2bytes separately in order to avoid confusion). So, the problem is they haven't mentioned which byte represent DC value anywhere in the data sheet. It is required as I have to put it in a formula which is
R = (AC_R/DC_R)/(AC_IR/DC_IR)
Also, if I plot IR and Red LED's data separately on serial plotter, then it shows a proper plethysmogram but RED LED's data toggles between just 2 values when plotted simultaneously with IR. What could be the possible reason behind this?
1 of 1 people found this helpful
The chip does not give values for AC versus DC, it gives voltage readings at the specified rate for the IR/Red readings. You will need to process the data from the raw ADC voltage readings into separate AC/DC values in order to calculate your heart rate measurement, and will need to deal with the calculations that that entails.
Based on these documents:
And the datasheet for the sensor: https://datasheets.maximintegrated.com/en/ds/MAX30100.pdf
I tried running some of the calculations in an excel sheet, but I must be doing the math wrong, or missing something, as the oxygenation levels are too low. But, either way I believe the values from the sensor are only raw data and need to be processed before use. The AC component I took to be the difference between the maximum and minimum measurements on the data, and the DC is the average of the data measurements. Also, it would seem that the data is stored/output as High Byte, Low Byte, but it is weird that the low bytes are not changing much. Also, unless you are setting up the Maxim sensor before reading values, it could be set in the wrong mode/settings as well.
Thank you very much. I have one more doubt. The 4 bytes of data we get is in uint8 format. As I require ratio of some values, I have to convert that data into float. I've tried using type casting but the program unexpectedly stops running. Is there any other way to do it?
So, we tried to send these bytes to node-red using this code
var abc=msg.payload.split(" ");
Still, it is not working in Node-RED.