computer-lov / Nighttime-Parenting-Device

This is a senior design project.
MIT License
0 stars 0 forks source link

Project Specific Tests: Heart Rate Sensor #42

Closed computer-lov closed 2 years ago

computer-lov commented 2 years ago
BeatrizPer commented 2 years ago

temperature test is written below

    def getTemp(self):
        # temperature read in integer and fraction, both added
        # to find total temp

        # Enabling the temperature reading
        i2c.write_byte_data(HR_ADDR, 0x21, 1) # TEMP_EN
        i2c.write_byte_data(HR_ADDR, 0x03, 1) #DIE_TEMP_RDY_EN

        # Address for temp int = 0x1F
        T_int = i2c.read_byte_data(HR_ADDR, 0x1F)
        # Address for temp frac = 0x20
        T_frac = i2c.read_byte_data(HR_ADDR, 0x20)

        temp = T_int + T_frac
        return temp
BeatrizPer commented 2 years ago

Reference #33 for tests, they are all project specific since they all have to do with setting up the sensor and finding the heart rate and SPO2 reading. Further investigation must be done to figure out if SPO2 will be beneficial to indicating stress levels

BeatrizPer commented 2 years ago

The testing code function (main.py) is responsible for calling the heart rate monitor and starting up the sensor to begin the readings. After cloning the repository, the following code is ran to execute the code on the board.

Screen Shot 2022-03-01 at 1 38 48 PM

The MAX30102 should turn on, ready to get its first reading. This is indicated by the red LED light on the finger pad sensor seen above. After the light has turned on, a finger can be placed right on the light as shown in the picture below.

Screen Shot 2022-03-01 at 1 39 12 PM

After the finger has been on the sensor for a few seconds, the terminal begins to print out BPM and SPO2 readings. The following figure below shows a few readings returned after I placed my finger on the sensor as explained above. Although these readings appear to be accurate, there were a few outliers that were returned that were ignored. With these readings, the MAX30102 Heart Rate Sensor has successfully been set up and works!

Screen Shot 2022-03-01 at 1 39 38 PM
BeatrizPer commented 2 years ago

finished and sent to done