adafruit / adafruit/Adafruit_CircuitPython_seesaw

Sampling Rate for ADC is extremely low

Open
#78 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
68
Forks
37
PR merge metrics
No merged PRs in 30d

Description

As currently written, it appears you can only do about 93 SPS. It looks like if there is a shorter delay introduced on analog_read, it drastically increases the sampling rate and it seems to be running stable.

`
def analog_read(self, pin):
"""Read the value of an analog pin by number"""
buf = bytearray(2)
if pin not in self.pin_mapping.analog_pins:
raise ValueError("Invalid ADC pin")

self.read(
_ADC_BASE,
_ADC_CHANNEL_OFFSET + self.pin_mapping.analog_pins.index(pin),
buf,
.0001,
)
ret = struct.unpack(">H", buf)[0]
time.sleep(0.001)
return ret
`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the analog_read entry point shown in the issue and examine the delay after the ADC read. Measure the current sampling rate, then verify that a shorter delay remains stable and produces the expected improvement. The work is done when analog readings sample faster without instability.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.