Hello.
I'm currently undertaking a project to make a non-invasive glucometer using NIR(Near Infrared). I've been digging a lot lately about how to get these data from a human finger, i've been trying some formula using beer lambert's law which has been unsuccessful in giving me a plausible result. I don't need a precise result but at least something close by that i can work with, So far i have only static result that remain the same no matter the blood glucose of the patient. I am using a MAX30102 sensor with a Node Mcu board.
I came to conclusion that i will need someone who has enough knowledge in medical electronics of some sort to help me figure out a formula . It will be useless to post my code as i know there's
no sense to it.
Posting the code is never wrong. It can at least show how the accessing is done.
Some wiring of the circuits, the same. No option/strap etc forgotten?
You post gives us nothing to start from.
#include <Wire.h>
#include "MAX30105.h"
#include "heartRate.h"
MAX30105 particleSensor;
const byte RATE_SIZE = 20; //Increase this for more averaging. 4 is good.
byte rates[RATE_SIZE]; //Array of heart rates
byte rateSpot = 0;
long lastBeat = 0; //Time at which the last beat occurred
long A=0,beer=0,diff;
long conv;
float beatsPerMinute;
int beatAvg;
void setup()
{
Serial.begin(115200);
Serial.println("Initializing...");
// Initialize sensor
if (!particleSensor.begin(Wire, I2C_SPEED_FAST)) //Use default I2C port, 400kHz speed
{
Serial.println("MAX30105 was not found. Please check wiring/power. ");
while (1);
}
Serial.println("Place your index finger on the sensor with steady pressure.");
particleSensor.setup(); //Configure sensor with default settings
particleSensor.setPulseAmplitudeRed(0); //Turn Red LED to low to indicate sensor is running
particleSensor.setPulseAmplitudeGreen(0); //Turn off Green LED
}
void loop()
{
long irValue = particleSensor.getIR();
long redV= particleSensor.getRed();
int analog= analogRead(D1);
if (checkForBeat(irValue) == true)
{
//We sensed a beat!
long delta = millis() - lastBeat;
lastBeat = millis();
beatsPerMinute = 60 / (delta / 1000.0);
diff= irValue-redV;
A=-log(irValue/65536);
beer= A/(2.303*0.1);
if (beatsPerMinute < 255 && beatsPerMinute > 20)
{
rates[rateSpot++] = (byte)beatsPerMinute; //Store this reading in the array
rateSpot %= RATE_SIZE; //Wrap variable
//Take average of readings
beatAvg = 0;
for (byte x = 0 ; x < RATE_SIZE ; x++)
beatAvg += rates[x];
beatAvg /= RATE_SIZE;
}
}
Serial.print("IR=");
Serial.print(irValue);
Serial.print(",RED=");
Serial.print(redV);
Serial.print(", BPM=");
Serial.print(beatsPerMinute);
Serial.print(", Avg BPM=");
Serial.print(beatAvg);
Serial.print(", BGM =");
Serial.print(beer);
Serial.print(", A =");
Serial.print(A);
if (irValue < 50000)
Serial.print(" No finger?");
Serial.println();
}[quote="Railroader, post:2, topic:1179083, full:true"]
Posting the code is never wrong. It can at least show how the accessing is done.
Some wiring of the circuits, the same. No option/strap etc forgotten?
You post gives us nothing to start from.
[/quote]
The Code is essentially the example code for the heart rate from the example which i've added a so called formula at line 74-75 and outputting in the end.
![image|690x336](upload://alUSJSnpbR7io2k8UgaLfJ0sPJ7.jpeg)
Would you show the links to the library files? I think your code requires old library files. Your code does not compile with recent Adafruit libraries.
Where does the Glucometer come into the project, at the moment you are just measuring heart beats by the looks of it.
I know you can measure blood oxygen with these IR pulse devices, but Blood Sugar? max30102.pdf (895.8 KB)
Hello Tom. Yes on my code actually i am measuring heartrate. As yo mentioned the sensor is a pulse oximetry sensor but i have searched a bit like i mentioned and it seem that the IR can be used to determine blood glucose too at 900nm. I have seen a lot of complex formula and derivation in many papers but for me as of now i cannot derive any formula to help me. I am using the heart rate example file as it give me near Realtime output about the data such as IR and Red value.
the code i posted is an example that i have kind of edited to measure BGM. The connection is good else i would have error about the MAX30102 not found . I can even change the brightness of the red led(0 to 255). The connection is good so far, my only issue is use a suitable formula/algorithm for measuring the blood glucose and as i stated i don't need a pin point accuracy but at least have a fluctuating value with my blood glucose.
Controller used is a Node Mcu with esp8266 . As for the calibration i really don't know and i guess it is part of the process to then determine a suitable algorithm. Do you have something i can get started with for the calibration. It is my first time working with such sensor.
To everyone , here is a link to a paper with the formulas that i need to use supposedly. Can anyone help me in working out the formula so that i can use it in my code. Thank you
Did you notice that the paper was published in an engineering journal, and that the authors admitted that every single individual they tested was so different that each had to undergo a complex calibration procedure?
The pharmaceutical companies have been working hard on the problem of noninvasive glucose testing for decades, because a universal tester would make them $$Billions, and no one has yet succeeded.
Thank for your reply and yes i am aware of the current situation and totally agree with you . I'm not trying to create a universal version, i am just making a project for my university final year project. I chose this title as it was an unconventional one. I am just trying to work out the formulae/s so that i can use ,test and calibrate it to me specifically. For a fact i am using a pulse oximetry sensor for this project this shows that there's no specific sensor and resources available for such projects. I've been sitting on it for the past few days and i kind of made something out that is working out in giving me supposed blood glucose readings. Once it is finished i shall post the project and so far i am having result which is 1-3 mmol/l close to the value of a conventional glucometer. is It reliable : no . is it usable: yes . Can it be improved: absolutely .