Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Sample Rate #5

Open
batulaiko opened this issue Sep 10, 2020 · 1 comment
Open

Set Sample Rate #5

batulaiko opened this issue Sep 10, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@batulaiko
Copy link

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

@vrano714
Copy link
Owner

vrano714 commented Sep 17, 2020

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 vrano714 added the enhancement New feature or request label Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants