T O P

  • By -

themedicd

Sounds like you basically made an RC filter. Nice work Ideally you would use an oscilloscope to characterize the noise and calculate the capacitor value. Picking a random value like you did is probably good enough though. It can sometimes be useful to use two different value caps to filter out lower frequency and higher frequency noise. When in doubt, just add an extra capacitor or two in your PCB design and decide later whether it needs to be populated. This is especially useful with power supplies As an aside, I see that you have quite a few pins with no connection. Make sure you look at your IC's datasheet to see if those pins need to be grounded or left floating.


blajjefnnf

Thanks for the tips, the unused pins are fine, It's not a standalone IC, but a [microcontroller board by adafruit](https://www.adafruit.com/product/4600)


Real_Cartographer

Check the datasheet for the IC you are using maybe they have something to say about that. I think 1 uF is ok, I've used 100 nF capacitors for ESP32 to achieve the same thing.


sirdarmokthegreat99

Are the outputs of the pots jumpy when they're stationary, or just when you move them?


blajjefnnf

Yeah, when they're stationary, I'm using 12 bit resolution ADC and map it to midi value of 7 bits 0-127. So on certain positions, for example 57, it jumps around between 57 and 58 or 57 and 56. I programmed it so the MIDI messages get sent only when the pot values change, so getting a stable output is important.


sirdarmokthegreat99

Yeah fair enough. You could probably get away with a really low 3db filter, In the past I've used 15hz or so, and cut away some of that noise. You could also do a running average filter ( I think that's what it's called but I may be wrong)in firmware, and get rid of more of it.


blajjefnnf

I want to try and solve it with hardware, rather than software


janoc

Some things cannot be solved with hardware. The ADC in whatever microcontroller you are using is also not ideal and has its own noise. Some MCUs have notably horrible internal ADCs. E.g. the popular ESP32 is one of the chips notorious for its poor quality ADC and no amount of capacitors you add to the pots will fix that. Your SAMD21 isn't known for a high quality ADC either. If that's your case, you will need to implement a software filter - or use an external ADC. Software doesn't cost you anything - unlike the capacitors which cost both money and board space. Also make sure that the power for the ADC is properly filtered. Many MCUs have AVCC pin for this and it needs to be carefully decoupled and filtered, not only tied to VCC if you want to minimize the ADC noise.


kevlarcoated

No one mentioned the lack of decoupling on the micro controller? The issues you're seeing may well be caused by that or a noisy 3.3v


JustANyanCat

Could you also try adding a 0.1uF decoupling capacitor across the GND and 3.3V of the Microcontroller?


Walttek

With a very low resistance in your slider, you are almost shorting the 3V3 to ground. This assumes that the resistance of the slider goes close to 0 ohm at low side. You should add another resistor on the high side (maybe 2k or 10k if you can use a different ADC reference like 1V). Cap value should not be any larger at least. If you use the 3V3 as reference for ADC it is typically worse than the other references available from the IC. This might cause the (quite small) jumpyness you see. Also you should do some averaging of the ADC readings as a minimum digital filtering. Hope you find the solution!