Fastest Analog Midi Input possible?

Status
Not open for further replies.

nicnut

Well-known member
Hi,

I made a midi controller with a Teensy 3.6. It's pretty cool and it totally works. However, in able to play it like a real instrument I want it to read analog data as fast as possible.

I made a similar instrument with an Arduino Mega and I put a 4 millisecond delay in it, and it feels pretty fast.

In the code I am using for the Teensy, which I altered from the USB Midi Analong Control Change example, I think it is reading the analong inputs every 20 milliseconds and I can definitely feel the lag. It's reading after a certain amount of elapsed milliseconds, and I think that's 20 in my code currently.

My question is how small of an amount of milliseconds is a safe amount to read the analog data? I know the Teensy's speed is way faster than a Arduino Mega, so can I make it 2 milliseconds for example? Or can I do away with reading it after a certain amount of milliseconds entirely and let it go as fast as it can?

I have 13 analog inputs in this code and 17 digital inputs.

Thank You, Nick

Code:
  /* USB MIDI AnalogControlChange Example

   You must select MIDI from the "Tools > USB Type" menu
   http://www.pjrc.com/teensy/td_midi.html

   This example code is in the public domain.


*/

#include <Bounce.h>

// the MIDI channel number to send messages
const int channel = 1;

// the MIDI continuous controller for each analog input
const int controllerA0 = 1; //  control change 1, ribbon
const int controllerA1 = 2; //control change 2
const int controllerA2 = 3; //control change 3
const int controllerA3 = 4; // control change 4
const int controllerA4 = 5; // control change 5
const int controllerA5 = 6; // control change 6
const int controllerA6 = 7; // control change 7
const int controllerA7 = 8; // control change 8
const int controllerA8 = 9; // control change 9  last ribbon
const int controllerA9 = 10; // control change 10 joystick
const int controllerA10 = 11; // joystick
const int controllerA11 = 12; // control change 12
const int controllerA12 = 13; // control change 13  joystick

const int controllerD14 = 14; // toggle, control change 14
const int controllerD15 = 15; //  Button, control change 15
const int controllerD16 = 16; //
const int controllerD17 = 17;
const int controllerD18 = 18;  //
const int controllerD19 = 19;
const int controllerD20 = 20;
const int controllerD21 = 21;
const int controllerD22 = 22;
const int controllerD23 = 23;
const int controllerD24 = 24;
const int controllerD25 = 25;
const int controllerD26 = 26;
const int controllerD27 = 27;
const int controllerD28 = 28;
const int controllerD29 = 29;
const int controllerD30 = 30;

// Create Bounce objects for each button.  The Bounce object
// automatically deals with contact chatter or "bounce", and
// it makes detecting changes very simple.
Bounce button0 = Bounce(0, 5);
Bounce button1 = Bounce(1, 5);  // 5 = 5 ms debounce time
Bounce button2 = Bounce(2, 5);  // which is appropriate for good
Bounce button3 = Bounce(3, 5);  // quality mechanical pushbuttons
Bounce button4 = Bounce(4, 5);
Bounce button5 = Bounce(5, 5);  // if a button is too "sensitive"
Bounce button6 = Bounce(6, 5);  // to rapid touch, you can
Bounce button7 = Bounce(7, 5);  // increase this time.
Bounce button8 = Bounce(8, 5);
Bounce button9 = Bounce(9, 5);
Bounce button10 = Bounce(10, 5);
Bounce button11 = Bounce(11, 5);
Bounce button12 = Bounce(12, 5);  //
Bounce button24 = Bounce(24, 5);
Bounce button25 = Bounce(25, 5);
Bounce button26 = Bounce(26, 5);
Bounce button27 = Bounce(27, 5);

void setup() {

  // wire 3.3V to AREF for 3.3V reference
  analogReference(DEFAULT);

  pinMode(0, INPUT_PULLUP);   // for button swithces
  pinMode(1, INPUT_PULLUP);
  pinMode(2, INPUT_PULLUP);
  pinMode(3, INPUT_PULLUP);
  pinMode(4, INPUT_PULLUP);
  pinMode(5, INPUT_PULLUP);
  pinMode(6, INPUT_PULLUP);
  pinMode(7, INPUT_PULLUP);
  pinMode(8, INPUT_PULLUP);
  pinMode(9, INPUT_PULLUP);
  pinMode(10, INPUT_PULLUP);
  pinMode(11, INPUT_PULLUP);
  pinMode(12, INPUT_PULLUP);
  pinMode(24, INPUT_PULLUP);
  pinMode(25, INPUT_PULLUP);
  pinMode(26, INPUT_PULLUP);
  pinMode(27, INPUT_PULLUP);

}

