• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Potentiometer reading changing erratically.

Q&A Forum › Category: Arduino › Potentiometer reading changing erratically.
0 Vote Up Vote Down
Hersh Burston asked 9 years ago

I’m doing an analog read of a slider potentiometer across the 5V rail. The value in the serial monitor changes slightly even when the slider is not moved. How do I maintain a constant reading?

8 Answers
0 Vote Up Vote Down
Rui Santos Staff answered 9 years ago

Hi Hersh, 
Can you tell me the range that readings are changing?
(For example: between 0-1023… And your readings are flickering between 400 and 402?)

0 Vote Up Vote Down
Hersh Burston answered 9 years ago

Hi Rui,
I’m using blackLevelValue = map(blackLevel, 1020, 5, 0, 200);
I had to do it this way as I wired the pot wrong and it was easier to fix in software. I’m not using 1023 and 0 to give me some headroom.
As an example when my slider is midway blackLevelValue will fluctuate between 100 and 102.
Thanks for taking the time to look at this.

0 Vote Up Vote Down
Rui Santos Staff answered 9 years ago

Hi Hersh,
I was migrating the emails to another provider and I wasn’t notified with your answer, so I ended up missing your answer. I apologize for that.
You will always experience small fluctuations of one or two counts in analog readings.    That is partly because of the way the Analog to Digital converter works.
What it can help is having small wires with low impedance to reduce that value.
Thanks for your patience,
Rui 

0 Vote Up Vote Down
Hersh Burston answered 9 years ago

Thanks Rui.
Is there some type of hardware filtering which might help?
 
Regards,
Hersh

0 Vote Up Vote Down
jsnyder1 answered 6 years ago

Hi Rui,

Using your book ESP32 example and IO15 (DOIT 32 board won’t fit standard breadboard), I’m experiencing the same problem except the counts range by as much as 100 read to read. Using 2k pot across 3.3 volts. Tried different value pots with same result.

-Joe

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Hello Joe, are you using a sketch that just reads the analog value of GPIO 15? Or your sketch is connected to Wi-Fi (for example)?

0 Vote Up Vote Down
jsnyder1 answered 6 years ago

Hi Rui, a little basic trouble shooting solved the issue of a bad jumper wire in a bad breadboard (helped by the new Siglent 1202XE scope delivered this afternoon!)  Thanks again, Joe

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

I’m glad it’s working. Thanks for letting me know and thanks for the tip! Regards,
Rui

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.