Trying to optimise my analogRead for steadier Readings (7BIT)

Hi, I'm building a midi controller with a couple dozen 10k linear pots using 2 4067 multiplexers.

I'm currently using:


Although stability isn't not terrible, I'm still getting +/-1 oscillations when some of the pots are in mid travel. Unnoticeable during performance but I real pain when the knobs fight each-other when the computer is in "learn" mode.

Midi CC only requires 7BIT resolution so I'm wondering if there is a way to lower the ADC's resolution to 7BIT since I'm trashing the resolution anyway with the Map function.

Thanks in advance for any insight.

Sure, just throw away the lower 3 bits of the 10-bit reading:

value = analogRead(0) >> 3;

You’re kind of doing this anyways (inefficiently) using the map() function, so I doubt this will get rid of your +/-1 oscillation. Consider filtering, either median filtering or just averaging N readings.

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

Thanks RG!

I will try some averaging and see how it goes.

Congrats on the 707, fantastic work I have to say! Cheers!

check - - or - -