An oximeter is a device that measures the amount of oxygen carried by the red blood cells. Blood oxygen level has a certain threshold limit for good health. If the level shots or depreciate the threshold, one might be caught by multiple diseases. Adults and infants are rarely short of oxygen, but oxygen depreciation is common in the older age group.
The traditional method of measuring blood oxygen level is by aerial blood gas (ABG) test. In this method, a sample of your blood is extracted from your body then placed in special equipment with rotates the blood at a fixed speed. ABG normally takes a few hours for the result declaration.
New techniques of oxygen test in the blood are under development and study. The most promising so far is pulse oximetry. It’s a noninvasive method in which light at a certain wavelength is passed through the human flesh. A photodiode is used to measure the amount of light which is digested by the blood. This method has an error ratio of 2 percent. One must ensure that the flesh has no color markings such as tattoos etc. because dark colors also absorb light.
Small scale and DIY oximeters are available in the market, interfaced with low-end controllers for DIY projects. SparkFun Electronics offers one such. It comes mounted on a small board. The user needs to place and press his finger on the sensor module to read from it. Communication with external controllers is done on the I2C protocol. I2c address for this sensor is set at 0x55 hex.
We will interface this module with Arduino nano. Arduino nano is 3.3 volt tolerant, and the above oximeter is also 3.3 volt tolerant. There are two more pins present on the sensor one reset, and another one is MFIO. The reset is active low and resets the module.
MFIO is an important pin. It puts the module in data acquisition mode. Actually, the module is composed of two IC’s. One is MAX3010, which is an actual oximeter and heart rate monitoring sensor. The second one is MAX32664, and it is responsible for converting the data received from the prior sensor. Hub is comprised of a cortex M4 microcontroller which receives data from MAX3010 apply conversion algorithm on it and outputs data to the external controller.
The circuit diagram of the project is above. I2c interface pins are present on A4 and A5 pins of Arduino nano. Digital pins 4 and 5 are of Arduino nano are used for reset and MFIO purposes. The sensor board is powered through the Arduino nano 3.3v power out pins.
Coming to the code part, I first imported the SparkFun sensor hub library. The library makes much of the things easier. With the library, we also need to download the wire library, which initializes the I2C interface.
Then I defined variables for Arduino pins. The pin’s names/numbers must be passed to the hub library to properly initialize HUB IC (MAX32664). Next, a variable named body of type biodata is declared. This variable talks with the sensor IC (MAX3010).
In the setup loop first, the serial monitor of Arduino begins at 115200 bps. Then the I2C pins are activated. Next, the Hub is begun, and its status is analyzed for any possible errors (result variable).
Now it’s time initialize the sensor. bioHub.configBPM() function is initializing the sensor module. A variable named MODE_ONE is passed in the function. I will discuss the variable later. After proper sensor initialization, it’s better to give it some rest for stabilization. A 4-second delay is inserted.
In the main loop, Data is read through the sensor module. The sensor passes data to the HUB, and HUB prepares data for the external controller. HUB prepares heart rate, oxygen level, confidence in data, etc. The external controller can put the reading request at any instance.
Mode one computes
Filed Under: Microcontroller Projects