Pulsating potentiometer

Hello guys!

I tried to use my potentiometer with arduino, but the voltage just keeps “pulsating”.
Could you help me?
Wiring is OK, just the voltage that going to the A0 pin is “pulsating”, that looks well on plotting.

Thank you!

What value is the pot? Does the average voltage change with pot adjustment?

Try a 0.1uF cap from the analog input to ground.

Post a photo of your wiring.
How to post images so we don’t have to download them and everyone can see them.
How to post an image.
Another page on posting images.

After reading the "How to use the forum" post, please post the code and a pencil sketch of your wiring, as it is probably not "OK".

Image posted properly (see image posting guide).

Thank you! The capacitor helped, now it's working!

groundFungus:
Try a 0.1uF cap from the analog input to ground.

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :slight_smile:

rupiman:
Hello guys!

I tried to use my potentiometer with arduino, but the voltage just keeps "pulsating".
Could you help me?
Wiring is OK, just the voltage that going to the A0 pin is "pulsating", that looks well on plotting.

Thank you!

That looks pretty well like an artifact due tou to your analog input polling frequency being close to the signal frequency.

Just try to put a short delay after the analog reading and look if the picture is changing dramatically.

There was a 5ms delay, the capacitor was the key :slight_smile:

My wiring is something like this:

My code:

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

void loop(){
    Serial.println(AnalogRead(A0));
    delay(5);
}

Hi,
Ops link


If you wired the pot like in the link, you would not have the signal to posted earlier.
Can you please post a picture of your project so we can see your component layout?

Thanks.. Tom.. :slight_smile:

Your wiring was picking up interference from the 50Hz or 60Hz frequency electrical mains supply..

With your 5ms delay you would only take 3 or 4 samples during one cycle of the sinewave interference.
However the serial plotter 'joins the dots' to produce the waveform that you saw.
The waveform that you recorded was not real, but an artifact of the low sampling rate - an effect known as aliasing.

Another way of getting rid of the problem would be twisting the three wires to the potentiometer together

rupiman:
There was a 5ms delay, the capacitor was the key :slight_smile:

Yes, I agree with that: 5ms is 200Hz sample rate, so I guess you have 50Hz mains and were picking that up, which a small
drift due to not being exactly 200Hz leading to the fading in and out.

This suggests you had poor screening and large potentiometer values, allowing significant pickup. Its wise
to use 10k or less for input potentiometers, and screened cable for the signals if the wires are any length.