Arduino Forum

Forum 2005-2010 (read only) => Hardware => Interfacing => Topic started by: Penpusher on Feb 16, 2009, 10:53 am

Title: Receive data from linear potentiometer?
Post by: Penpusher on Feb 16, 2009, 10:53 am
Hi. I'm a novice at this, trying stuff for the first time. I want to connect a set of (maybe 6?) 'softpot' linear potentiometers to an Arduino Duemilanove, via a breadboard, & then use the outputs to drive midi patches in Max.

Any ideas out there how to connect it up & get it going? I'm using MaxMSP 5 on Mac 10.4.

thanks  :)
Title: Re: Receive data from linear potentiometer?
Post by: MikMo on Feb 16, 2009, 12:29 pm
Could you explain "softpot" a little more ?

it's easy to connect 6 ordinary potentiometers to Arduino, they shold just be hooked up to the analog inputs as voltage dividers. One side to ground center to analog pin, other side to +5V.

Then use AnalogRead(pin number here) to read the pot, it will return a value between 0  (0V) and 1023 (5V)

Title: Re: Receive data from linear potentiometer?
Post by: Penpusher on Feb 18, 2009, 09:46 am
Hi, thanks for the reply.

A softpot is a thin metallic strip encased in flexible clear plastic. The ones I have are about 25cm by 2 cm. They have 3 terminals at one end: centre and right connected to the top of the strip (right terminal is marked with an arrow pointing out), and left running down the side and connected to the bottom end of the strip.

The idea is, when you run your finger along the strip, it will send a variable resistance message, thus functioning like a mixer fader.

They're a bit expensive, which is why I'm being a bit cautious. Which pins of the Arduino to connect to? And should I add in a resistor somewhere? Any help much appreciated. :)
Title: Re: Receive data from linear potentiometer?
Post by: Grumpy_Mike on Feb 18, 2009, 09:49 am
Centre to an analogue input pin, and the ends to the +5V and ground.
There is no need for anything else to get you going.

However, you might like to consider what happens (what do you want to happen?) when you are not pressing on the pot. There will be no connection to the analogue input pin and so you will get readings that fluctuate all over the place when nothing is being pressed.
Title: Re: Receive data from linear potentiometer?
Post by: edsonedge on Feb 10, 2010, 04:56 pm
Hi

I bought 10 circular sofpots and have already burnt up two of them by connecting like is described here  -   centre to analog input pin, left (with triangle above) connects to 5v and right goes to ground.

I have also tried putting resistors (5-100 ohm) before the 5v go to the softpot but I always get a bad reading out of it  (only about 1/4 of the softpots gives out a reading)

If i put a resistor that is lower than 10 ohm, the sofpots overheats and starts burning/smoking.

I think this is really wierd since I was under the impression that you couldnt burn up these sofpots with 5v

If anyone can spot a solution it would be much appriciated

;)
Title: Re: Receive data from linear potentiometer?
Post by: Grumpy_Mike on Feb 10, 2010, 05:15 pm
It sounds like you are not connecting the wiper to the analogue input but to one of the rails. Then when you are at one end you have the whole supply across a very small resistor and you are drawing a lot of current. Check again the data sheet and make sure both ends of the pot are connected across the supply not the wiper.
Title: Re: Receive data from linear potentiometer?
Post by: edsonedge on Feb 10, 2010, 05:26 pm
Hi Mike and thanks for the quick reply

I connect the middle (wiper) to analog input 1.  am very sure of this.

when you say rails you mean either 5v input or ground ouput; right?
Title: Re: Receive data from linear potentiometer?
Post by: Grumpy_Mike on Feb 10, 2010, 05:41 pm
Yes - The middle wire in a pot (wiper) might not physically be in the middle. Please check the data sheet of the pot you are using.
Title: Re: Receive data from linear potentiometer?
Post by: sylvie369 on Feb 10, 2010, 05:46 pm
You can check your pins most easily by connecting the ones that you think are the power pins to a 5V supply and GND, and then connect the other one to a voltmeter. The voltage should change as you adjust the pot (or in this case, move your finger along it). If not, you've got the wrong pins. Change them and try again.

