Go Down

Topic: Pulsating potentiometer (Read 592 times) previous topic - next topic

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!

groundFungus

#1
Sep 14, 2020, 08:50 pm Last Edit: Sep 14, 2020, 08:51 pm by groundFungus
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.

jremington

#2
Sep 14, 2020, 08:51 pm Last Edit: Sep 14, 2020, 08:53 pm by jremington
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).


rupiman

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

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



TomGeorge

#4
Sep 15, 2020, 12:47 pm Last Edit: Sep 15, 2020, 12:47 pm by TomGeorge
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... :)
Everything runs on smoke, let the smoke out, it stops running....

RIN67630

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.

rupiman

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

rupiman

My wiring is something like this:
https://www.aranacorp.com/en/using-a-potentiometer-with-arduino/

My code:
Code: [Select]

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

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

TomGeorge

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.. :)
Everything runs on smoke, let the smoke out, it stops running....

JohnLincoln

#9
Sep 16, 2020, 01:57 pm Last Edit: Sep 16, 2020, 02:00 pm by JohnLincoln
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

MarkT

There was a 5ms delay, the capacitor was the key :)
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.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

Go Up