// store previously sent values, to detect changes
int previousA0 = -1;
int previousA1 = -1;
int previousA2 = -1;
int previousA3 = -1;
int previousA4 = -1;
int previousA5 = -1;
int previousA6 = -1;
int previousA7 = -1;
int previousA8 = -1;
int previousA9 = -1;
int previousA10 = -1;
int previousA11 = -1;
int previousA12 = -1;


elapsedMillis msec = 0;



void loop() {

  {

    button0.update();    //  this button code works, goes from 0 to 127 when pressed
    button1.update();
    button2.update();
    button3.update();
    button4.update();
    button5.update();
    button6.update();
    button7.update();
    button8.update();
    button9.update();
    button10.update();
    button11.update();
    button12.update();
    button24.update();
    button25.update();
    button26.update();
    button27.update();



    if (button0.fallingEdge()) {                               // this deals with reading the button swithces
      usbMIDI.sendControlChange(controllerD14, 127, channel);
    }

    if (button0.risingEdge()) {
      usbMIDI.sendControlChange(controllerD14, 0, channel);
    }

    if (button1.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD15, 127, channel);
    }

    if (button1.risingEdge()) {
      usbMIDI.sendControlChange(controllerD15, 0, channel);
    }

    if (button2.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD16, 127, channel);
    }

    if (button2.risingEdge()) {
      usbMIDI.sendControlChange(controllerD16, 0, channel);
    }

    if (button3.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD17, 127, channel);
    }

    if (button3.risingEdge()) {
      usbMIDI.sendControlChange(controllerD17, 0, channel);
    }

    if (button4.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD18, 127, channel);
    }

    if (button4.risingEdge()) {
      usbMIDI.sendControlChange(controllerD18, 0, channel);
    }

    if (button5.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD19, 127, channel);
    }

    if (button5.risingEdge()) {
      usbMIDI.sendControlChange(controllerD19, 0, channel);
    }

    if (button6.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD20, 127, channel);
    }

    if (button6.risingEdge()) {
      usbMIDI.sendControlChange(controllerD20, 0, channel);
    }

    if (button7.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD21, 127, channel);
    }

    if (button7.risingEdge()) {
      usbMIDI.sendControlChange(controllerD21, 0, channel);
    }

    if (button8.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD22, 127, channel);
    }

    if (button8.risingEdge()) {
      usbMIDI.sendControlChange(controllerD22, 0, channel);
    }

    if (button9.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD23, 127, channel);
    }

    if (button9.risingEdge()) {
      usbMIDI.sendControlChange(controllerD23, 0, channel);
    }

    if (button10.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD24, 127, channel);
    }

    if (button10.risingEdge()) {
      usbMIDI.sendControlChange(controllerD24, 0, channel);
    }

    if (button11.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD25, 127, channel);
    }

    if (button11.risingEdge()) {
      usbMIDI.sendControlChange(controllerD25, 0, channel);
    }

    if (button12.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD26, 127, channel);
    }

    if (button12.risingEdge()) {
      usbMIDI.sendControlChange(controllerD26, 0, channel);
    }

    if (button24.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD27, 127, channel);
    }

    if (button24.risingEdge()) {
      usbMIDI.sendControlChange(controllerD27, 0, channel);
    }

    if (button25.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD28, 127, channel);
    }

    if (button25.risingEdge()) {
      usbMIDI.sendControlChange(controllerD28, 0, channel);
    }

    if (button26.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD29, 127, channel);
    }

    if (button26.risingEdge()) {
      usbMIDI.sendControlChange(controllerD29, 0, channel);
    }

    if (button27.fallingEdge()) {
      usbMIDI.sendControlChange(controllerD30, 127, channel);
    }

    if (button27.risingEdge()) {
      usbMIDI.sendControlChange(controllerD30, 0, channel);
    }


  }


  // only check the analog inputs 50 times per second,
  // to prevent a flood of MIDI messages
  if (msec >= 20) {               //
    msec = 0;

    int n0 = map(analogRead(A0), 0, 1023, 0, 127);
    int n1 = map(analogRead(A1), 0, 1023, 0, 127);
    int n2 = map(analogRead(A2), 0, 1023, 0, 127);
    int n3 = map(analogRead(A3), 0, 1023, 0, 127);
    int n4 = map(analogRead(A4), 0, 1023, 0, 127);
    int n5 = map(analogRead(A5), 0, 1023, 0, 127);
    int n6 = map(analogRead(A6), 0, 1023, 0, 127);
    int n7 = map(analogRead(A7), 0, 1023, 0, 127);
    int n8 = map(analogRead(A8), 0, 1023, 0, 127);
    int n9 = map(analogRead(A9), 0, 1023, 0, 127);
    int n10 = map(analogRead(A14), 0, 1023, 0, 127);
    int n11 = map(analogRead(A15), 0, 1023, 0, 127);
    int n12 = map(analogRead(A16), 0, 1023, 0, 127);


    // only transmit MIDI messages if analog input changed
    if (n0 != previousA0) {
      previousA0 = n0;
      if (n0 < 5) n0 = 0;
      usbMIDI.sendControlChange(controllerA0, n0, channel);
    }

    if (n1 != previousA1) {
      previousA1 = n1;
      if (n1 < 5) n1 = 0;
      usbMIDI.sendControlChange(controllerA1, n1, channel);
    }

    if (n2 != previousA2) {
      previousA2 = n2;
      if (n2 < 5) n2 = 0;
      usbMIDI.sendControlChange(controllerA2, n2, channel);

    }
    if (n3 != previousA3) {
      previousA3 = n3;
      if (n3 < 5) n3 = 0;
      usbMIDI.sendControlChange(controllerA3, n3, channel);
    }

    if (n4 != previousA4) {
      previousA4 = n4;
      if (n4 < 5) n4 = 0;
      usbMIDI.sendControlChange(controllerA4, n4, channel);

    }

    if (n5 != previousA5) {
      previousA5 = n5;
      if (n5 < 5) n5 = 0;
      usbMIDI.sendControlChange(controllerA5, n5, channel);

    }

    if (n6 != previousA6) {
      previousA6 = n6;
      if (n6 < 5) n6 = 0;
      usbMIDI.sendControlChange(controllerA6, n6, channel);

    }

    if (n7 != previousA7) {
      previousA7 = n7;
      if (n7 < 5) n7 = 0;
      usbMIDI.sendControlChange(controllerA7, n7, channel);

    }

    if (n8 != previousA8) {
      previousA8 = n8;
      if (n8 < 5) n8 = 0;
      usbMIDI.sendControlChange(controllerA8, n8, channel);
    }

    if (n9 != previousA9) {
      previousA9 = n9;
      if (n9 < 3) n9 = 0;
      usbMIDI.sendControlChange(controllerA9, n9, channel);
    }

    if (n10 != previousA10) {
      previousA10 = n10;
      if (n10 < 3) n10 = 0;
      usbMIDI.sendControlChange(controllerA10, n10, channel);
    }

    if (n11 != previousA11) {
      previousA11 = n11;
      if (n11 < 3) n11 = 0;
      usbMIDI.sendControlChange(controllerA11, n11, channel);
    }

    if (n12 != previousA12) {
      previousA12 = n12;
      if (n12 < 3) n12 = 0;
      usbMIDI.sendControlChange(controllerA12, n12, channel);
    }



  }

  // MIDI Controllers should discard incoming MIDI messages.
  // http://forum.pjrc.com/threads/24179-Teensy-3-Ableton-Analog-CC-causes-midi-crash
  while (usbMIDI.read()) {
    // ignore incoming messages
  }
}
 
