Arduino Noise Filtering and Smoothing

 

 

 

 

http://forum.arduino.cc/index.php?topic=213708.0

Capacitors

i have 16 potentiometers (10k linear) connected to each of the inputs on a 4067 multiplexer.

i also have a 0.1uF polarized capacitor on each one, connected between the ground and the signal pin.

wired them , +5v parrallel, Gnd parralel each potentiometer output is wired directly to the 4067 channels (16 of them). the caps are soldered to the pot pins, ground pins to output pins. i am sure they are 0.1nF polarized, they say 0.1nF on the side and they have a negative side indicator printed on them. i ordered specifically for this as they were reccomended on a site i found (cant remember the site)

 

Resistors

http://www.instructables.com/id/Smooth-Potentiometer-Input/

You want to connect the capacitor between the read pin and ground.

The middle pot pin will be connected directly to the input pin, although you could increase the filtering effect by connecting via a resistor.

 


Code

potVal[17] = analogRead (Pot17);                             // Read the analogue pin

if (abs(potVal[17] – oldVal[17]) > (Threshold)) {             // Compare the reading to the last reading, if its changed by enough, then it will send a midi message.
Serial.write(MIDI_CHANNEL+176);                             // Midi channel, (leave this alone as its already defined)
Serial.write(16+page);                                            // change this for each pot, to send different cc numbers, values between 0-127 please!
Serial.write(potVal[17]/8);                                  // print the pot value (the division is done here rather than earlier, this allows more noise to be filtered by the threshold without affecting the output)
oldVal[17] = potVal[17];

 

https://www.arduino.cc/en/Tutorial/Smoothing

 

Tutorial: Potentiometers with Arduino and Filtering

 

http://damienclarke.me/code/posts/writing-a-better-noise-reducing-analogread

 

https://temboo.com/

 

Potentiometer Reading

 

[[code]]czo0NjM6XCJpbnQgb2xkVmFsdWUgPSAwOyANCnZvaWQgc2V0dXAoKSB7DQogLy8gaW5pdGlhbGl6ZSBzZXJpYWwgY29tbXVuaWNhdGl7WyYqJl19b24gYXQgOTYwMCBiaXRzIHBlciBzZWNvbmQ6DQogU2VyaWFsLmJlZ2luKDk2MDApOw0KIH0NCg0KIC8vIHRoZSBsb29wIHJvdXRpbntbJiomXX1lIHJ1bnMgb3ZlciBhbmQgb3ZlciBhZ2FpbiBmb3JldmVyOg0KIHZvaWQgbG9vcCgpIHsNCiAvLyByZWFkIHRoZSBpbnB1dCBvbiBhe1smKiZdfW5hbG9nIHBpbiAwOg0KIGludCBzZW5zb3JWYWx1ZSA9IGFuYWxvZ1JlYWQoQTApOw0KIC8vIHByaW50IG91dCB0aGUgdmFsdWUgeW97WyYqJl19dSByZWFkOg0KDQppZiAoc2Vuc29yVmFsdWUgICE9IG9sZFZhbHVlKXsNCiBTZXJpYWwucHJpbnRsbihzZW5zb3JWYWx1ZSk7DQogb3tbJiomXX1sZFZhbHVlID0gc2Vuc29yVmFsdWU7DQp9DQogZGVsYXkoMSk7ICAgICAgICAvLyBkZWxheSBpbiBiZXR3ZWVuIHJlYWRzIGZvciBze1smKiZdfXRhYmlsaXR5DQogfQ0KXCI7e1smKiZdfQ==[[/code]]

Leave a Reply