i've been getting random potentiometer readings for ages now. At best they are a bit noisy but often they don't work at all. They give fluctuating readings inside a random band... say 300 - 500. I also noticed that the readings change massively when i touch the cables or move them slightly. The pots im using are brand new ones which are 10K linear short shafted ones. I'm pretty sure my sketch is correct as I've written a really simple one just to eliminate the possibility that its a coding problem. And my schematic is as simple as the right and left pot pins go to 5v and ground on the arduino and the wiper goes to A0. So it's obviously not that that's the problem. ANyway here is my sketch: -
int pot = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
pot = analogRead(A0);
Serial.println(pot);
delay(50);
}
I'm beginning to think there is a problem with the cables im using. Like they need to be shielded or something. Either that or it's the type of pots. Also... I'm getting these issues on a few different arduinos including 2 MEGA 2560's and an UNOR3's so its not a problem with the board.
Any ideas on how to solve this would be massively appreciated
If you get readings jumping when you touch the cables you may well have a setup problem. Maybe we should start with a photo of your setup and a link to the pots you bought new?
Is the alligator clip grounded by any chance? Other than that, I'd wonder about the pots. I looked at those a while back but decided to pass. Any chance you can get something different to try?
nah it's not the crocodile clip. I think it must be the pots as well. At £1.67 for 10 what did I expect?? I'm gonna order some better ones and see what happens. But anyways I take it the answer to my question about whether the hookup wire needs to be shielded or not is a 'no' then?
A 10k pot connected to an analogue input should not give any problems.
Even without smoothing caps, and touching the insulation of <10cm wires, the values should not jump more than a few.
Something seriously wrong when they jump with a few hundred.
I assume you only supply your Arduino from the USB lead.
And you use a lineair pot (10KB). A log pot could be jumpy in the low value region.
All I can think of is wiring/soldering.
I see you have used too much solder. It's not just on the pins, but also filling the holes of the rivits for the carbon track.
Not good. That could create bad contact with the carbon track.
Another problem that I have often seen with beginners is the use of corrosive plumbers solder flux.
If so, that could explain all the problems you have.
Leo..
Do you usually solder the holes in the rivets as well as the wire to the tag.
Soldering the hole in the rivet will cause the connection between the tag and the carbon track to fail due to heat stress.
This will emerge as a bad connection.
Shoving round wires into a connector designed for a square pin usually results in a less than perfect behavior...
I've used several of the very same pots (eBay cheap-o) without issue. What I see as the problem is your chosen termination method - it simply isn't stable. The connector inside the Uno header is a "tuning fork" style female. Inserting a round wire into the square hole in the plastic header results in a very small amount of surface contact between male and female parts. With any vibration, the OD of the wire slips off the pinch points of the female side and you have, best case, poor contact and worst case, no contact at all.
Have a look at the photos - I use "dupont" style jumper wires for the connection. Square, male pins on the Arduino side, females on the pot. I pulled one cover off the female side to show how well it fits on the pot pin without soldering. This is of course for prototyping only, I'd solder connections for a permanent installation.
PS: I don't think soldering the three rivets has hurt anything as the resistive track is well away from the rivets but it isn't necessary. I suspect you were in the "try everything" mode of troubleshooting...
Every one of my cheap jumper wires terminates in a little round pin and I've never had problems with them not making adequate contact. All the female connections on my breadboard are round so you are telling me I need a hybrid wire to go to the Arduino from my breadboard?
don't think soldering the three rivets has hurt anything as the resistive track is well away from the rivets but it isn't necessary. I suspect you were in the "try everything" mode of troubleshooting...
I have had it happen, the rivet is part of the connection to the insulating body and the track, otherwise you would not be able to conduct current from the tag to the track.
Heat needed to solder the rivet hole is much more and closer to the carbon track than just soldering a wire to the tag.
Okay so it turned out... after spending a little more on the pots everything is working fine. I guess 10 for £1.67 was expecting too much. in the end I went for ones that cost £0.99 each and, apart from a small amount of noise which I can filter out with a bit of coding, they work fine.
Just for your reference, these are the cheap pots that didn't work: -
And these are the slightly more expensive (albeit still blatantly affordable) ones that did: -
Which brings me to a point... would it not be a good idea to have a page on the arduino website somewhere where people can post links to and reviews on components?
The difference between the two is not immediately obvious, except that I seem to notice a different crimp pattern on the rivets!
theobsoletemovement:
Which brings me to a point... would it not be a good idea to have a page on the Arduino website somewhere where people can post links to and reviews on components?
Could be even more contentious than soldering rivets!