Code:
// only check the analog inputs 50 times per second,
  // to prevent a flood of MIDI messages
  if (msec >= 20) {               //
This is the 'wrong' way to limit MIDI messages if you want responsiveness... at least with this high a value. Lowering it should give you a usable controller but may have a lot of noise messages.

The code already limits to new messages so the only real source of a 'flood' of messages would be from cases where the voltage is generating readings that map to different values because the raw reading is near a rounding boundary.

If you want to fix this code it's preferable to compare the raw value to a lagged value recorded last time the MIDI was updated and only update again if the raw reading is outside of some threshold from the previous (usually 8 as that's the same as the 3 bit reduction to MIDI anyway).

Search 'deadband' and there should be some examples.

Did you see my 'Pot's and Buttons' example code? It uses arrays for variables and ResponsiveAnalogRead() to tame analog signals instead of deadband and then limits to changed messages.

It's also here: https://forum.pjrc.com/threads/45376-Example-code-for-MIDI-controllers-with-Pots-and-Buttons
 
Oddson,

Thanks you for this reply. I looked at the code in the link. This is really great and I think I might be able to make this work.

I am trying to modify the code from your link to accommodate my setup. I have some sensors that are sending noise on the bottom end so I am filtering that out with this:

Code:
   // only transmit MIDI messages if analog input changed
    if (n0 != previousA0) {
      previousA0 = n0;
      if (n0 < 5) n0 = 0;
      usbMIDI.sendControlChange(controllerA0, n0, channel);
    }

