Slide potentiometer question.

Hello,

I have purchased a potentiometer in order to control some brushless motors and while I was working with it I have noticed some weird scenarios on my ESP8266.

After implementing a demo (just a analogRead on the specific pin) i Have noticed that my EPS8266 was reading only min and max value (0 and 1023).

Then I have switched to a ESP32, better results with values between 0 and 4095.. the only problem is that the value maxed out at around 60-70 percent of the potentiometer.

Then I have tried with Arduino UNO... flawless with values from 0 to 1023.

Can someone help me to understand why ? :confused:

I have used the same code every time (I have changed only the PIN value)

int POT_POIN = A0;

void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.print("Slide Pot value: ");
  Serial.println(analogRead(POT_POIN));
}

The "why" will remain unknown until you actually measure the resistance with a DVM or digital volt Ohm meter. Please give us the actual resistance values you are working with.
Paul

You dont say how you have the pot connected or what you are setting as a reference.

Then I have switched to a ESP32, better results with values between 0 and 4095.. the only problem is that the value maxed out at around 60-70 percent of the potentiometer.

Reading a voltage with the esp32 is not so straightforward as on the uno.

The defaults set the reference voltage at 1.1V so 0v = 0 and 1.1V = 4095

Your pot may not have a linear gradient track.

Breakout boards of the ESP32 may even have a voltage divider on the analog inputs... the ESP8266 boards have this! This may seriously mess up a pot reading.

The pinout of slide pots is not obvious and does vary between makes. Check with a multimeter,
do not guess.

Also do you have a linear or logarithmic taper pot? Linear is much better for use with microcontrollers,
but are rarer as slide-pots are mainly used for analog attenuation where a log-law is required.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.