Hello,
I'm currently in a bit of a pickle regarding a batch of 60mm, 10k linear potentiometers that I received.
For this application, I have used some Bourns sliders in the past; however, there were some changes in the availability/manufacturing of those parts: the specific item skew is no longer made/stocked as of 2020 and what was recommended as an alternative(PTL60-15G1-103B2) has a small detent in the middle which prevents continuous, smooth travel over the length of the slider. Additionally, the operating force to move the slider is greater than the older model. Both Digikey and Mouser suggested I try an Alps alternative (RS6011SP6003), as the only thing I would be losing is the LED and the operating force is closer to the discontinued Bourns pot—not that big of a deal. I have a box of motorized Alps that I like, so I didnt think twice about the substitution.
Having gone through the shipment, I weeded out the lemons that were clearly DOA; however, after trying some on a few test boards, I keep having some weird-sporadic readings that I'm not sure are a reflection of the potentiometer quality or an indication that I also need some filtering before the ADC.
Typically, I have been able to get away with predominately handling all filtering via software, but right now, I will sometimes get random spikes from say, 240 up to 1023 for a split moment and then have it come back to 240. That, or it will skitter around +/- 20 when moving through certain zones before settling down to the current value the potentiometer. It isnt consistent, though. Sometimes restarting the whole circuit/Teensy alleviates the problem for awhile.
Usually, I have found this means something has damaged the potentiometer, but at this point I have had this behaviour across enough of the "not clearly dead pots" that means I either gotten really unlucky with my order from Mouser, or I'm just not accounting for the components that I received and their idiosyncrasies. That said, I have broken a few of these Alps faders by just putting the knobs on, so I'm also worried that these are just really delicate.
On the software side, I'm currently applying some hysteresis to a fader class that I made in a separate c++ file—nothing really else:
Same logic checks for if the value is not changing.
What other solutions are available for smoothing out and potentially dealing with noisy potentiometers, or am I dealing with problematic hardware?
Having gone through this and a few other forums, here are some things I have found but am not currently implementing:
1) Placing a .1uF ceramic capacitor on the analog pin to ground.
2) Making a RC Lowpass filter on the analog pin to ground
3) Apply an EMA to average the values in code.
While I understand 1 and 3, I'm not quite sure how to determine the correct Resistor and Capacitor combination values for 2. What frequency should I be aiming for, if this is the better option, and when given the ability to modify both Resistance and Capacitance values in that formula, which of the two should I favor? I have seen threads where some people prefer a larger value capacitor and smaller resistor and others that suggest to weight the resistance more than the capacitor.
Finally, in addition to utilizing either 1 and 2, would it still be advisable to do an EMA calculation pre or post hysteresis?
The biggest thing I am trying to avoid are the large, short lived spikes from relatively small values up to max, as this could blow out some equipment and synths on the other side.
I'm currently in a bit of a pickle regarding a batch of 60mm, 10k linear potentiometers that I received.
For this application, I have used some Bourns sliders in the past; however, there were some changes in the availability/manufacturing of those parts: the specific item skew is no longer made/stocked as of 2020 and what was recommended as an alternative(PTL60-15G1-103B2) has a small detent in the middle which prevents continuous, smooth travel over the length of the slider. Additionally, the operating force to move the slider is greater than the older model. Both Digikey and Mouser suggested I try an Alps alternative (RS6011SP6003), as the only thing I would be losing is the LED and the operating force is closer to the discontinued Bourns pot—not that big of a deal. I have a box of motorized Alps that I like, so I didnt think twice about the substitution.
Having gone through the shipment, I weeded out the lemons that were clearly DOA; however, after trying some on a few test boards, I keep having some weird-sporadic readings that I'm not sure are a reflection of the potentiometer quality or an indication that I also need some filtering before the ADC.
Typically, I have been able to get away with predominately handling all filtering via software, but right now, I will sometimes get random spikes from say, 240 up to 1023 for a split moment and then have it come back to 240. That, or it will skitter around +/- 20 when moving through certain zones before settling down to the current value the potentiometer. It isnt consistent, though. Sometimes restarting the whole circuit/Teensy alleviates the problem for awhile.
Usually, I have found this means something has damaged the potentiometer, but at this point I have had this behaviour across enough of the "not clearly dead pots" that means I either gotten really unlucky with my order from Mouser, or I'm just not accounting for the components that I received and their idiosyncrasies. That said, I have broken a few of these Alps faders by just putting the knobs on, so I'm also worried that these are just really delicate.
On the software side, I'm currently applying some hysteresis to a fader class that I made in a separate c++ file—nothing really else:
Code:
PotArray[i]->FaderRead();
if (PotArray[i]->currentPinRead > (PotArray[i]->hystPinRead + PotArray[i]->hystValue))
{
PotArray[i]->currentPinRead = PotArray[i]->hystPinRead;
//call decrease
if (PotArray[i]->pDecrease)
{
PotArray[i]->pDecrease(PotArray[i]->currentPinRead, PotArray[i]->IconstMidiChannel, PotArray[i]->IconstMidiCc);
}
}
else if (PotArray[i]->hystPinRead > (PotArray[i]->currentPinRead + PotArray[i]->hystValue))
{
PotArray[i]->currentPinRead = PotArray[i]->hystPinRead;
// call increase
if (PotArray[i]->pIncrease)
{
PotArray[i]->pIncrease(PotArray[i]->currentPinRead, PotArray[i]->IconstMidiChannel, PotArray[i]->IconstMidiCc);
}
}
Same logic checks for if the value is not changing.
What other solutions are available for smoothing out and potentially dealing with noisy potentiometers, or am I dealing with problematic hardware?
Having gone through this and a few other forums, here are some things I have found but am not currently implementing:
1) Placing a .1uF ceramic capacitor on the analog pin to ground.
2) Making a RC Lowpass filter on the analog pin to ground
3) Apply an EMA to average the values in code.
While I understand 1 and 3, I'm not quite sure how to determine the correct Resistor and Capacitor combination values for 2. What frequency should I be aiming for, if this is the better option, and when given the ability to modify both Resistance and Capacitance values in that formula, which of the two should I favor? I have seen threads where some people prefer a larger value capacitor and smaller resistor and others that suggest to weight the resistance more than the capacitor.
Finally, in addition to utilizing either 1 and 2, would it still be advisable to do an EMA calculation pre or post hysteresis?
The biggest thing I am trying to avoid are the large, short lived spikes from relatively small values up to max, as this could blow out some equipment and synths on the other side.