Potentiometer overshoot

Posted on
  • Hello, im feeling retarded.. but when reading potentiometer(Joystick) values with the code;

    setInterval(() => {
       console.log(analogRead(D7);
    }, 50);
    

    It idles at 0.65 ish.
    So when moving forward the remote goes quickly to ~1 and the overshoots and start going back. So when full throttle its at 0.76.

    It doesnt really matter which potentiometer i plug in they all give me some kind of going over max value and back behavior.

    Thanks,
    Gustav

  • First, can you check the voltage with a multimeter? Just measure the voltage between gnd and the pin you are reading as you move the joystick? Just to be sure it's not a faulty potentiometer / wiring.

  • I imagine you're using ESP8266 based on your other posts?

    The ESP8266 ADC only has a voltage input range of 0 to 1v as far as I know, so yes - you'll only be able to read the first 1/3 or so of the potentiometer range if you connect it direct - you need to add another resistor between the pot and 3.3v to act as a potential divider and bring the voltage down.

    If you don't want to do that then all the official Espruino boards have a full 3.3v range ADC.

  • Alright, what values should i be expecting ? will test this when i get home.
    Thanks
    /G

  • Sorry for not naming the board, I use the Official MDBT42Q board

  • The second pin says "5v", but if you use it with a 3.3v micro, like the MDBT42, you should connect the "5V" pin to 3.3V!
    I have something like yours, in center position it is about half of the input voltage (but not exactly, and not the same on X any Y axis...). As you move the joystick, the voltage should go between 0 and 3.3V. Mine goes to 0 and full voltage waaay before reaching the actual endpoints...

  • Alright, so its output is calibrated on 5v ? and because it reaches 3.3v rather quick, thats a 100% for the microcontroller ?
    Now the joystick is connected to Vin which is 4.2, but you mean that it will work if i connect it to 3.3v on microcontroller ?

  • Ahh, thanks!

    As @AkosLukacs says, the MDBT42Q has 3.3v inputs, so you just need to connect the line that says 5v on your joystick to the 3.3v pin on the MDBT42Q.

    There's nothing 'smart' on the Joystick board - it really is just potentiometers so will work just fine off whatever voltage you supply.

  • Awesome thank you both ! It works like a charm.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Potentiometer overshoot

Posted by Avatar for Gustav @Gustav

Actions