Turning potentiometer crashes esp32

DJesusCry
Posts: 4
Joined: Wed Jul 21, 2021 7:50 am

Turning potentiometer crashes esp32

Postby DJesusCry » Fri Feb 24, 2023 10:52 am

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 1151 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 !
Attachments
image_2023-02-24_113421503.png
Potentiometer
image_2023-02-24_113421503.png (111.41 KiB) Viewed 1151 times

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: Turning potentiometer crashes esp32

Postby ESP_Sprite » Sat Feb 25, 2023 1:05 am

That does not look like a potentiometer (potentiometer specs mention resistance, not pulses). More likely it's a rotary encoder instead.

Who is online

Users browsing this forum: No registered users and 53 guests