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 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 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
|