[아두이노] MAX30100 심박 & 산소포화도 센서 불량 보드 사용하는 법


안녕하세요 대짜이찐입니다.

심박센서와 산소포화도 측정 기능이 있는

MAX30100 모듈 중에

설계부터 잘못되어있는 보드가 있습니다.


이렇게 생긴 MAX30100 모듈 보드입니다.

다른 센서 제품을 사는게 제일 좋지만
이 제품을 이미 구매했거나 가지고 있고
 사용하고 싶다면 좀 귀찮은 방법이 필요합니다.


우선 빨간색 박스안에 있는
풀업 목적으로 있는 4.7k옴 저항 3개를 
납땜으로 제거해야 합니다.

그 이후 외부에서 4.7k옴 저항을 Vin에 연결해서 SCL, SDA핀에 
풀업 저항으로 연결해 줍니다.

제품의 설계가 잘못된 이유는 SCL, SDA핀의 풀업 저항이 내부 MAX30100칩이 동작하는
1.8V로 연결되어있기 때문에 더 높은 로직레벨을 가진 MCU에서는 동작하기
어려울 수 있습니다. 따라서 VIN에 연결하여 3.3V나 5V로 동작할때의
풀업 저항을 맞춰줍니다.


라이브러리는 아두이노IDE-메뉴-툴-라이브러리 관리...에서
MAX30100을 검색해서 다운로드 해줍니다.

#include <Wire.h>
#include "MAX30100_PulseOximeter.h"
 
#define REPORTING_PERIOD_MS     1000
 
// PulseOximeter is the higher level interface to the sensor
// it offers:
//  * beat detection reporting
//  * heart rate calculation
//  * SpO2 (oxidation level) calculation
PulseOximeter pox;
 
uint32_t tsLastReport = 0;
 
// Callback (registered below) fired when a pulse is detected
void onBeatDetected()
{
    Serial.println("Beat!");
}
 
void setup()
{
    Serial.begin(115200);
 
    Serial.print("Initializing pulse oximeter..");
 
    // Initialize the PulseOximeter instance
    // Failures are generally due to an improper I2C wiring, missing power supply
    // or wrong target chip
    if (!pox.begin()) { Serial.println("FAILED");
for(;;);
else {
Serial.println("SUCCESS");
     }
 
    // The default current for the IR LED is 50mA and it could be changed
    //   by uncommenting the following line. Check MAX30100_Registers.h for all the
    //   available options.
    // pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
 
    // Register a callback for the beat detection
 pox.setOnBeatDetectedCallback(onBeatDetected);
}
 
void loop()
{
    // Make sure to call update as fast as possible
pox.update();
 
    // Asynchronously dump heart rate and oxidation levels to the serial
    // For both, a value of 0 means "invalid"
    if (millis() - tsLastReport > REPORTING_PERIOD_MS) {
Serial.print("Heart rate:");
Serial.print(pox.getHeartRate());
Serial.print("bpm / SpO2:");
 Serial.print(pox.getSpO2());
 Serial.println("%");

  tsLastReport = millis();
    }
}
cs

예제 코드는 
아두이노 IDE-파일-예제-Max30100lib의
MAX30100_Minimal입니다.


풀업 저항을 바꾸기전에는 Max30100에 있는 LED가 동작하지 않지만
풀업 저항을 바꾸면 동작하며, 
아두이노 시리얼 모니터도 정상동작합니다.


심박측정과 산소포화도 측정 모두 됩니다.

다음엔 다른 센서를 알려드리겠습니다.

전자부품 NO.1 쇼핑몰 디바이스마트

감사합니다.






 

댓글 쓰기

1 댓글