BASIC4MCU | 질문게시판 | [아두이노] MAX 30102를 사용해 측정된 심박수를 매핑하고 싶습니다.
페이지 정보
작성자 뭉글적 작성일2021-07-09 12:45 조회3,302회 댓글1건본문
아두이노 나노와 MAX 30102 센서를 사용하며 측정값을 받아서 매트랩을 통해 그래프화 시키려고 합니다.
심박 측정이 되지 않을 때(1)와 측정이 될 때(2)의 차이가 너무 심해서 1만 이내의 값으로 매핑하고자 합니다.
1 : 약 600~1,000
2 : 약 80,000 ~ 100,000
MAX 30102의 데이터 시트를 찾아봤는데 측정 가능한 최소,최댓값이 보이지 않아서 어떻게 해야 좋을지 잘 모르겠어서 도움을 부탁드립니다 ㅜㅜ
코드는 MAX 3010*의 기본 아두이노 라이브러리 예제를 사용하였습니다.
#include <Wire.h>
#include "MAX30105.h"
MAX30105 particleSensor;
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);
}
//Setup to sense a nice looking saw tooth on the plotter
byte ledBrightness = 0x1F; //Options: 0=Off to 255=50mA
byte sampleAverage = 8; //Options: 1, 2, 4, 8, 16, 32
byte ledMode = 3; //Options: 1 = Red only, 2 = Red + IR, 3 = Red + IR + Green
int sampleRate = 100; //Options: 50, 100, 200, 400, 800, 1000, 1600, 3200
int pulseWidth = 411; //Options: 69, 118, 215, 411
int adcRange = 4096; //Options: 2048, 4096, 8192, 16384
particleSensor.setup(ledBrightness, sampleAverage, ledMode, sampleRate, pulseWidth, adcRange); //Configure sensor with these settings
//Arduino plotter auto-scales annoyingly. To get around this, pre-populate
//the plotter with 500 of an average reading from the sensor
//Take an average of IR readings at power up
const byte avgAmount = 64;
long baseValue = 0;
for (byte x = 0 ; x < avgAmount ; x++)
{
baseValue += particleSensor.getIR(); //Read the IR value
}
baseValue /= avgAmount;
//Pre-populate the plotter so that the Y scale is close to IR values
for (int x = 0 ; x < 500 ; x++)
Serial.println(baseValue);
}
void loop()
{
Serial.println(particleSensor.getIR()); //Send raw data to plotter
}
댓글 1
조회수 3,302master님의 댓글
master 작성일
void loop(){
uint32_t value=particleSensor.getIR(); //Send raw data to plotter
if(value<10000)Serial.println(value); // 10000 미만일 때만 출력
}