Skip to content

Wrong analogReadMilliVolts() in esp32s2 #4386

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

Closed
fabianoriccardi opened this issue Oct 4, 2020 · 2 comments
Closed

Wrong analogReadMilliVolts() in esp32s2 #4386

fabianoriccardi opened this issue Oct 4, 2020 · 2 comments
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@fabianoriccardi
Copy link

#4072 # Hardware:
Board: ESP32-S2 Saola
Core Installation version: esp32s2 branch lates commit
IDE name: Arduino IDE

Description:

Hi, I was trying ESP32-S2 Saola breakout board, I would read analog values. I had used a variable lab bench power supply to test the ADC, but function analogReadMilliVolts() gives values 60% higher than the right value: i.e. if I set 1V, analogReadMilliVolts returns 1.6V. This behavior is constant all over the range (from 0 to 2.5V).

I think that the problem is about the fixed 13bit width in esp32-s2 while in esp32 ranges between 9 and 12.

https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/peripherals/adc.html#_CPPv416adc_bits_width_t

Am I missing something?

Temporarily, I manage to use the following line to read input voltage:

int sensorValueRaw = analogRead(analogInPin);
int sensorValue = map(sensorValueRaw, 0, 8192, 0, 2600);

No other configuration were made to the ADC.

@stale
Copy link

stale bot commented Dec 4, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Dec 4, 2020
@stale
Copy link

stale bot commented Dec 19, 2020

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

No branches or pull requests

1 participant