Do make certain (with the voltmeter) that you've really got 5V between the two leads of your power supply first.

Title: Re: Receive data from linear potentiometer?
Post by: cr0sh on Feb 10, 2010, 06:23 pm
You might try using that voltmeter (eh, multimeter) to connect up to the softpot with a resistance reading setting higher than the spec of the softpot. Two of the lines should give you an open reading (infinite resistance), two should give you the reading of the max value of the softpot. With those readings, you should be able to figure out which leads are for what (ie, which is wiper and which are for voltage/ground) without burning it up.

Now, as for what to do about keeping it from burning up - there should be some clues in the spec sheet; usually a resistor of a certain size is needed (as mentioned by someone) - but I would think the "output" would be after that resistor, with the wiper of the softpot connected to ground as well. So you would always measure the value of the extra resistor at minimum on the output.

Thinking something like (sorry for bad ascii art!):

[font=Courier]        100 ohm                 Softpot
5V ----/\/\/\----+-----/\/\/\/\/\/\/\/\/\/\------ GND
                 |                 ^
                 |                 |
                 |                 +------------- GND
                 |
             Output to Arduino[/font]
Title: Re: Receive data from linear potentiometer?
Post by: edsonedge on Feb 10, 2010, 06:51 pm
thanks for the reply´s guys


one question:  should it matter if I connect 5v to what should be connected to ground and connect ground to what should be connected to 5v  ???

Shouldnt that just reverse the pot?

Best regards
Title: Re: Receive data from linear potentiometer?
Post by: cr0sh on Feb 10, 2010, 08:28 pm
On my example above, I am kinda intending the "100 ohm" resistor to be a current limiting resistor on the pot (if they are so fragile as to burn up under a low-current 5V source); reversing the connections (so that the 5V and grounds were swapped) would defeat that and probably burn the potentiometer out...?
Title: Re: Receive data from linear potentiometer?
Post by: frostin on Feb 11, 2010, 01:45 am
Right pin 5v middle analog pin left pin ground usually... Usually...
Title: Re: Receive data from linear potentiometer?
Post by: Photo-Worx on Feb 11, 2010, 07:48 am
Would this by any chance be what you are using?
http://www.sparkfun.com/commerce/product_info.php?products_id=8607

If so, the data sheet is right here.
http://www.sparkfun.com/datasheets/Sensors/Flex/SoftPot-Datasheet.pdf
Title: Re: Receive data from linear potentiometer?
Post by: Grumpy_Mike on Feb 11, 2010, 10:00 am
cr0sh you said:-
Quote
reversing the connections (so that the 5V and grounds were swapped) would defeat that


I can't see how that is. Current has to flow from the power terminals through the pot to the other power terminal. To my mind it makes no difference where the protection resistor is, it will still limit the current. The arduino input is high impedance so that doesn't affect things.
Can you explain where I am thinking wrong?
Title: Re: Receive data from linear potentiometer?
Post by: edsonedge on Feb 11, 2010, 01:21 pm
This is the data sheet

http://media.digikey.com/pdf/Data%20Sheets/Spectra%20Symbol/TSP%20Series%20ThinPot.pdf

I bought the circular sensor

-Resistance - Standard: 10k Ohms
Title: Re: Receive data from linear potentiometer?
Post by: edsonedge on Feb 11, 2010, 03:34 pm
Hi Richard and thank for the reply

like you said "Connecting 5V to the top and bottom of a 10K pot should never burn it out"

This is why I just cant understand why this happens - If you look at the last page of the datasheet you see

Electrical Schematic

PIN 3 (GND)  (LEFT BUS BAR)
PIN 2            (COLLECTOR)  or wiper
PIN 1 (V+)    (RIGHT BUS BAR)


