Problem with random pot values and a wiring question

Hello

I have a 10 turn, 10k pot on a tripod that is monitoring a motor sweeping left and right. Basically acting like a servo.

It works fine except I get the occasional random value thrown back from this pot that messes up its positional data.

It doesn’t matter if that random figure appears during its sweep, as that makes no difference. It’s when its looking for the point to switch directions. If the random value appears then, it makes the motor run past it’s stop point.

I tried averaging the pot values, but that slows the returning value too much and it causes other issues.

I know it’s a random value issue, as I have a line in the code that throws up a serial.print “BAD DATA” if the returning value suddenly jumps by more than a value of 30.
This also tells it to ignore that value. But it’s not enough.

This pot is connected to the rig using a 3 pin plug/socket (for transporting).
I have tied the analogue return to ground using a 10k.

During normal operation, the rig only reads between 400 and 800 during a sweep.
Therefore, the pull-down 10k is used to stop the motor dead if the pot gets accidently unplugged (if the analogue value drops to <10).

PLEASE forgive the awful MS Paint image attached… but its what I had to hand.

If I add a limit switch to pull the analogue signal high if the motor does run past it’s stop, will that damage the pot? I don’t think it will, but I only have one and can’t afford to fry it.

I was thinking of adding a hall switch to the extreme limits of the rig so that if it does have an issue and run past its stop, the hall switch will return a full 1023 and I can stop the entire rig.

Many thanks

Pot wiring.png

Pot wiring.png
That switch could damage the pot. If it is near the ground end of the track, and the switch is activated, a large current could flow and burn the last part of the track.

The random readings you see are probably interference being picked up by the long cable. You could try putting a 0.1uF cap across the analog input and ground. Or you could try some kind of shielded cable.

That switch could damage the pot. If it is near the ground end of the track, and the switch is activated, a large current could flow and burn the last part of the track.

Additionally the 10K fixed resistor is always in parallel with the poy wiper position to ground.

You also need to be sure the pot is the problem and not a noise spike from another source. When a quality pot is used as feedback for a position indicator they normally work very well. I have seen them used over decades without a problem.

Ron

Yes, as I suspected.... I could burn out the pot. The cable is already shielded.
Might throw a ferrite coil on the cable too. I have found they help.

10k is always in parallel? Not sure what you mean by that. I assume you mean if the limit swich was pressed.

Hmm, this problem is kicking my butt.

Not sure how else I can detect a mechanical over-run just using the 3 wires to the pot. I have had no luck curing the pot inaccuracies so far.

Maybe I will add a limit switch that breaks the wiper return, allowing the 10k to pull it low.

In my code at the moment, if it detects the pot unplugged, it just stops everything.
I could change that to tell it to send the motor back to centre position instead if it detects no wiper.

Thank you for the advice.

as I have a line in the code that throws up a serial.print "BAD DATA" if the returning value suddenly jumps by more than a value of 30.
This also tells it to ignore that value. But it's not enough.

That sounds like the right solution. Why isn't it "enough"?

How is the pot coupled to the rotating part? I suspect binding and "camming", making the pot jerk instead of turning smoothly. Pictures?

Did you buy the pot from a quality distributor and is it a well known brand name? OR did you salvage it from something as I usually do?

Paul

New pot from RS.

Gears are fine, not much play and I have a deadzone coded in anyway to allow for such inaccuracies.
Will get some pics later.

The sudden jump in value therefore ignore it routine ‘usually’ catches it, but not always.
My pan value sweeps from 0 to 200 in value after variable adjustment from the actual pot data. 100 is looking directly centre.

If my pot data goes <0 or >201, I also have a routine that stops the motor dead and sends it back to 100 (centre).

But, I would really like to eliminate the issue so that I don’t have to rely on that recalibration. It happens too often.

Bear with me… just ripped all the wiring out and re-routed it in new screened cable a bit further away from the motors.

The rewire has helped.
I also threw in some further sanity checks to ensure it behaves. Seems OK at the moment.

One thing I have noticed. I have a pinout on my Mega2560 tied low with a 10k, and taken over to the Uno on pin 13.

Pin 13 on the UNO is PinMode set as an input, but it is (very) randomly throwing up a high and triggering the function assigned to that pin.

Is that a 'thing' with the UNO pin 13, or do I have another issue? Link between the Arduinos is only 15cm, and the 10k pulldown is definately in place (and testing correctly).

Bad pad on the UNO. Think I have been wobbling the header too much