Is there a way to incorporate that into your code? I think the modification would be in the void getAnalogData section.

tell me if you think this makes sense, I added one line to filter out values less than 5:

Code:
//************ANALOG SECTION**************
void getAnalogData() {
  for (int i = 0; i < A_PINS; i++) {
    // update the ResponsiveAnalogRead object every loop
    analog[i].update();
    // if the repsonsive value has change, print out 'changed'
    if (analog[i].hasChanged()) {
      data[i] = analog[i].getValue() >> 3;
      if (data[i] != dataLag[i]) {
        dataLag[i] = data[i];
        if  (data[i] < 5) data[i] = 0;   //   I added this line of code
        usbMIDI.sendControlChange(CCID[i], data[i], channel);
 
Sensor? Both my code and the other example assume you have a voltage divider. If it's anything other than pots as VD there is likely better code.

My code uses ResponsiveAnalogRead to remove noise and if it's not working with default settings you must have a lot of noise.

Are you intending to limit messages to those where the output is six or greater? Your code will just zero the value but still send the message.

Being a little more specific about what you're doing might help get you better advice.
 
Oddson, ok sorry for not being more precise.

I am using 9 membrane potentiometers, like this:

http://microcontrollershop.com/prod...MIh56QvYqS2gIVVQaGCh1BEQ-XEAQYAiABEgJMofD_BwE

and two potentiometer joysicks. I have a 10K resistor between the signal and the ground wire going to each sensor. I think that's what a voltage divider is, but I'm not sure.

I tried the code in the example you gave me and for whatever reason there was an even bigger lag in time. Interestingly however, I did not have to filter out any of the low readings and when I wasn't touching the sensor it was at 0.

I went back to my original code, which I realize is not great, but works, and I changed the millisecond updating to 3 milliseconds and it seems to work pretty well.

Maybe I can stick with what i have since it works but I would love to hear your thoughts and feedback.

thanks, Nick
 
Membrane pots are famous for the wiper 'floating' when there is no pressure.

Are you using a pull-down resistor to hold it near ground? If not then that might be your problem when they rest.

ResponsiveAnalogRead can be configured to some degree but to be honest I've not explored it as much as I intended.

I should look into it further since it might help with scratchy pots in expression pedals.
 
OK cool. Yeah, I am using a 10k Ohms resistor pull down resistor. With an Arduino mega that seemed to be fine to get a 0 reading when not being used, but I couldn't achieve that with a Teensy so I filtered out that noise in my code, and it works pretty good. I never really use the super low edge of those sensors anyway.

I guess maybe I'll stick with what I got. It's pretty fast and responsive now. I have a 3 millisecond delay, and from what i've found Midi has a one millisecond delay. It's really imperceptible delay as far as I'm concerned.
 
Hi,

So the code I was using before that appeared to be fine actually has some serious issues. Oddson you are right, it’s the “wrong” way to do this.

The code I’m using, which polls the state of each analog input every 3 milliseconds, is sending way too much MIDI data, and eventually messages from my other controllers, and the Teensy controller, get read very late and things get out of synch.

So I am revisiting this and I am attempting to implement the deadband technique.

I found some code from Oddson on this thread:

https://forum.pjrc.com/threads/50114-FSR-pedal?highlight=FSR,+deadband

And I am attempting to re-purpose it for my specific situation. Also please note that I am an extreme novice at coding.

In my situation I need to filter out MIDI values below 3 because my sensors ( in this case a potentiometer) fluctuate and have a little noise at the bottom.

Can someone take a look at this code and let me know if this looks OK? I haven’t tested it yet. But I would like to know if what I have makes any sense.

Thanks in advance,

Nick

Code:
// the MIDI channel number to send messages
const int channel = 2;
const int MIDIchannel = 2;   // this will only apply to midi channel 2

// the MIDI continuous controller for each analog input
const int controllerA0 = 1; //  control change 1,


void setup() {

  // wire 3.3V to AREF for 3.3V reference
  analogReference(DEFAULT);

}

void loop() {

  usbMIDI.read(MIDIchannel);



  int deadBandLimit = 8;

  int  rawZone0 = analogRead(A0);
  int  rawZoneLag0 = 0;
  int zone0 = 1;


  if (abs(rawZone0 - rawZoneLag0) > deadBandLimit) {
    zone0 = map(rawZone0, 0, 1023, 0, 127);


    if (zone0 < 3) zone0 = 0; // I need to filter out readings below 3 to get rid of noise

    usbMIDI.sendControlChange(controllerA0, zone0, channel);
    
    rawZoneLag0 = rawZone0;

  }

}

// MIDI Controllers should discard incoming MIDI messages.
// http://forum.pjrc.com/threads/24179-Teensy-3-Ableton-Analog-CC-causes-midi-crash
// while (usbMIDI.read()) {
// ignore incoming messages
//  }
 
...that code uses zones for a reason (selecting which MIDI ID to call) but I don't think it's appropriate for your purposes (but to be honest I've not read what you've done with it specifically nor have I refreshed my memory as to what you were trying to achieve here).

Is there a reason you're reluctant to use the code that relies on the ResponsiveAnalogRead (RAR) library?

Paul originally suggested someone write up example code for MIDI as it appeared to address the issue in a way that's not beyond noobs.

I figured I'd put one together and then go back to using my deadband code but in all honesty the library does a much better job in a much wider range of circumstances.

I think you would have to do a low-pass digital filter on the input and then deadband that result to get as good and as stable results as you get with the defaults with RAR.
 
Hi Oddson,

Thanks for your reply. If you do create some code for noobs that using the RAR library with potentiometers for USB MIDI I'd love to see it because that is exactly what I am trying to figure out.

To remind you of my situation, I am using 2 Teensies, with a variety of analog sensors: Potentiometers, FSR, Potentiometer Joysticks, Membrane Potetiometers. Right now I am polling the analog inputs every 3 milliseconds and I am getting too much midi data back, to the point where the midi data from other controllers I am using is getting delayed and it's slowing down my software ( Max 7). So I need to try something else.

I originally tried using the ResponsiveAnalogRead library, altering the example code you posted, and the readings I got back were really slow, making it unusable. I can maybe revisit that and see what was going on. But it wasn't working for me.

I am trying to work out this deadband technique, but it's not working out either. I am testing this out with 2 potentiometers, with a resistor between the signal and the ground. I am getting a lot of flickering when I look at my midi control inputs. I even tried making the deadband = 200, a huge margin, and I am still getting flickering. For example, the reading will be flickering back and forth from 37 to 38 constantly ( or any two adjacent numbers).

Maybe I am doing something wrong, because when I make the deadband = 1, I am getting back as much flickering as when it's 40.

I think doing the low-pass filter after the deadband is a little more stable. I tried it both ways and got less flickering doing the filter after the deadband.

Another strange thing I noticed with this code is that when the potentiometer is in it's lowest position sometimes it doesn't give a reading of 0. Sometimes it's 3, 7 or 12 or numbers in that range, and sometimes it's 0. Kind of weird.

I am going to keep messing around with this but if you have any other ideas to try please let me know.

Here's the latest version of what I am trying out with a deadband

Code:
// the MIDI channel number to send messages
const int channel = 2;
const int MIDIchannel = 2;   // this will only apply to midi channel 2

// the MIDI continuous controller for each analog input
const int controllerA0 = 1; //  control change 1,
const int controllerA1 = 2; //  control change 2,


void setup() {

  // wire 3.3V to AREF for 3.3V reference
  analogReference(DEFAULT);

}

void loop() {

  usbMIDI.read(MIDIchannel);



  int deadBandLimit = 40;

  int  rawAnalog0 = analogRead(A0);
  int  rawAnalog0Lag = 0;
  int analog0 = 1;


  if (abs(rawAnalog0 - rawAnalog0Lag) > deadBandLimit) {
    analog0 = map(rawAnalog0, 0, 1023, 0, 127);


    if (analog0 < 3) analog0 = 0; // I need to filter out readings below 3 to get rid of noise

    usbMIDI.sendControlChange(controllerA0, analog0, channel);
    
    rawAnalog0Lag = rawAnalog0;

  }


  int  rawAnalog1 = analogRead(A1);
  int  rawAnalog1Lag = 0;
  int analog1 = 1;


  if (abs(rawAnalog1 - rawAnalog1Lag) > deadBandLimit) {
    analog1 = map(rawAnalog1, 0, 1023, 0, 127);


    if (analog1 < 3) analog1 = 0; // I need to filter out readings below 3 to get rid of noise

    usbMIDI.sendControlChange(controllerA1, analog1, channel);
    
    rawAnalog1Lag = rawAnalog1;

  }


}

// MIDI Controllers should discard incoming MIDI messages.
// http://forum.pjrc.com/threads/24179-Teensy-3-Ableton-Analog-CC-causes-midi-crash
// while (usbMIDI.read()) {
// ignore incoming messages
//  }
 
To remind you of my situation, I am using 2 Teensies, with a variety of analog sensors: Potentiometers, FSR, Potentiometer Joysticks, Membrane Potetiometers.


Before you think of dead-end and filtering in software after the signal acquisition - Did you make sure with an oscilloscope that the analog signals are really clean before you sample these? No hum, no noise, no supply voltage stability problems, no grounding issues? Because if your analog signal is already dirty, the best software won't help.

All alarm bells rang when I read "Membrane potentiometers". I built a project around a 75cm linear membrane potentiometer, several years ago. Everything looked perfect - until someone's hand
approached only that membrane pot, even without touching it. Then, suddenly, a huge amount of 50Hz hum would be seen at the pot's wiper. Apparently there was some distant capacitive coupling involved and the pot acted as an antenna. To solve the issue, I had to a 1nF capacitor in parallel with a 100k resistor from the wiper to ground and to use self glueing copper foil between the also self glueing membrane pot and its support, and to connect that copper foil to GND, too.
 
Hi,

Theremingenieur thanks for your input. Actually in my experimenting and trouble shooting today I came across another post where you suggested someone put a small capacitor between the wiper and ground and I tried that with a regular potentiometer and it is working!!!! I am getting zero noise or flickering in my readings. I am using a .1uF ceramic cap because that's what I have handy. Also this zero noise situation is happening with the same code that was giving me tons of noise before and I am not doing any deadband-ing, just saying that if the values are the same not to update anything.

In that same post you suggested using 10k ohms potentiometers. I didn't realize they should be that low resistance. The ones I have are 250K Ohms. But with this capacitor in place I am getting no noise at all so maybe I will be fine.

The membrane potentiometers are giving me pretty solid, accurate readings. And if I am pressing on one I want it to send a lot of data so the MIDI input will reflect where I am touching it. If I am not touching it I want it to send a 0, which it is doing since I am filtering out values less than 5. I already installed them in my project, but if I can fit a capacitor in between the wiper and the ground maybe I'll do that too.

Anyway, thank you all for your input. I am going to but these little capacitors in between all the wipers and ground and hopefully this will solve my problems. I'll report back.
 
Also, one more thing. I am putting the capacitor as close to the potentiometer as possible (a friend told me this is the best way to avoid noise) between the wiper and ground, then I am putting a resistor between the wiper and ground. It seems to be working out.
 
Status
Not open for further replies.
Back
Top