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?
Can you tell me the range that readings are changing?
(For example: between 0-1023… And your readings are flickering between 400 and 402?)
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.
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,
Is there some type of hardware filtering which might help?
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.
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)?
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