รหัสสินค้า | AS00612 |
หมวดหมู่ | โมดูลเซ็นเซอร์ทางชีวภาพ Biometrics Sensor |
ราคา | 1,385.00 บาท |
สถานะสินค้า | พร้อมส่ง |
จำนวน | ชิ้น |
ดูรายละเอียดเพิ่มเติมการใช้งานและตัวอย่าง code ได้ที่
Introduction:
Note:
Wear Instructions
Connect with DFRduino UNO R3
Connect with Raspberry Pi
Features:
Specification:
Wear Instructions
Board Overview
Num | Label | Description |
---|---|---|
1 | D/T | I2C Data Line/TX |
2 | C/T | I2C Clock Line/RX |
3 | GND | Power - |
4 | VCC | Power + |
Tutorial
Requirements
Hardware
Arduino UNO R3 (or similar) x 1
Gravity: MAX30102 heart rate blood oxygen sensor x1
Dupont wires
Software
Download and install the Heart Rate Sensor Library and Sample Codes Library (About how to install the library?)
Note: RTU library is the modbus library transplanted for Arduino based on Modbus RTU protocol. Install the RTU library before use.
Connection Diagram
Sample Code 1 - Get the Heart Rate and Blood Oxygen Data
Obtain the heart rate blood oxygen value, start measuring the heart rate when the sensor's red light is on, the heart rate data is updated every 4 seconds, the sensor data can still be obtained within 4 seconds, but the data obtained during the data update period does not change.
Please pay attention to the position of the communication switch.
/*!
* @file gainHeartbeatSPO2.ino
* @n experiment phenomena: get the heart rate and blood oxygenation, during the update the data obtained does not change
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
* @licence The MIT License (MIT)
* @author PengKaixing(kaixing.peng@dfrobot.com)
* @version V1.0
* @date 2021-06-21
* @get from https://www.dfrobot.com
* @url https://github.com/DFRobot/DFRobot_BloodOxygen_S
*/
#include "DFRobot_BloodOxygen_S.h"
#define I2C_COMMUNICATION //use I2C for communication, but use the serial port for communication if the line of codes were masked
#ifdef I2C_COMMUNICATION
#define I2C_ADDRESS 0x57
DFRobot_BloodOxygen_S_I2C MAX30102(&Wire ,I2C_ADDRESS);
#else
/* ---------------------------------------------------------------------------------------------------------------
* board | MCU | Leonardo/Mega2560/M0 | UNO | ESP8266 | ESP32 | microbit |
* VCC | 3.3V/5V | VCC | VCC | VCC | VCC | X |
* GND | GND | GND | GND | GND | GND | X |
* RX | TX | Serial1 TX1 | 5 | 5/D6 | D2 | X |
* TX | RX | Serial1 RX1 | 4 | 4/D7 | D3 | X |
* ---------------------------------------------------------------------------------------------------------------*/
#if defined(ARDUINO_AVR_UNO) || defined(ESP8266)
SoftwareSerial mySerial(4, 5);
DFRobot_BloodOxygen_S_SoftWareUart MAX30102(&mySerial, 9600);
#else
DFRobot_BloodOxygen_S_HardWareUart MAX30102(&Serial1, 9600);
#endif
#endif
void setup()
{
Serial.begin(115200);
while (false == MAX30102.begin())
{
Serial.println("init fail!");
delay(1000);
}
Serial.println("init success!");
Serial.println("start measuring...");
MAX30102.sensorStartCollect();
}
void loop()
{
MAX30102.getHeartbeatSPO2();
Serial.print("SPO2 is : ");
Serial.print(MAX30102._sHeartbeatSPO2.SPO2);
Serial.println("%");
Serial.print("heart rate is : ");
Serial.print(MAX30102._sHeartbeatSPO2.Heartbeat);
Serial.println("Times/min");
Serial.print("Temperature value of the board is : ");
Serial.print(MAX30102.getTemperature_C());
Serial.println(" ℃");
//The sensor updates the data every 4 seconds
delay(4000);
//Serial.println("stop measuring...");
//MAX30102.sensorEndCollect();
}
/*!
* @brief Get heart rate and oxygen saturation and store them into the structure sHeartbeatSPO2
* @param NULL
* @return No value returned
*/
void getHeartbeatSPO2();
/*!
* @brief Get the sensor board temp
* @param NULL
* @return Temp (unit: ℃)
*/
float getTemperature_C();
/*!
* @brief Sensor starts to collect data
* @param NULL
* @return NULL
*/
void sensorStartCollect();
/*!
* @brief Sensor stops collecting data
* @param NULL
* @return NULL
*/
void sensorEndCollect();
pi@raspberrypi:~ $ sudo raspi-config
Select "5 Interfacing Options" and press Enter. Select "P5 I2C" and press Enter to confirm "YES". Restart the Raspberry Pi master control.
pi@raspberrypi:~ $ sudo apt-get update
pi@raspberrypi:~ $ sudo apt-get install build-essential python-dev python-smbus git
pi@raspberrypi:~ $ cd Desktop/
pi@raspberrypi:~/Desktop $ git clonehttps://github.com/DFRobot/DFRobot_BloodOxygen_S
pi@raspberrypi:~/Desktop $ cd DFRobot_BloodOxygen_S/python/raspberry/example/gain_heartbeat_SPO2/
pi@raspberrypi:~/Desktop/DFRobot_BloodOxygen_S/python/raspberry/example/gain_heartbeat_SPO2/ $ python gain_heartbeat_SPO2.py
Connect the sensor to the USB-to-serial port module.
Click to download the master computer of Heart Rate and Oximeter Sensor.
After decompressing, run SEN0344.exe, select the serial port and baud rate and click to start the measurement.
Modbus RTU Protocols
Note: The communication interface uses UART
Transmit | From A device to B device | ||||
---|---|---|---|---|---|
Functions | B device Addess | Function Code | Register Address | Register Number | CRC Check |
Get the Heart Rate and Blood Oxygen Data | 0×20 | 0×03/Read | 0×00 0×06 | 0×00 0×04 | CRC_h CRC_l |
Get the Temperature | 0×20 | 0×03 | 0×00 0×0A | 0×00 0×01 | CRC_h CRC_l |
Receive | Response from B device | ||||
Functions | Bdevice Addess | Function Code | Valid Bytes | Data | CRC Check |
Get the Heart Rate and Blood Oxygen Data | 0×20 | 0×03 | 0×08 | SPO2(1byte) xx(1byte reseved) Heartbeat(4byte) xx(2byte reserved) | CRC_h CRC_l |
Get the Temperature | 0×20 | 0×03 | 0×02 | Temp_h Temp_l | CRC_h CRC_l |
Set the Sensor | Transmit From A device | ||||
---|---|---|---|---|---|
Functions | B device Addess | Function Code | Register Address | Register Number | CRC Check |
Start to Collet Data | 0×20 | 0×06 | 0×00 0×10 | 0×00 0×01 | CRC_h CRC_l |
Stop Colleting Data | 0×20 | 0×06 | 0×00 0×10 | 0×00 0×02 | CRC_h CRC_l |
Set the Sensor | Response From B device | ||||
Functions | B device Addess | Function Code | Valid Bytes | Data | CRC Check |
Start to Collet Data | 0×20 | 0×06 | 0×00 0×10 | 0×00 0×01 | CRC_h CRC_l |
Stop Colleting Data | 0×20 | 0×06 | 0×00 0×10 | 0×00 0×02 | CRC_h CRC_l |
CRC check
static uint16_t calculate_CRC(uint8_t *data, uint8_t len)
{
uint16_t crc = 0xFFFF;
for( uint8_t pos = 0; pos < len; pos++)
{
crc ^= (uint16_t)data[ pos ];
for(uint8_t i = 8; i != 0; i--)
{
if((crc & 0x0001) != 0){
crc >>= 1;
crc ^= 0xA001;
}else{
crc >>= 1;
}
}
}
crc = ((crc & 0x00FF) << 8) | ((crc & 0xFF00) >> 8);
return crc;
}
ชำระเงินค่าสินค้าโดยการโอนเงินเข้าบัญชีธนาคาร KBANK, SCB, BBL,TMB
กรุณาเก็บหลักฐานการโอนเงินของท่านไว้เพื่อแจ้งการชำระเงินด้วยค่ะ
ท่านสามารถแจ้งการชำระเงินผ่านระบบอัตโนมัติได้โดย Click Link ข้างล่างค่ะ
https://www.arduitronics.com/informpayment
หน้าที่เข้าชม | 15,410,574 ครั้ง |
ผู้ชมทั้งหมด | 5,913,652 ครั้ง |
เปิดร้าน | 21 พ.ค. 2556 |
ร้านค้าอัพเดท | 28 ก.ย. 2568 |