separate sensor pots affecting each other

I have 6 touch-pot strips going into the 6 Arduino analog INs. I am sending 5 volts into the pots from a common buss, and the ground is also on a common buss. When I touch one of the sensors, it works as expected and changes the value in Max (in the range 0 - .99 in arduino-test.pat, the range is more like 0-1000 in Graph.pat). But it also changes the values of the other 5 inputs as well! It is not a direct one to one correlation, there seems to be a slight delay, and if I touch the other pots at the same time they get an appropriate value - it is only when the pots are "drifting" e.g. not being touched, that thy are affected by the other pots. I tried putting a .1 uF ceramic capacitor across the + and - of one of the pots to decouple it but this didn't seem to affect anything.I added a 1K resistor to the the main power to reduce overall voltage to 3V but this just reduces the output range of all the pots to about .6 maximum. Also, the pot values "drift" with no touch input - they do not go to zero when you stop touching them but "float" around .3.

NOTE these values are not voltages but the values displayed on the screen by arduino-test.pat.

Here is a video that shows what I'm talking about:

(PS I am using pduino pd_firmware.pde and maxuino arduino-test.pat combined with Graph.pat - in the video I multiply each value by 1000 to bring it up to an audible frequency)

*** Update: I just checked the voltages coming out of the sensors - there is no change in voltage from sensor 0 if I touch sensor 1. Sensor 1 sends 3V at it's highest point, meanwhile sensor 0 stays around 0.049. So I don't see why the values would change in Max. And once I let go the voltage drops back to 0.049. So why the behavior on the Arduino/Max end?


Sounds like stray electromagnetic pickup somewhere, or alternately the reference voltage that the A/D uses isn't stable enough. If the change is something like 10 or 20mv, you should probably just filter it out in software.

I can't tell what kind of pots those are from the video, but here are two things to try:

  • ground the cases of the pots if they are metal. Make sure this ground has a good connection to the Arduino ground.
  • add a .1uF capacitor between the ARef pin and ground. this is implemented in the new Diecimilia, but if I remember corectly it is not in the older designs. This helps to filter the reference voltage.

If these fail to help you could use an external reference supply... I think Paul badger has the info on how to do that, as he has implemented it in the Barebones Arduino. You have to change some processor commands to make it use the external reference.


I guess I’m confused by what units Max / Arduino is reading from the analog pins. The firmware I’m currently using (SimpleMessage System) sends the value of analogread() to Max, which displays a number between 0 and 1024 (0 at the bottom of the strip, 1024 at the top of the strip). This correlates to a voltage range coming out of the strip of 0-5 Volts.

The differences I read voltage-wise from the pots when they are apparently affecting each other are TINY by comparison, way down in the millivolt range. The biggest voltage change I’ve gotten to show up is 24 mV by touching adjacent pots. So why would these little millivolt changes way down at the bottom of the total range lead to such a large impact on the values shown in Max?

What units are being represented by the 0-1024 range in the Max patch? How would I get it to simply display the raw voltage number? Forgive me if the questions seem super-basic I’m just getting the hang of Max.

Here’s the Max patch:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P message 162 265 26 9109513 print;
#P number 303 467 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 260 467 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 217 467 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 176 467 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 133 467 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 90 467 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 2;
#P comment 159 76 237 9109513 Read analog inputs every 35 milliseconds (do not use a faster time with a baud rate of 9600).;
#P toggle 137 86 15 0;
#P window linecount 1;
#P newex 137 109 44 9109513 metro 35;
#P newex 137 426 79 9109513 unpack i i i i i i;
#P window linecount 2;
#P comment 202 169 100 9109513 Write pin 13 to HIGH(1) or LOW(0).;
#P window linecount 1;
#P newex 137 344 84 9109513 asciimessage2max;
#P newex 137 238 84 9109513 max2asciimessage;
#P toggle 187 174 15 0;
#P message 187 201 44 9109513 w d 13 \$1;
#P newex 137 399 34 9109513 route a;
#P message 137 141 19 9109513 r a;
#P toggle 32 209 15 0;
#P newex 32 182 44 9109513 loadbang;
#P newex 32 232 39 9109513 metro 1;
#P newex 137 286 116 9109513 serial COM4 115200 8 1 0;
#P window linecount 6;
#P comment 267 266 100 9109513 Set serial to the com port matching the Arduino Board on your system. To find that out \, send serial the print message.;
#B frgb 182 0 0;
#P window linecount 1;
#P comment 158 142 100 9109513 Read analog inputs.;
#P comment 25 41 342 9109513 For use with the Arduino SimpleMessageSystem example 1.;
#P comment 25 59 224 9109513 Version 1.1 of this patch.;
#P connect 15 5 24 0;
#P connect 15 4 23 0;
#P connect 15 3 22 0;
#P connect 11 0 10 0;
#P connect 15 2 21 0;
#P connect 9 0 15 0;
#P connect 13 0 9 0;
#P connect 4 0 13 0;
#P connect 25 0 4 0;
#P connect 5 0 4 0;
#P connect 12 0 4 0;
#P connect 10 0 12 0;
#P connect 8 0 12 0;
#P connect 16 0 8 0;
#P connect 17 0 16 0;
#P connect 15 1 20 0;
#P connect 15 0 19 0;
#P connect 7 0 5 0;
#P connect 6 0 7 0;
#P window clipboard copycount 26;

and here’s the firmware code that sends the values

    messageSendChar('a');  // Echo what is being read
    for (char i=0;i<6;i++) {
      messageSendInt(analogRead(i)); // Read pins 0 to 5
    messageEnd(); // Terminate the message being sent

24mv sounds pretty normal. I would write up a simple patch to send values constantly from the Arudino to the Arudino Serial monitor, then watch it while touching the pts but not moving them.

BTW, are those slide pots, or pressure-sensitive pots?


Pressure sensitive - no slider, just touch...

Okay, I wrote a super-straightforward program to just watch the values go by in the Serial monitor, and I still get the same behavior. The values range from 0 to 1023. When I touch one strip, all the other values, of the strips I don't touch, seem to "chase" the "real" value, getting very close to it, as if I were touching all of the strips at approximately the same point.

Note that these are powered pots, I send in 5V, and 0-5 V comes out depending on where on the strip I touch.

I still don't know where this 0-1023 value is coming from. I am sending 0-5 V into the analog pins, so where does it get 1023? Am I doing this wrong? Do the analog pins read voltages? A standard potentiometer uses variable resistance. Is this my problem? Do I need a different approach to compare voltages?


// Analog pin settings
int aIn = 0;    // Sensor center taps are connected to analog pins 0 - 5
int bIn = 1;    // 5V to each sensor and a common ground
int cIn = 2;  
int dIn = 3;
int eIn = 4;
int fIn = 5;

// Values
int aVal = 0;   // Variables to store the input from the sensors
int bVal = 0;  
int cVal = 0;  
int dVal = 0;
int eVal = 0;
int fVal = 0;

void setup()
  Serial.begin(9600);     // Open serial communication

void loop()
  aVal = analogRead(aIn);  // read input pins
  bVal = analogRead(bIn); 
  cVal = analogRead(cIn);  
  dVal = analogRead(dIn);
  eVal = analogRead(eIn);
  fVal = analogRead(fIn);

  Serial.print("A: ");     // ...then print the values.
  Serial.print("B: ");        
  Serial.print("C: ");                
  Serial.print("D: ");                
  Serial.print("E: ");                
  Serial.print("F: ");                

powered pots.. hmmmm... are these the strip-type pots with no moving parts, just a pressure strip? Do you have a link to the datasheet for those? there was a thread in the forum about those a while back. IIRC, they have a period of non-contact when they generate garbage values.


PS: 1023 is the default internal scaling applied to the analog values... is that what you mean by not being sure of where the 1023 comes from?

I read some more about Arduino and now I see that the analog voltage 0-5 gets converted to a value 0-1023 by the Arduino. Since the behavior is so odd and confusing - in my frustration I was thinking maybe I had it all wrong and sending different voltages to the analog pins was somehow the wrong approach.

Here's the datasheet for the softpots:

I'll reiterate that when I measure the voltages at the source, e.g. the output pins of the un-touched sensors, I get TINY variations, 2-24 mV changes, yet the values from the Arduino are ranging from 0-1024 as if I was touching all of the sensors at once. When I don't touch anything, all the values float around 300-400 (you can see this in the video). They start out where ever I last touched, then drift up or down back to to this "idle" level.

When reading the datasheet they seem to expect you to use a physical wiper, but the tests I did (with one sensor) seemed to work just fine with the finger. I thought the only problem I'd have to solve is the float/idle issue. But this ghost value issue is now the bigger problem as I can't even get close to the expected behavior from my prototype.

Why would Arduino send the value 1023 when there is only 24 mV coming out of the sensor? It just doesn't make any sense! I am going back to measure the voltages again because this must be a bad dream or something...

** update: Slight progress. This time I hooked my meter up to analog pin 5, and to the 2nd ground on the arduino (the 2nd one right next to 5V). Now that one value, Pin5, where the meter is hooked up, still chases the actual value coming out of sensor 0, but much less so. It tops out around 155 instead of hovering 900-1023 like the others. I could live with that if they all did it - treat 150 as my zero edge. So maybe it's getting a better ground because of the meter? Or because of the 2nd ground... I am going to rewire it to have a "star" ground configuration to see if it helps (all grounds wired directly to the same point instead of a common buss).

** update 2: star ground config did nothing.

** update 3: just for giggles, I reversed the polarity of sensor 0. Now the 1023 value shows when I touch the bottom of the strip, and 0 is at the top. What's interesting is the other pin values are still "chasing" the same way. When pin 0 is up around 1023, the value of pin 1-5 climb to a similar value - even though the sensor polarity is reversed. So this is making me think this is not a static or grounding issue but more something about the Arduino somehow "leaking" data between pins?

I wish I had an analog synthesizer so I could just send my voltages out to that and skip all of this interface crap and actually make something that sounds good. The Arduino is really frustrating me at this point. Why can't it just convert the separate control voltages to separate values?

** update 4: maybe I should be going into DIGITAL ins, not analog? I just read over on the Wiring site about hooking up an infrared ranger that sends voltages and they say to hook it to the digital pins ( That doesn't make sense to me intuitively but then again none of this is making sense right now. They also show a resistor in the circuit but no value.

hey you have everything correctly connected... I think it's those posts that are giving you the trouble. I am pretty sure those pots need constant contact ot give a reliable signal-- the datasheet shows them used with an external "wiper". As a test, I'll bet that if you replace one of the 'touch' pots with a regular rotary one all the problems will disappear. D

After a long drive in the country I'm a bit less frustrated. :)

"you have everything correctly connected..." - yeah, that's what I was thinking.

I think you're right that it's something unique to these pots - but they're fundamental to the design of my interface - so I must keep on trying. I think part of the problem might be that the ADC circuit is integrated into the Arduino, so I can't really condition the signals during the A to D conversion, so I have to think of a way to condition them before. There must be some noise or something being generated by the pots "floating" without constant contact with as you say an external wiper. Maybe I can add circuitry that will drag the voltages all the way to 0 unless a certain threshold is reached. Or only read the values briefly when a certain condition is detected, a way to differentiate a touch from a non-touch. The plan is to indicate the fader position with an led readout, and save this value between touches. I want the device to have no moving parts. I guess I'm saying I might need to do my own kind of A to D conversion, in a different way than the Arduino does it. If I were to take these analog voltages and directly drive an oscillator, I believe they would work as expected. Something about the A to D in the the Arduino is making this happen, I think.

I'm getting some ideas here:


I think it's more your potentiometers.... it seems they don't give a consistent signal. It would take some tricky conditioning to fix that.

The easier solution is to write some code that reads all the sensor values at once, but only uses the values if: - there is a sequential change on a particular pot, say ten units - the change happens within a specific amount of time, like 100 milliseconds

That should do the trick.


:) solved. Super-simple: I added a 10K resistor between the signal and ground on each touchpot and now the value in the serial monitor drops to 0 unless I touch the pot. And the values don't affect each other anymore. I think this is called a pull-down resistor. I guess this is basic electronics that most people would know but since I'm just figuring all this stuff out for myself...

nice solution... that is basic electronics yes, but a normal pot wouldn't require that, it would just work. Nice to see there is solution for these trouble-pots :)

beaut, I have been troubled by this soft pots I have been experimenting with.. :o :o [smiley=beer.gif]

I'm so glad the solution has helped someone else! These membrane sensors are really cool and getting cheaper all the time. Lots of potential applications.