Go Down

Topic: Potentiometer input smoothing (Read 13612 times) previous topic - next topic

simons

I know how to smooth analog values in code, but I'm working on an application that sends multiple midi signals from multiple inputs, and all the averaging seems to slow things down a bit. I've got a 10k pot that I seem to remember was always pretty solid, but lately I've noticed the input is shaky.  Like I said I can average to some degree, but I'd really like to learn how to solve some of these problems on the signal side if at all possible.

I've read about low-pass filters, I've tried wiring one like this, (forgive my schematic skills) : 5V ++== A == OUTPUT == B ==-- GROUND  (A= 1k resistor B= 0.1uF capacitor)

However I'm still getting shaky input values. Any advice on what to try?

Grumpy_Mike

Just wire the 0.1uF capacitor between the analogue input pin and ground and attach your 10K pot as normal.
If things are getting shaky then add some supply decoupling.
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html
I have never had to resort to averaging in software to get a solid reading off a 10K pot.

RuggedCircuits

It may not be your potentiometer but instead the supply voltage. Filtering a 10k potentiometer with yet more resistance and capacitance is good enough, but if you are doing other things electrically then your supply voltage could be bouncing enough (just a guess) to make things look "shaky" since the supply voltage is the analog reference voltage.

You can try switching to the AREF reference voltage instead and putting a capacitor between AREF and GND (0.1uF should be OK too).

The A/D converter, unfortunately, is going to be "shaky" no matter what. If you look at the datasheet they don't guarantee anything about how repeatable a measurement is and all performance parameters (linearity, gain error, etc.) are quoted as "typical" numbers only. It's just not a precision instrument.

--
Beat707: MIDI drum machine / sequencer / groove-box for Arduino

robtillaart

Quote
I know how to smooth analog values in code, but I'm working on an application that sends multiple midi signals from multiple inputs, and all the averaging seems to slow things down a bit.


Can you post your code, to see if forummembers can optimize it?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

MarkT

Quote
I've got a 10k pot that I seem to remember was always pretty solid, but lately I've noticed the input is shaky.


Have you considered the possibility that the tracks completely worn out on that pot?  One thing worth trying is spraying a _little_ WD40 into the pot and giving it a good waggle to and fro to displace any build up of dirt.  A better solution is replace it if its the only one causing problems.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

simons


Just wire the 0.1uF capacitor between the analogue input pin and ground and attach your 10K pot as normal.
If things are getting shaky then add some supply decoupling.
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html
I have never had to resort to averaging in software to get a solid reading off a 10K pot.


Wow, thanks, I've been struggling with this for ages. The addition of the second 47uF cap across the supply was the trick!! Had no idea it was that simple, or that two caps could be working at different frequencies like that. Flat, stable values now.

henning334

I've attached a wiring diagram. Which one gives me smooth potmeter readings?

A or B?

GO!

Just wire the 0.1uF capacitor between the analogue input pin and ground and attach your 10K pot as normal.
If things are getting shaky then add some supply decoupling.
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html
I have never had to resort to averaging in software to get a solid reading off a 10K pot.
I'm having a similar problem as the OP. I am going to try this, but which direction does the capacitor go? (polarized electrolytic)

Go Up