I made a pulse oximeter and instead of using Max 30100 I’m using 2 leds (1 red and 1 IR…
- User
I made a pulse oximeter and instead of using Max 30100 I’m using 2 leds (1 red and 1 IR 940 nm sender) and one photodiode 940 nm receiver and I’m using Arduino pro mini (pin A1 is assigned to analog signal input from photodiode and pin 10 and 11 are connected to base of BC547 Transistors with two 4.7k ohm resistors) and O’LED 0.96 ssd 1306 for display( SDA and SCL are connected to A4 and A5 of arduino pro) my power supply is 9v DC battery with a LM7805 and also pins for IR and Red led are connected to two bases of BC547 with a 4.7 k Ohm resistors and also the collector pin is connected short leg of LED cathode and Emitter pin is connected to ground and anode of led are connected to 5 v dc and also photodiode is connected to A1 and through a junction is connected to Vcc with a 10 K resistor code : #include <Wire.h> //#include <LiquidCrystal_I2C.h> #include <SPI.h>
#include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 32 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) #define OLED_RESET 4 Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define maxperiod_siz 80 // max number of samples in a period #define measures 10 // number of periods stored #define samp_siz 4 // number of samples for average #define rise_threshold 3 // number of rising measures to determine a peak
// a liquid crystal displays BPM //LiquidCrystal_I2C lcd(0x3F, 16, 2);
int T = 20; // slot milliseconds to read a value from the sensor int sensorPin = A1; int REDLed = 10; int IRLed = 11;
int SpO2; int avBPM;
byte sym[3][8] = { { B00000, B01010, B11111, B11111, B01110, B00100, B00000, B00000 },{ B00000, B00000, B00000, B11000, B00100, B01000, B10000, B11100 },{ B00000, B00100, B01010, B00010, B00100, B00100, B00000, B00100 } };
void setup() { Serial.begin(9600); Serial.flush(); pinMode(sensorPin,INPUT); pinMode(REDLed,OUTPUT); pinMode(IRLed,OUTPUT);
// initialize the LCD // lcd.init(); // lcd.backlight();
// turn off leds digitalWrite(REDLed,LOW); digitalWrite(IRLed,LOW);
// for(int i=0;i<8;i++) lcd.createChar(i, sym[i]); if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32 Serial.println(F("SSD1306 allocation failed")); for(;;); // Don't proceed, loop forever
}}
void loop () { /*display.clearDisplay(); display.setTextSize(1); // Draw 2X-scale text display.setTextColor(SSD1306_WHITE); display.setCursor(20, 10); display.println("Insert Fingure");
display.display(); */ bool finger_status = true;
float readsIR[samp_siz], sumIR,lastIR, reader, start; float readsRED[samp_siz], sumRED,lastRED;
int period, samples; period=0; samples=0; int samplesCounter = 0; float readsIRMM[maxperiod_siz],readsREDMM[maxperiod_siz]; int ptrMM =0; for (int i = 0; i < maxperiod_siz; i++) { readsIRMM[i] = 0;readsREDMM[i]=0;} float IRmax=0; float IRmin=0; float REDmax=0; float REDmin=0; double R=0;
- Assistant
The code you provided is for a pulse oximeter using two LEDs (red and infrared) and a photodiode. The Arduino Pro Mini is used as the microcontroller, and an OLED display is used to show the SpO2 and BPM readings. The power supply is a 9V DC battery with a LM7805 voltage regulator.
The code begins with the necessary library inclusions for the OLED display and the Wire library for I2C communication. The pin assignments for the sensors and LEDs are defined, along with other variables and arrays used in the calculations.