Arduino Polska Forum
Wyświetlacz pomiaru tętna w oparciu o Arduino - Wersja do druku

+- Arduino Polska Forum (https://forum.arduinopolska.pl)
+-- Dział: Inne (https://forum.arduinopolska.pl/dzial-inne)
+--- Dział: Projekty Arduino'wców (https://forum.arduinopolska.pl/dzial-projekty-arduino-wc%C3%B3w)
+--- Wątek: Wyświetlacz pomiaru tętna w oparciu o Arduino (/watek-wy%C5%9Bwietlacz-pomiaru-t%C4%99tna-w-oparciu-o-arduino)



Wyświetlacz pomiaru tętna w oparciu o Arduino - spikeli - 12-07-2021

Projekt wyświetlacza LCD Arduino Krótki wstęp:

Jakiś czas temu, znalazłem moduł czujnika tętna MAX30100. Moduł ten może zbierać tlen we krwi i dane o tętnie użytkowników, co jest również proste i wygodne w użyciu.

Według danych, znalazłem, że istnieją biblioteki z MAX30100 w Arduino plików bibliotecznych. Oznacza to, że jeśli używam komunikacji między Arduino i MAX30100, mogę bezpośrednio wywołać pliki biblioteki Arduino bez konieczności przepisywania plików sterownika. Jest to dobra rzecz, więc kupiłem moduł MAX30100.

Postanowiłem użyć Arduino do weryfikacji funkcji zbierania danych o tętnie i tlenie krwi MAX30100. Z ekranem STONE TFT LCD do monitorowania ciśnienia krwi.

[Obrazek: 1.jpg]

Podstawowe materiały elektroniczne są określane w następujący sposób:

1. Płytka rozwojowa Arduino Mini Pro

2. Moduł czujnika tętna i tlenu MAX30100

3. Moduł wyświetlacza portu szeregowego STONE STVI070WT-01 LCD

4. Moduł MAX3232

Zasada wykrywania

Wystarczy nacisnąć palcem na czujnik, aby ocenić nasycenie krwi tlenem (SpO2) i puls (odpowiednik bicia serca).

Pulsoksymetr (oksymetr) jest mini-spektrometrem, który wykorzystuje zasady różnych widm absorpcji czerwonych krwinek do analizy nasycenia krwi tlenem. Ta metoda pomiaru w czasie rzeczywistym i szybka jest również szeroko stosowana w wielu referencjach klinicznych.

Nie będę zbytnio przedstawiał MAX30100, ponieważ te materiały są dostępne w Internecie. Zainteresowani przyjaciele mogą szukać informacji na temat tego modułu testowego tętna w Internecie, i mieć głębsze zrozumienie jego zasady wykrywania.

Połączenie sprzętowe

Płyta Arduino Mini Pro i STVI070WT tft-lcd ekran są połączone przez UART, który wymaga konwersji poziomu przez MAX3232, a następnie Arduino Mini Pro i MAX30100 moduł są połączone przez interfejs IIC.Po myśląc jasno, możemy narysować następujące okablowanie obrazu:

[Obrazek: 8.jpg]

[Obrazek: 9.jpg]

Projekt GUI

[Obrazek: 12.jpg]

Adres komponentu wyświetlającego tekst:

- Sta połączenia : 0x0008

- Częstość akcji serca : 0x0001

- Tlen we krwi : 0x0005

Główna zawartość interfejsu UI jest następująca:

- Status połączenia

- Wyświetlanie tętna

- Wyświetlanie tlenu we krwi

Zmodyfikuj rezystor podciągający układu MAX30100 IIC

Należy zauważyć, że rezystancja podciągania 4,7k pinu IIC modułu MAX30100 jest podłączona do 1,8v, co teoretycznie nie stanowi problemu. Jednak poziom logiczny komunikacji Arduino IIC pin jest 5V, więc nie może komunikować się z Arduino bez zmiany sprzętu modułu MAX30100.Bezpośrednia komunikacja jest możliwa, jeśli MCU jest STM32 lub inny MCU z poziomem logicznym 3,3v.

W związku z tym należy dokonać następujących zmian:

[Obrazek: 15.jpg]

Usunąć trzy rezystory 4,7k zaznaczone na zdjęciu za pomocą lutownicy elektrycznej. Następnie przyspawać dwa rezystory 4,7k na pinach SDA i SCL do VIN, dzięki czemu będziemy mogli komunikować się z Arduino.

To Demo może być bezpośrednio testowane. Jeśli połączenie sprzętowe jest w porządku, można pobrać kompilację kodu do płytki rozwojowej Arduino i zobaczyć dane MAX30100 w narzędziu do debugowania szeregowego.

Kompletny kod jest następujący:

Kod:
/*

Arduino-MAX30100 oximetry / heart rate integrated sensor library

Copyright (C) 2016 OXullo Intersecans



This program is free software: you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation, either version 3 of the License, or

(at your option) any later version.



This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.



You should have received a copy of the GNU General Public License

along with this program. If not, see .

*/



#include

#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();

}

}

Wyświetlanie danych na wyświetlaczu STONE przez Arduino

Najpierw musimy uzyskać adres komponentu, który wyświetla dane o tętnie i tlenie krwi w wyświetlaczu STONE:

W moim projekcie adres ten jest następujący:

Adres komponentu wyświetlającego tętno: 0x0001

Adres modułu wyświetlającego tlen we krwi: 0x0005

Adres statusu połączenia czujnika: 0x0008

Jeśli potrzebujesz zmienić zawartość wyświetlacza w odpowiednim miejscu, możesz zmienić zawartość wyświetlacza, wysyłając dane do odpowiedniego adresu ekranu wyświetlacza przez port szeregowy Arduino.

Zmodyfikowany kod wygląda następująco:

Kod:
/*

Arduino-MAX30100 oximetry / heart rate integrated sensor library

Copyright (C) 2016 OXullo Intersecans



This program is free software: you can redistribute it and/or modify

it under the terms of the GNU General Public License as published by

the Free Software Foundation, either version 3 of the License, or

(at your option) any later version.



This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

GNU General Public License for more details.



You should have received a copy of the GNU General Public License

along with this program. If not, see .

*/



#include

#include "MAX30100_PulseOximeter.h"



#define REPORTING_PERIOD_MS 1000

#define Heart_dis_addr 0x01

#define Sop2_dis_addr 0x05

#define connect_sta_addr 0x08



unsigned char heart_rate_send[8]= {0xA5, 0x5A, 0x05, 0x82,\

0x00, Heart_dis_addr, 0x00, 0x00};

unsigned char Sop2_send[8]= {0xA5, 0x5A, 0x05, 0x82, 0x00, \

Sop2_dis_addr, 0x00, 0x00};

unsigned char connect_sta_send[8]={0xA5, 0x5A, 0x05, 0x82, 0x00, \

connect_sta_addr,0x00, 0x00};



// 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");

// connect_sta_send[7]=0x00;

// Serial.write(connect_sta_send,8);

for(;;);

} else {

connect_sta_send[7]=0x01;

Serial.write(connect_sta_send,8);

// 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("%");

heart_rate_send[7]=(uint32_t)pox.getHeartRate();

Serial.write(heart_rate_send,8);

Sop2_send[7]=pox.getSpO2();

Serial.write(Sop2_send,8);

tsLastReport = millis();

}

}

Efekt projektu wyświetlacza LCD Arduino można zobaczyć na poniższym zdjęciu:

[Obrazek: 21.jpg]

[Obrazek: 22.jpg]