Yet another grounding issue

Hi! New here, first post, sorry if I'm doing it wrong.
I find myself in need for help. I am trying to setup a joystick using arduino mega. I am using Arduino Mega and MegaJoy software. I get a lot of noise to potentiometers (10 of them). Cable length is about 5 meters (15 feet).
I tried finding similar issues and one thing that keeps popping up is proper grounding.
Right now all my digital and analog devices use the same ground? should i make a separate ground for analog inputs? if it is connected to same arduino isn't that the same?
Should i go for CASE A? is there any difference between CASE A and CASE B? Are both star-ground arrangements?
An introductory course to proper electronics would do me good, i know, it's on my list but for now i just need help with this issue.

HI and welcome the Arduino forums.

There's no separate GND.

How do you know there's noise?

"How do you know there's noise?"
Sometimes i have spikes (sudden rise/drop in axis value for a brief moment) and most of time i have 2-5% axis movement without me touching the pots.

Thank you for taking the time to reply

Sounds to me your problem comes from the power. What does the rest of your setup look like? You're more than welcome to continue your first diagram, it's good.


Hopefully this is better! Thanks again for reply!
Power supply is 9v-2A.

Are you using an Uno, just like in the picture?

I think that 5m is very long; but my knowledge in that area is limited.

I would initially check if (for testing) short wires give the same issue. You can also do a couple of readings of a potentiometer and throw the exceptional ones away.

A small capacitor (10nF ? 100nF ?) on the analogue inputs might also help to suppress spikes.

What is the value of the potentiometers?

Analog signals over 5m long unshielded wires? They're more like antennas picking up every stray bit of electrical noise in the vicinity. I've no doubt at all that you're getting noise on the inputs. Shorten and shield those wires. Or do the A/D at the pots with dedicated processors and send digital signals back to the Mega.

Several things to consider.

  1. Aref is more stable than 5V, for sure. So, use Aref and the associated GND pin to supply all your pots.
  2. What is the pot resistance? If 10kohm or less, go to 3). If >10 k, try reading each analog twice, discarding the first reading. When source impedance(i.e. pot resistance) is high, you can get "charge transfer" from one input to the next.
  3. Yes, your wiring will have an influence. Here's how I would wire it for best results. To start with, get a shielded cable with n+2 conductors, where n is your number of pots. Doesn't need to be fancy, or heavy, just needs to be shielded. Use the extra two conductors for Aref and GND, and of course, the rest for one signal from each pot. Ground ONLY the end of the shield at the Arduino GND. This approach isolates the signals from any environmental 'noise', but prevents any ground loops which can contribute their own noise.

By the way, depending on your use case, you may have the shielded wire you need. Have any old wired mice kicking around? I've harvested the wire from those before, usually there's 5-6 wires inside a perfectly useable shield. If that's not enough wires, consider making up two runs, each to half of your pots.
Beyond that, you may need to turn to signal averaging, though that impacts response time.

A big thanks to everybody who chimed in on this thread! This info is certainly helpful.

All pots are 10k.

All cables i used are shielded cables. On smaller portions i shielded them myself (with tinfoil), trouble is I did not know i had to connect shield to ground (It seems I lack some basic education in this field). Cable i have looks like the one in my second image, lower left. 12 colored coated wires, one wire without insulation coating (so 13 in total), a very thin transparent foil, then tinfoil around all of them and finally the white rubberized finish to hold them all.

Tomorrow morning when i get to work, first thing i try is to connect shield to ground and if that does not work, I will connect separate Aref to pots.

Wiring is already done in its majority and now i am trying various patches to fix it. I need high fidelity on only two of the pots so i might just use a new wire for those specifically (4 leads).

Thanks again to all for taking the time to answer!

No, it's Mega.

Makes more sense.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.