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

How to change the sample rate? #5

Closed
luizmanke opened this issue Mar 16, 2021 · 3 comments
Closed

How to change the sample rate? #5

luizmanke opened this issue Mar 16, 2021 · 3 comments

Comments

@luizmanke
Copy link

luizmanke commented Mar 16, 2021

Hi! Nice module!

I've been using the PPK2 and your python module to read the current from nRF52840.
Now I want to change the sample rate of PPK2.
How can I do it with your python module?

Here's an image of how it's done using the Power Profiler from nRF Connect v3.6.1 :

image

@NejcKle
Copy link
Collaborator

NejcKle commented Mar 17, 2021

Hi @luizmanke!

I'm glad to hear you've been using this module!
As far as we've discovered the sample rate cannot be changed and is set at 100k samples per second.
The setting in the nRF Connect App appears to be averaging in a window for prettier data display.

We've implemented something similar here:

def _average_samples(self, list, window_size):
"""Average samples based on window size"""
chunks = [list[val:val + window_size] for val in range(0, len(list), window_size)]
avgs = []
for chunk in chunks:
avgs.append(sum(chunk) / len(chunk))
return avgs

@wlgrd
Copy link
Collaborator

wlgrd commented Mar 17, 2021

As @NejcKle said, you cannot change the actual sample rate from the hardware, just do software averaging.

@SloMusti
Copy link
Member

SloMusti commented Apr 6, 2022

Closing this issue as there is nothing to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants