10439 views|33 replies

931

Posts

3

Resources
The OP
 

Blood oxygen heart rate monitoring device based on STM32F103 [Copy link]

 
 
I was busy meeting guests during the Spring Festival, and suddenly I received a call marked as "XX International Freight Forwarding Company". I thought this liar was too bluffing. I will register a "space development company" next time, which is much more impressive than your "international agency company". I hung up the phone immediately. The next day, the call came again. Out of courtesy, I answered the phone: "Hello!" The other party said: "Are you Mr. H?" After getting my confirmation and verifying my name, he said: "You have a package sent from the Philippines. May I ask for your detailed address? We will send it to you by XX Express." At this time, I suddenly remembered that I had applied for a blood oxygen heart rate detection chip evaluation at the end of last year, and there has been no news since then. I thought the matter was over.
Soon after, I received a package from the courier. It was a 20cm square carton (see the picture below). There were several shipping packing lists attached to the outside of the box. I guess they were needed for customs clearance.
After opening the box, I saw several anti-static packaging bags of different sizes.
There was also a shipping packing list similar to the one outside the box, and several color pages.
A refined cardboard box was taken out from the pink shockproof packaging bag. After opening the cardboard box, a small chip of 1 cm square was inserted in the middle of the empty sponge pad. This is the protagonist of this evaluation (see the picture below).
The picture below is a close-up of the chip. It is a small PCB board with 8 pads, about 1 cm square. After careful inspection and analysis, I found that the two pads on the left and right are the power supply and ground wires respectively, and the upper and lower 6 pads are connected separately, which are actually the chip's interrupt INT pin and the SCL and SDA pins used for I2C communication.
I took out a latex product from another small anti-static packaging bag. I didn’t know what it was used for at first, but after reading the instructions, I realized that it was a card bag that could be used to store bank cards or ID cards.
There was also a refined ballpoint pen (see the picture below).
There was also a thick anti-static packaging bag. At first, I thought it contained equipment or materials for development, but after opening it, I found that it was a notebook. However, this notebook is also very refined. It not only has an elastic band for sealing and a ribbon for bookmarks, but also has a grid pattern that is not like the horizontal grid we usually use, but a grid pattern that is staggered horizontally and vertically, which is convenient for drawing and positioning.
After opening the last anti-static packaging bag, there are ten test wires with alligator clips. Among these small gifts, I think this one is the most practical.
I didn't find the technical manuals or instructions for use that I needed in the entire packaging box. Fortunately, the website address is printed on the promotional brochure, and I can go to the official website to download the information.
The information downloaded from the Maxim official website is all in English, which is difficult for me, an "illiterate". I relied on Baidu Translate to barely understand a little bit, but I still couldn't find a description of the function of the chip pins and instructions on how to use them. After reading the program repeatedly, I realized that the INT pin is the chip that provides a signal so that the host can start reading the detection data on the I2C bus, and SCL and SDA are obviously used for I2C bus communication.
The official routines are mainly files with the suffix cpp. At first, I followed the instructions on the Internet to change the suffix to .c and then compile it. Later I found out that there was no need to change the suffix at all and it can be compiled normally. The official files mainly include: 1. MAX30102.cpp (initialize the chip and read and write data); 2. algorithm.cpp (algorithm); 3. main.cpp (main function). Other pin settings and I2C drivers are in the mbed folder. Except for the header files, all the files in mbed are compiled.o file.
I started to use the existing GD32E230 development board driver, but I couldn't successfully establish I2C communication with the detection chip. After that, I switched to the STM32F103 minimum system board but still failed. The LED of the detection chip never lit up, so I even suspected that the chip was damaged. In order to determine whether the pins used to simulate I2C are normal, I also used a logic analyzer to test the functions of the relevant pins to see if they can be controlled normally (see the figure below).
Later, I found an application based on STM32F103C8T6 MCU on the Internet. After downloading, it did not contain the key mbed folder content, so the compilation failed, and I didn't know where to find these files. Finally, I found a project package based on STM32F103C8T6 in another forum. The compressed package was complete. After decompression, the compilation passed smoothly. Not only did it successfully drive the detection chip, but the detection data could also be obtained on the computer through serial communication (see the figure below). After the chip driver was successful, I started to work on the LCD display function. It seemed simple, but I took a detour in the choice of firmware library. At first, I used the standard library, but the compilation always went wrong. Finally, I repeatedly checked the code and the files in the folder and found that the HAL library was used in this project. After modifying the corresponding code, I completed the function of displaying data on the LCD display. For the convenience of testing, I welded an expansion board with a perforated board, and used a mouse cable to connect the expansion board and the detection chip. At the same time, the LCD screen can also be directly plugged into the expansion board (see the figure below). This can avoid the mess and looseness of the DuPont line causing poor contact.
For ease of use, I found a plastic bottle cap and sewed the detection chip inside the bottle cap, which can be put on the finger. This is not only convenient for use, but also can reduce the influence of stray light during detection.
Next, I will display the dynamic graph of the pulse on the LCD. It took me a lot of trouble to choose the data source. At first, I used the data read from the detection chip, but the display effect was not ideal. Later, I used the variables that drive the PWM light-emitting tube. In the display mode, I used curves at first, because the resolution of my LCD display was too low and the display effect was not good. Later, I changed to use vertical lines to form a black area display, and the effect was a little better (see the figure below).
So far, this project has been basically completed. From the use situation, because the program uses the storage of 500 sets of data before calculation, there is an obvious lag phenomenon. At the beginning of use, it takes a few seconds to stabilize before gradually displaying normal data. In addition, if there is a little activity during the detection process, the data will be abnormal. The blood oxygen value fluctuates relatively little, but the maximum fluctuation of heart rate is even more than 200 times/second. In addition, the chip deadlock phenomenon occasionally occurs during use. Resetting the microcontroller is ineffective. It must be powered off and reloaded to restore to normal.
The next test plan is to add a Bluetooth module and develop an Android APP to send the detection data to the mobile phone for display, so as to make the heart rate waveform display more beautiful and achieve a better experience.
This is the STM32F103C8T6 file package I found on the Internet
MAX30102_uvision5_stm32f103c8.rar (2.69 MB, downloads: 159)
After downloading the MCU application, the compilation failed because it did not contain the key mbed folder content, and I didn't know where to find these files. Finally, I found a project package based on STM32F103C8T6 in another forum. This compressed package had complete information. After decompression, the compilation passed smoothly. Not only did it successfully drive the detection chip, but it also obtained the detection data on the computer through serial communication (see the figure below).
After the chip was successfully driven, I started to work on the LCD display function. It seemed simple, but I took a detour in the choice of firmware library. At first I used the standard library, but the compilation always went wrong. Finally I checked the code and the files in the folder repeatedly and found that the HAL library was used in this project. After modifying the corresponding code, I completed the function of displaying data on the LCD display. For the convenience of testing, I welded an expansion board with a perforated board, connected the expansion board with the detection chip with a mouse cable, and the LCD screen can also be directly plugged into the expansion board (see the figure below). This can avoid the poor contact caused by the clutter and looseness of the Dupont line.
For ease of use, I found a plastic bottle cap and sewed the detection chip inside the bottle cap, which can be put on the finger. This is not only convenient for use, but also can reduce the influence of stray light during detection.
Next, I will display the dynamic graph of the pulse on the LCD. It took me a lot of trouble to choose the data source. At first, I used the data read from the detection chip, but the display effect was not ideal. Later, I used the variables that drive the PWM light-emitting tube. In the display mode, I used curves at first, because the resolution of my LCD display was too low and the display effect was not good. Later, I changed to use vertical lines to form a black area display, and the effect was a little better (see the figure below).
So far, this project has been basically completed. From the use situation, because the program uses the storage of 500 sets of data before calculation, there is an obvious lag phenomenon. At the beginning of use, it takes a few seconds to stabilize before gradually displaying normal data. In addition, if there is a little activity during the detection process, the data will be abnormal. The blood oxygen value fluctuates relatively little, but the maximum fluctuation of heart rate is even more than 200 times/second. In addition, the chip deadlock phenomenon occasionally occurs during use. Resetting the microcontroller is ineffective. It must be powered off and reloaded to restore to normal.
The next test plan is to add a Bluetooth module and develop an Android APP to send the detection data to the mobile phone for display, so as to make the heart rate waveform display more beautiful and achieve a better experience.
This is the STM32F103C8T6 file package I found on the Internet
MAX30102_uvision5_stm32f103c8.rar (2.69 MB, downloads: 159)
After downloading the MCU application, the compilation failed because it did not contain the key mbed folder content, and I didn't know where to find these files. Finally, I found a project package based on STM32F103C8T6 in another forum. This compressed package had complete information. After decompression, the compilation passed smoothly. Not only did it successfully drive the detection chip, but it also obtained the detection data on the computer through serial communication (see the figure below).
After the chip was successfully driven, I started to work on the LCD display function. It seemed simple, but I took a detour in the choice of firmware library. At first I used the standard library, but the compilation always went wrong. Finally I checked the code and the files in the folder repeatedly and found that the HAL library was used in this project. After modifying the corresponding code, I completed the function of displaying data on the LCD display. For the convenience of testing, I welded an expansion board with a perforated board, connected the expansion board with the detection chip with a mouse cable, and the LCD screen can also be directly plugged into the expansion board (see the figure below). This can avoid the poor contact caused by the clutter and looseness of the Dupont line.
For ease of use, I found a plastic bottle cap and sewed the detection chip inside the bottle cap, which can be put on the finger. This is not only convenient for use, but also can reduce the influence of stray light during detection.
Next, I will display the dynamic graph of the pulse on the LCD. It took me a lot of trouble to choose the data source. At first, I used the data read from the detection chip, but the display effect was not ideal. Later, I used the variables that drive the PWM light-emitting tube. In the display mode, I used curves at first, because the resolution of my LCD display was too low and the display effect was not good. Later, I changed to use vertical lines to form a black area display, and the effect was a little better (see the figure below).
So far, this project has been basically completed. From the use situation, because the program uses the storage of 500 sets of data before calculation, there is an obvious lag phenomenon. At the beginning of use, it takes a few seconds to stabilize before gradually displaying normal data. In addition, if there is a little activity during the detection process, the data will be abnormal. The blood oxygen value fluctuates relatively little, but the maximum fluctuation of heart rate is even more than 200 times/second. In addition, the chip deadlock phenomenon occasionally occurs during use. Resetting the microcontroller is ineffective. It must be powered off and reloaded to restore to normal.
The next test plan is to add a Bluetooth module and develop an Android APP to send the detection data to the mobile phone for display, so as to make the heart rate waveform display more beautiful and achieve a better experience.
This is the STM32F103C8T6 file package I found on the Internet
MAX30102_uvision5_stm32f103c8.rar (2.69 MB, downloads: 159)


Latest reply

[attach]540455[/attach] Could you please help me check whether pins 5 and 6 of the max30102 chip need to be controlled by PWM when in use? Taobao says these two pins can be disconnected   Details Published on 2021-5-25 16:25
 
 

821

Posts

0

Resources
2
 
This is fun
 
 
 

931

Posts

3

Resources
3
 
Yes, it is fun. If there are elderly and frail patients at home, it can also play a certain monitoring role.
 
 
 

1

Posts

0

Resources
4
 
Can you open source the program? I recently bought this module and planned to play with it. The data of the transplanted Meixin program is always wrong.

Comments

The first floor has been open source. After downloading and unzipping, you can compile and run it. You can see the blood oxygen and heart rate data on the computer through the serial port debugging assistant.  Details Published on 2019-4-28 21:22
 
 
 

931

Posts

3

Resources
5
 
Pandaz_ posted on 2019-4-28 17:05 Can the OP open source the program? I recently bought this module and plan to play with it. The data of the transplanted Maxim program is always wrong
The 1st floor has been open sourced. You can compile and run it after downloading and unzipping. You can see the blood oxygen and heart rate data on the computer through the serial port debugging assistant.
 
 
 

9

Posts

0

Resources
6
 
hujj posted on 2019-4-28 21:22 The first floor has been open sourced. You can compile and run it after downloading and unzipping. You can see the blood oxygen and heart rate data on the computer through the serial port debugging assistant.

