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

not getting 1600sps in ads1015 #43

Closed
nayanagg opened this issue Oct 23, 2019 · 7 comments
Closed

not getting 1600sps in ads1015 #43

nayanagg opened this issue Oct 23, 2019 · 7 comments

Comments

@nayanagg
Copy link

nayanagg commented Oct 23, 2019

i want to get sampling rate 1600 sps from ads1015 using with pi 3A+ but only getting around 250hz data. help!!

@caternuson
Copy link
Contributor

Obtaining the fastest sampling rate may not be possible. See here for lots of details and discussion:
#27
The best this library supports is demonstrated in this example:
https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15/blob/master/examples/ads1x15_fast_read.py

@nayanagg
Copy link
Author

Screenshot 2019-10-24 at 00 34 43

After using fast_read.py regardless of what sample i'm giving the result is same.

@caternuson
Copy link
Contributor

The general issue is syncing with the conversion completion in continuous mode. There are two general ways this can be done:

  1. Query the status register for conversion complete
  2. Query the conversion complete pin, ideally tie this to an interrupt handler

Approach 2 is not viable since CircuitPython does not support interrupts. Approach 1 has the issue of slowing everything down since the query requires an I2C transaction. Checking this status bit is done for regular reads:
https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15/blob/master/adafruit_ads1x15/ads1x15.py#L166
but not in the special fast read mode:
https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15/blob/master/adafruit_ads1x15/ads1x15.py#L154

You'll have to deal with the conversion complete syncing somehow:
#27 (comment)
Note that the final approach that was taken is generally very simple and did not end up using the ALRT pin:
#27 (comment)

@ahmetuludag
Copy link

I followed links and there is great effort and insight, thank you @caternuson. In a project; I'm using ADS1115 and needed to have a stable 475 sample rate. As you already pointed out, fast_read example tries to read max and does not obey settings. There is also this library: https://pypi.org/project/RPi.GPIO/ and its comment says that for real-time performance don't use raspberry, arduino would be better.

So my question; is 475 sample rate in a stable manner (+-1 could be OK) possible on Raspberry Pi? (At least theoretically? Assume that I found a way to use interrupts)

@caternuson
Copy link
Contributor

Unknown. But worth trying. Would be interesting to see what you can work out.

@kattni
Copy link
Contributor

kattni commented Mar 30, 2020

@caternuson Is this resolved?

@caternuson
Copy link
Contributor

We can close for now.

Not really resolved, but I don't think there's any easy to do this with the current state of CP (i.e., no interrupts). The discussions in the threads linked above document where things are at.

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