measurement discrepancies when using multiple potentiometers?

Status
Not open for further replies.

colorado_hick

Well-known member
working on a synth build, I wanted to have the ability to quickly choose a different sound or a different octave so I decided I would get potentiometers that have 11 dentants (clicking points). That way I can switch between 11 different scenarios with just using one analog pin. It just took a little experimenting to get the analog read ranges right for the 11 different positions and then it worked great with the breadbox prototype. As you can probably predict I have one side going to the +, one side going to the -, and the middle wiper going to an analog pin. The + and - are in parallel on the same wire.

Now that I have soldered everything up and have to of them I am getting some unusual readings out of one of the pots. Yet when I disconnect everything and measure ohms at the different clicks it seems right on with the other one.

I am wondering is there some sort of voltage bleed that would impact the voltage measurements coming off the potentiometers when they were wired close together? It is almost like changing one potentiometer impacts the measurement on the other one which really confuses me. Do I need some diodes or something to keep voltage from leaking on to the ground when the pot is cranked down? Or should I just disconnect that side of the pot from the - and ground it to its self like I would on an audio pot in an electric guitar?

It is a simple circuit, with one 3.2v LED as a power-on light and 14 momentary contact switches for keys.

Here is my function that takes the analog pin as an input and returns a value 0-10 that I use as a switch:
Code:
int checkDentent(int readPin) {
  int dententPot1 = analogRead(readPin);
  Debugln(dententPot1);
//  Debug(readPin);
//  Debug(" ");
//  Debugln(dententPot1);
if (dententPot1  < 10 ) {
  return 10;
}
else if ( dententPot1 < 100 ) { //48
  return  9;
}
else if ( dententPot1 < 200 ) { //165
  return  8;
}
else if (dententPot1  < 310 ) { //285
  return  7;
}
else if (dententPot1  < 440 ) { //400
  return  6;
}
else if (dententPot1 < 580 ) { //512
  return 5;
}
else if (dententPot1  < 700 ) { //620
  return 4;
}
else if (dententPot1 < 800 ) { //735
   return 3;
}
else if  (dententPot1 < 910 ) { //859
  return 2;
}
else if ( dententPot1 < 1000 ) { //980
    return 1;
}
else  { //1023
    return 0;
}


}
 
I'd have thought that you maybe are seeing spikes/noise and these may be affecting the instantaneous voltage being measured at each detent.
You could try say reading the pins 3 times in succession and averaging the result to see if that resolves your issues, or alternatively ditch the analog approach and use rotary encoders (cheap ~1$ ones from Bournes) and use these to give you an incremental output to control your generator.
Paul has a library for decoding this type of switch and you could use 1 switch to control an almost infinite range of counts should you wish!
I might add that these types of rotary encoders are what are used in most commercial mixing desks,
Cheers
Ed
 
Status
Not open for further replies.
Back
Top