ADC only possible with Pins 32 - 39?

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
mnvk52
Posts: 13
Joined: Sat Sep 05, 2020 5:31 pm

ADC only possible with Pins 32 - 39?

Post by mnvk52 » Sun Sep 06, 2020 12:39 pm

Hi,
the manual says
On the ESP32, ADC functionality is available on Pins 32, 33, 34, 35, 36, 37, 38, and 39.
https://micropython-docs-esp32.readthed ... conversion

My device has more pins available for ADC: https://joy-it.net/files/files/Produkte ... 200320.pdf

How can I read pin 4? This way doesn't work:

Code: Select all

from machine import Pin, ADC
print(ADC(Pin(4)).read())

Code: Select all

%Run pin4read.py
Traceback (most recent call last):
  File "/home/pin4read.py", line 2, in <module>
ValueError: invalid Pin for ADC

rpr
Posts: 99
Joined: Sat Oct 27, 2018 5:17 pm

Re: ADC only possible with Pins 32 - 39?

Post by rpr » Sun Sep 06, 2020 5:06 pm

Those other pins are connected to ADC2 which is not currently supported. Part of the reason might be that ADC2 cannot be used when WiFi is active. In principle, it might be possible for someone to write/modify the micropython ADC driver to support the ADC2.

https://docs.espressif.com/projects/esp ... s/adc.html

User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: ADC only possible with Pins 32 - 39?

Post by rcolistete » Sun Sep 06, 2020 9:42 pm

See "MicroPython_ESP32_psRAM_LoBo" firmware, which supports ADC2.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

Post Reply