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

analogRead not working on pins 37,38 (ESP32 Thing) #397

Closed
miguelgg opened this issue May 25, 2017 · 9 comments
Closed

analogRead not working on pins 37,38 (ESP32 Thing) #397

miguelgg opened this issue May 25, 2017 · 9 comments
Labels
Type: For reference Common questions & problems

Comments

@miguelgg
Copy link

Hi all

I'm trying to read pins 37 and 38 but always return 0. Other pins like 36, 39 are fully accesible.

Please, can you give some help?

Thanks in advance.

@miguelgg miguelgg changed the title analogRead not working on pins 27,28 (ESP32 Thing) analogRead not working on pins 37,38 (ESP32 Thing) May 25, 2017
@copercini
Copy link
Contributor

These pins connects some 270pF capacitors which determinate the gain of internal Low Noise Amplifier, I think most boards don't expose GPIO37 and 38 for this reason.

screenshot_1

Here you can see some details about it: https://espressif.com/sites/default/files/documentation/esp32_hardware_design_guidelines_en.pdf session 3.1.6

http://espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf 25.4 Low-Noise Amplifier

@copercini copercini added the Type: For reference Common questions & problems label Sep 22, 2017
@Akskaypohankar
Copy link

@miguelgg have you found any solution to read from this pins. I am facing the same issue.

@miguelgg
Copy link
Author

@Akskaypohankar nop, sorry, if you finally can find it, share please.

@Akskaypohankar
Copy link

i am currently reading about

esp_err_t adc1_config_channel_atten(adc1_channel_t channel, adc_atten_t atten)
on
https://esp-idf.readthedocs.io/en/v2.0/api/peripherals/adc.html

looks like something related let's see if it helps.
by the way, i found out that
gpio 37 and gpio 38 are not even declared as analog pin A1, A2 in esp32things

@Akskaypohankar
Copy link

@miguelgg I found some solution to this problem try this code it is working for me on both gpio 37 and 38.
//
#include <driver/adc.h>
void setup()
{ Serial.begin(115200);
adc1_config_width(ADC_WIDTH_12Bit);
adc1_config_channel_atten(ADC1_CHANNEL_1, ADC_ATTEN_6db);//channel_1 for GPIO37 and 2 for 38.
}
void loop() {
int value = adc1_get_voltage(ADC1_CHANNEL_1);
Serial.println(value);
delay(1000);
}

let me know if you try it.

@copercini
Copy link
Contributor

Fixed on #822 =)

@berniv
Copy link

berniv commented Mar 10, 2019

Hello, is it any update since 2017? I would like to read from a piezoresistive bridge sensor, such amplifier looks ideal for that (differential signal, low voltage around 50mV full scale, common mode near VCC/2).
I do not find any API ready to configure and read the ADC and LNA (Low Noise Amplifier).
I see that ESP WROOM32 has this amplifier hardware ready. (image below)
ScreenHunter 01

@pylorak
Copy link

pylorak commented Apr 8, 2020

Hello, is it any update since 2017? I would like to read from a piezoresistive bridge sensor, such amplifier looks ideal for that (differential signal, low voltage around 50mV full scale, common mode near VCC/2).
I do not find any API ready to configure and read the ADC and LNA (Low Noise Amplifier).
I see that ESP WROOM32 has this amplifier hardware ready. (image below)
ScreenHunter 01

For future readers: Descriptions of the LNA and built-in temperature sensor have been removed from the documentation and have become unsupported features. I know this was done to the temperature sensor because it was unusable in practice, and Espressif decided to remove the feature instead of fixing it in silicon. I can only guess the LNA suffered from a similar fate.

@berniv
Copy link

berniv commented Apr 9, 2020

Hi Pylorak, thanks for the update! Then the only way is using an external converter. Personnaly I added HX711, a good chip for low cost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: For reference Common questions & problems
Projects
None yet
Development

No branches or pull requests

5 participants