I made a DIY pulse Oximeter; I used a 9v DC battery which is regulated to 5 V DC via an…
- User
I made a DIY pulse Oximeter; I used a 9v DC battery which is regulated to 5 V DC via an LM7805 and from 5 V I supply an Arduino pro mini and a and an OLED 0.96 SSD1306 display, in OLED display the SDA and SCL are connected to A4 and A5 of Arduino pro and also in Arduino Pro, A1 is assigned to an analog signal input from photodiode and pin 10 and 11 are for connecting to two BC547 with two 4.7 k ohm resistor, for the BC547 as I said the bases are connected to pin 10 and 11 and also the Emitter pin is connected short leg of IR and Red LED (cathode) and collector pin is connected to the ground of Arduino pro; also for the anode of LEDs, are directly connected to 5vDC - also photodiode anode is connected to A1 pin and through A1 pin there is 10 K ohm resistor which is connected to 5Vdc and also this is my 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
Based on the provided code and description, here are some potential problems and mistakes:
-
Power supply: Using a 9V DC battery regulated to 5V DC via an LM7805 may not be sufficient to power both the Arduino Pro Mini and the OLED display. The LM7805 has a dropout voltage of around 2V, which means the input voltage needs to be at least 7V to regulate it to 5V. Using a 9V battery may result in insufficient voltage for the components to function properly. Consider using a higher voltage battery or a different power supply arrangement.
-
Pin assignments: Make sure the pin assignments for the SDA, SCL, and analog input pins are correct. Double-check the pin numbers used for these connections to ensure they match the physical connections made.
-
- User
write me a review and report for this
- Assistant