K
K
Kalombyr2021-07-24 11:39:54
Electronics
Kalombyr, 2021-07-24 11:39:54

Why do ADCs in esp32 wroom have mutual guidance or how to read correctly?

Hello.
There is an ESP32 Wroom and 2 sensors that output a voltage of 0-3.3 V. I am trying to get a value from them using ADC:

#define SENSOR_ADC_PIN ADC1_CHANNEL_0 //-- ADC1 channel 0: GPIO 36
#define ENDSWITCH_ADC_PIN ADC1_CHANNEL_5 //-- ADC1 channel 5: GPIO 33
....
adc1_config_width(ADC_WIDTH_BIT_12);
adc1_config_channel_atten(SENSOR_ADC_PIN, ADC_ATTEN_DB_11);
adc1_config_channel_atten(ENDSWITCH_ADC_PIN, ADC_ATTEN_DB_11);
....
loop() {
   ...
   _sensorADCRAW = adc1_get_raw(SENSOR_ADC_PIN);
   _endSwitchADCRAW = adc1_get_raw(ENDSWITCH_ADC_PIN);
   ...
}
...


Initially, both values ​​are 0, but as soon as one of the sensors is triggered, the other value also increases, and significantly and stably.

The sensors themselves on each other, being connected to the same power line, do not affect each other in any way - I checked it with an oscilloscope. From this I conclude that I somehow use ADC incorrectly, but the code is taken from the manual ...

Tell me, please, what am I doing wrong and how is it right then?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question