max30102-tutorial-raspberrypi icon indicating copy to clipboard operation
max30102-tutorial-raspberrypi copied to clipboard

Set Sample Rate

Open batulaiko opened this issue 3 years ago • 1 comments

Hi, I just wondered about setting sample rate. In max30100.py lib there is an option to choose sample rate. In Max30102, how can we cchange the sample rate ratio?

Have a nice day.

Best Regards

batulaiko avatar Sep 10 '20 14:09 batulaiko

Hi, batulaiko.

In my max30102.py sample rate is set at line 110.

        # 0b 0010 0111
        # SPO2_ADC range = 4096nA, SPO2 sample rate = 100Hz, LED pulse-width = 411uS
        self.bus.write_i2c_block_data(self.address, REG_SPO2_CONFIG, [0x27]) # here!

Currently my code does not provide an option to change sample rate, however you can control the rate by changing the value in the line.

Here, 0x27 (= 0010 0111) determines ADC range, sample rate, and LED pulse width. Actually, it should be divided to 0 01 001 11 and 001 corresponds to 100Hz sample rate. (000 - 50Hz, 001 - 100Hz, 010 - 200Hz, 011 - 400Hz, 100 - 800Hz, 101 - 1000Hz, 110 - 1600Hz, 111 - 3200Hz; for additional information, please look for the data sheet as there are some limitations)

If one wants to use 200Hz sample rate, he/she has to set 0 01 010 11 = 0010 1011 = 0x2b instead of 0x27.

data sheet can be seen from: https://www.mouser.com/ProductDetail/Maxim-Integrated/MAX30102EFD%2bT?qs=nVS1qgv%252BQrkHA4%2FoFYriFA%3D%3D

vrano714 avatar Sep 17 '20 06:09 vrano714