Can you open source the program you modified later? The program with LCD display is also working on this blood oximeter recently

Comments

Already uploaded.  Details Published on 2019-6-17 15:29
 
 
 

931

Posts

3

Resources
7
 

I was invited to package and upload the entire project file after my modification for your reference and optimization.

Nucleo_MAX30102.rar (5.55 MB, downloads: 121)

 
 
 

931

Posts

3

Resources
8
 
tangjch11 posted on 2019-6-17 15:11 Can you open source the program you modified later? The program with LCD display, I am also working on this blood oxygen meter recently

Already uploaded.

 
 
 

9

Posts

0

Resources
9
 
hujj posted on 2019-6-17 15:29 has been uploaded.

OP, great! I just came into contact with this fingertip blood oximeter recently, because I am preparing to do such a project, I wonder if you can add WeChat or QQ to contact me for advice! Sorry for disturbing me

 
 
 

9

Posts

0

Resources
10
 
This post was last edited by tangjch11 on 2019-6-22 11:44
hujj posted on 2019-6-17 15:29 and has been uploaded.

The detection method I am using now is the photoelectric detection method. The transmitting LED emits 660nm and 905nm red light and infrared light. A receiving tube is used to receive the transmittance. The receiving tube will output a PWM waveform with a duty cycle of 50% and different frequencies. I don’t know what this PWM waveform means, and how to convert this pulse width signal into a digital value, otherwise I can apply Maxim’s algorithm! !

