Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Potentiometer giving very uneven output signal
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Potentiometer giving very uneven output signal

by Kokodoko on Mon Jul 13, 2020 11:26 am

I have connected a potentiometer to my circuit playground, see the image.
I am reading the value of the A2 port using AnalogRead (in makecode with javascript)

This works! But there's something very uneven about the value that comes in on the A2 port:

- When turning the potentiometer from all the way left to all the way right, the first 75% of turning, the value on A2 only rises from 0 to 20
- Then, the last 25% of turning the knob, the value on A2 rises from 20 to 1000

What's going on here? I was expecting an even rise in value from 0 tot 1000. Why is there so little change for most of the potentiometer's range?
PS Both console.log, as the neopixel lights give the same feedback, so it's not a problem of the console or the usb connection.
I have tried different potentiometers, and I tried using VOUT instead of 3.3V. I even tried a different CPE board!

My code:

Code: Select all | TOGGLE FULL SIZE
let potentio = 0
forever(function () {
    potentio = pins.A2.analogRead()
    console.logValue("analog", potentio)
    light.clear()
    light.setPixelColor(Math.map(potentio, 0, 1024, 0, 9), 0xff00ff)
    pause(100)
})


Screenshot 2020-07-13 at 17.12.07.png
Screenshot 2020-07-13 at 17.12.07.png (197.19 KiB) Viewed 26 times

Kokodoko
 
Posts: 32
Joined: Sun Jul 27, 2014 8:50 am

Re: Potentiometer giving very uneven output signal

by adafruit_support_bill on Mon Jul 13, 2020 11:34 am

On most pots, the center pin is the wiper. Try swapping the black and yellow wires.

adafruit_support_bill
 
Posts: 78736
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.