Page 1 of 1

Turning potentiometer crashes esp32

Posted: Fri Feb 24, 2023 10:52 am
by DJesusCry
Hello there !

I'm trying to use a potentiometer STEC12E07 but each time I turn it, my Esp32 crashes.
I did not find a pin layout for this potentiometer but it's my understanding that the middle pin should be connected to my esp's analog input and that it should not matter which of the outer pins is connected to GDN or 3v3 / 5v.
image_2023-02-24_112535142.png
Wiring ESP32-PICO-Kit V4
image_2023-02-24_112535142.png (567.9 KiB) Viewed 1155 times
I tried every combinations and did not manage to make it work, the only difference was that the default value was either 0 or 4095 but it still crashes when turning. I tried turning it without reading the value in the code but it crashes anyway so i'm guessing it has to do with my wiring/hardware (which is were my knowledge ends ahah)

Does someone know what I could be doing wrong ?

Below is how I set up my pin
  1. adc1_config_width(ADC_WIDTH_BIT_12);
  2. adc1_config_channel_atten(ADC1_CHANNEL_1, ADC_ATTEN_11db);  //  ADC1_CHANNEL_1 (on pin 37)
  3. adc1_get_raw(ADC1_CHANNEL_1);  // Reads value as intended
.
Thanks !

Re: Turning potentiometer crashes esp32

Posted: Sat Feb 25, 2023 1:05 am
by ESP_Sprite
That does not look like a potentiometer (potentiometer specs mention resistance, not pulses). More likely it's a rotary encoder instead.