微信图片_20190622114303.jpg (146.09 KB, downloads: 1)

发射管图片

发射管图片
 
 
 

9

Posts

0

Resources
11
 
hujj posted on 2019-6-17 15:29 has been uploaded.

I have many questions to ask! Q 906529016

 
 
 

931

Posts

3

Resources
12
 

I only know the fact, but not the reason. I did not make any changes to the downloaded program, only added the display function of LCD5110.

 
 
 

9

Posts

0

Resources
13
 
hujj posted on 2019-6-22 14:33 I only know the fact, but not the reason. I did not make any changes to the downloaded program, only added the display function of LCD5110.

Got it! Thanks for sharing! Also, does the heart rate bar on your LCD display update in real time based on that value? Or is it a fixed display?

Comments

It is based on the PWM value of the LED, which is calculated based on the heart rate data. This calculation is part of the original program.  Details Published on 2019-8-19 15:38
 
 
 

7

Posts

0

Resources
14
 

I use these algorithms, but the heart rate and blood oxygen data are always unstable. What's going on? Can anyone give me some advice? Thank you!

Comments

I used the downloaded program directly, without making any changes to the monitoring and calculation parts. From the results of the preliminary analysis of the code, the program takes the weighted average of the last 500 sets of measured data to get the result, removes the earliest part of the data next time, and then adds the newly obtained data to calculate the weighted average.  Details Published on 2019-8-19 15:44
 
 
 

931

Posts

3

Resources
15
 
tangjch11 posted on 2019-6-22 17:13 Got it! Thank you for sharing! In addition, is the heart rate bar displayed on your LCD updated in real time according to that value? Or is it fixed?

It is based on the PWM value of the LED, which is calculated based on the heart rate data. This calculation is part of the original program.

 
 
 

931

Posts

3

Resources
16
 
No! Effort published on 2019-8-19 15:06 I use these algorithms, but the heart rate and blood oxygen data are always unstable. What's going on? Which great god can give me some advice? Thank you!

I used the downloaded program directly, without making any changes to the monitoring and calculation parts. From the results of the preliminary analysis of the code, the program takes the weighted average of the last 500 sets of measured data to get the result, removes the earliest part of the data next time, and then adds the newly obtained data to calculate the weighted average, thus smoothing the fluctuation of the data.

 
 
 

7

Posts

0

Resources
17
 

Especially the blood oxygen level is always wrong.

 
 
 

121

Posts

0

Resources
18
 

I found a lot of answers online, but they are all wrong. Maybe the hardware needs to be paired with the source code.

Comments

I started to prepare to use it on the GD32E230 development board, but I couldn't drive I2C communication. Later, I found this code on Taobao that directly uses STM32AF103C8T6. I downloaded it, compiled it, and tested it once. I just added the LCD5110 display part to this code.  Details Published on 2019-9-25 15:08
 
 
 

931

Posts

3

Resources
19
 
qzc0927 posted on 2019-9-25 13:58 I found a lot of answers online, but they are all wrong. Maybe the hardware needs to be paired with the source code

I started to prepare to use it on the GD32E230 development board, but I couldn't drive I2C communication. Later, I found this code on Taobao that directly uses STM32AF103C8T6. I downloaded it, compiled it, and tested it once. I just added the LCD5110 display part to this code.

 
 
 

5

Posts

0

Resources
20
 

I would like to ask how to use AFE4400 to achieve these functions,

Comments

I'm sorry, I didn't succeed in the initial transplantation. The downloaded code is based on the STM32F103C8T6 chip. For this purpose, I bought a minimum system board and the download test passed once.  Details Published on 2019-11-15 22:59
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list