Sample rate

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Matr777
 
Posts: 5
Joined: Fri Aug 27, 2021 9:11 am

Sample rate

Post by Matr777 »

Hello,

I am having a problem with achieving sampling rate more than 40 s/s while using https://circuitpython.readthedocs.io/pr ... -rate-test, suggested acceleration data rate test for ICM20948 sensor.
Could you please provide me suggestions how to achieve expected results of 1000 s/s that is claimed to be possible?
Thank you for your support.

User avatar
adafruit_support_bill
 
Posts: 88089
Joined: Sat Feb 07, 2009 10:11 am

Re: Sample rate

Post by adafruit_support_bill »

The output data rate of the sensor is the rate at which it generates readings and updates its registers. That is independent of the frequency at which your code polls those registers. To speed up your poll rate, you can eliminate things like print and sleep statements inside your polling loop. The Python language also has significant overhead. Faster poll rates are likely possible using the Arduino IDE (C++).

User avatar
Matr777
 
Posts: 5
Joined: Fri Aug 27, 2021 9:11 am

Re: Sample rate

Post by Matr777 »

Hello,

thank you for your reply and suggestions and when I eliminate print and sleep I can see it is recording data as it should.
If you please can suggest me how to print and display sensors registers?

User avatar
adafruit_support_bill
 
Posts: 88089
Joined: Sat Feb 07, 2009 10:11 am

Re: Sample rate

Post by adafruit_support_bill »

That depends on the requirements of your application.

One approach is to collect data as fast as possible to an array and print that out later. That limits the number of samples to the available memory in the processor you are using.

Another way is to write the data to an SD card and print it out later. That will increase your logging capacity, but you will have some periodic delays for writing to the card.

And a third approach is to send the data via serial - but in binary format instead of ASCII. That will allow continuous monitoring - but will require some code on the other end to decode the binary data.

User avatar
Matr777
 
Posts: 5
Joined: Fri Aug 27, 2021 9:11 am

Re: Sample rate

Post by Matr777 »

Thank you a lot for your help!
Best regards :D

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”