This is exactly how I plug it ( I have also tried plugging it with the V+ and GND reversed (but that gives the same result - only in reverse; that is, only 1/4 of the sensors gives out any reading if I put 5v trough a 20-50 ohm resistors and If I dont have the resistor it overheats and eventually burns.)

P.s  when the sensor starts burning; small burning holes start burning up and getting bigger at the end of the circle on each side (that is on the touch surface; right before electricity comes from or goes to the pins)





Title: Re: Receive data from linear potentiometer?
Post by: edsonedge on Feb 11, 2010, 04:04 pm
No. I have never plugged V to the midle (collector)

I might have touched it but I cant remember the pot burning up straight after I did so - It burns up after having been connected for about a minute and half  if plugged pin 1 straigt to 5v and pin 3 to ground

what I meant is that I have tried routing V through low ohm resistors 20 to 50 ohm, and that keeps the pot from burning or overheating, but I get a wrong reading from the sensor

When I  connect the positive and negative leads of an ohmmeter to pin 1 and middle pin of the SoftPot  I get an accurate reading from the softpot  (that is 0 to 10 k if I remember correctly)
Title: Re: Receive data from linear potentiometer?
Post by: Grumpy_Mike on Feb 11, 2010, 08:30 pm
Quote
When I  connect the positive and negative leads of an ohmmeter to pin 1 and middle pin of the SoftPot  I get an accurate reading from the softpot  (that is 0 to 10 k if I remember correctly)


No you should get 10K if you connect the two ends. If you connect pin 1 and the middle then you will get a varying resistance depending on whee you touch the pot.

There is no way you can get what you are saying if the data sheet is correct. So you have either misinterpreted what you are doing, the device is faulty or the data sheet that is posted doesn't match your device.
Title: Re: Receive data from linear potentiometer?
Post by: borref on Feb 11, 2010, 09:16 pm
I noticed that the datasheet specifies recommended operating power as 0.5W (under electrical specifications). For a 10k "pot" you would then need to supply about 7mA at 70V. For 5V this would be 100mA which may indeed burn the sensor if it expects 7mA only.

All in all I think the datasheet is at best unclear (why label plus and ground on a pot - they should be interchangeable for pure resistive loads). Perhaps you need to give the supplier a call to find out what the real interface requirements are.

Title: Re: Receive data from linear potentiometer?
Post by: Grumpy_Mike on Feb 11, 2010, 10:45 pm
Quote
For 5V this would be 100mA which may indeed burn the sensor if it expects 7mA only.


No power doesn't work like that, it is the product of voltage and current.
Power = Voltage X Current

so at the current at 5V would need to be:-
Current = Power / Voltage = 0.5 / 5 = 100mA so that means 100mA is OK
BUT if you connect 5V across 10K the current flowing is 0.5mA which is a long way from 100mA

Anyway the data sheet says 1W not 0.5W so it is even less of an issue.
Title: Re: Receive data from linear potentiometer?
Post by: borref on Feb 11, 2010, 11:31 pm
Maybe I was unclear Mike, but my point is that "current" is killing the sensor - not power. Given 0.5W then at 70V - current would be as low as 7mA - at 5V it would be 100mA. The product (I*V) and so the power (0.5W) is the same.

0.5W is not listed as a maximum, but a recomended level - why would they do that? With a supply voltage of 5V, power would be as low as 2.5mW for a 10k resistor. Something is "fishy" and I'm suggesting it's not a true "pot" (resistance is not 10k unless it sees 0.5W) and perhaps requirement calls for a much higher voltage.
Title: Re: Receive data from linear potentiometer?
Post by: borref on Feb 12, 2010, 06:29 am
I don't think there's anything wrong with my math Richard.

You wrote:
Quote
Assuming that the softpot is 10K as advertised, putting 5V across it will result in 0.0005 amps (0.5 mA) which equals 0.0025 watts (2.5 mW)

I wrote:
Quote
With a supply voltage of 5V, power would be as low as 2.5mW for a 10k resistor


If you want to expose a 10k resistor to 0.5W you will need to feed it with just above 70V. Current is then about 7mA (70/10k) and power (70V*7mA) is 0.49W.

I'm merely suggesting that the power requirement stays fixed and that the sensor requires "heating" (0.5W) before it will reach its advertized characteristic. When "heating" the sensor however there is a big difference between 7mA and 100mA.
Title: Re: Receive data from linear potentiometer?
Post by: Grumpy_Mike on Feb 12, 2010, 09:36 am
@BenF
I think you reasoning is that there might be a hidden maximum current that is independent of power ratings that is doing the damage.

If this were a semiconductor then this could be true, but this is a passive linear component and will operate at 0.5W with a variate of currents and voltages. This device is overheating therefore it must be experiencing a power dissipation over it's rating. With a 5V supply the only way to do this is to connect between the wiper and one end. I blew up two pots like this when I was 12, I have never forgotten that lesson.

I think this is a problem of either misidentifying the wiper or having some mechanical fault with the soft pot.
Title: Re: Receive data from linear potentiometer?
Post by: borref on Feb 12, 2010, 10:30 am
Quote
.. but this is a passive linear component and will operate at 0.5W with a variate of currents and voltages ..

That's the question I would say - Is it a passive linear component?

If it's a semiconductor made from some substrate that requires 0.5W or thereabouts  to operate within specifications, interface requirements would be different than for a linear pot.

I do agree however that a more likely explanation is incorrect wiring (connecting the wiper and a bus bar to 5V/GND respectively). If the sensor reads low ohms when not touched - that would also explain why it burns out so fast.

Measuring the resistance between bus bars (should be 10k) and also looking at the actual current through the bus bars (should be no more than 0.5mA at 5V) in a live circuit ought to give him useful answers.
Title: Re: Receive data from linear potentiometer?
Post by: edsonedge on Feb 12, 2010, 05:56 pm
I havent had  a chance to measure the sofpot but I think I have an idea of what is happening

I plug the softpot to arduino mega  

(http://arduino.cc/en/Main/ArduinoBoardMega)    

 and the analog input (that I plug the wiper collector to can be programmed as an ouput also and therfore give out voltage - it must be that the programming I am using for the arduino board (Standard Firmata for Max Msp)  has the analog input ouputs programmed so that they give out voltage  and therfore burn the wiper
Title: Re: Receive data from linear potentiometer?
Post by: edsonedge on Feb 12, 2010, 07:23 pm
Thanks

Ill try that tonight

:)
Title: Re: Receive data from linear potentiometer?
Post by: evtsai.km2 on Mar 22, 2010, 04:07 am
Looks like someone also had the problem of the softpots burning up for no reason (my pinouts are correct: +5V on the triangle, GND on Pin 3 and voltage out from the center into the arduno. I have read through all of the replies in this thread and looks like the consensus is to put either a 100 or 1000 ohm resistor between the softpot output pin and the arudino analog-in pin to make sure that high-current does not go through the softpots.

Unfortunately, these problems (and this discussion) were not in sparkfun's item comment before I bought these things.
Title: Re: Receive data from linear potentiometer?
Post by: edsonedge on Mar 22, 2010, 01:19 pm
Hy evtsai.km2

I have sort of got these sensors working.  

If I plug 5v into either right or left pin and then middle pin to analog in on the arduinio  (without connecting anything to ground) then the softpot doesnt burn up, but only about half of the sensor works (gives out a value)

then I plugged a 9v battery to the sensor with the same wireing  and then the whole touch sensor works - but when you touch (for a short while) the sensor at the end where 9v go in, it heats up (just at that position).

So the sensor sort of works like that.
Title: Re: Receive data from linear potentiometer?
Post by: junkdna on Jun 03, 2010, 01:18 pm
can one use these 'SoftPots' to obtain accurate distance measurements? Like around 0.01mm?
Title: Re: Receive data from linear potentiometer?
Post by: junkdna on Jun 03, 2010, 04:41 pm
thanks for the reply.

If range was 100mm (4"), what would be accuracy?