Just set up a replacement "Piduino" - a RPi3 connected by USB to an Arduino Uno. The previous one was the victim of a Diet Big Gulp - spilled on the voltage divider breadboard. Whoops. The tiny breadboard with the voltage divider began to rust inside so it got really difficult to keep it working correctly.

This is for the plot named "Indoor 12V Lighting System" at https://www.SDsolarBlog.com/montage

I built a new Uno/breadboard from scratch and swapped it in with the breadboard stuck onto the plastic case. All nice and tidy.

But the analog inputs were really strange. It would read really close, but then minor changes to the software would produce wildly varying results.

Imagine my surprise when this morning I discovered that I had plugged the divider's analog input to A4 instead of to A1 where it belonged.

Now that it has been fixed all is well. As long as the correct pin is being used in the digitalRead it seems not to matter, perhaps.

Here is the plot from before then after I moved the input to the correct location:

enter image description here

The actual voltage was falling from 12.7 down to 12.5, and after moving the pin it settled down to the correct reading. Then I turned on the charger while the sun is up. It is tracking the voltmeters perfectly now.

Clearly, the problem was that I was reading the wrong pin. My fault, obviously. But it got me wondering just how much they affect each other.

So my question is about why I was getting any readings at all? I would have hoped that the analog inputs were truly separate from each other. Instead, it appears as if there is crosstalk of some kind.

Is this a common issue?

New information

I see that it has been pointed out that this was discussed in this Q&A:

Should all unused analog input ports be tied to ground for accurate A2D measurements?

But since that does not call it an imperative, just "one of the problems with using analog" I would have assumed that this is not common, so perhaps there is an implied answer there.

It would be a project all by itself to use half the small breadboard to distribute ground to all the other analog pins. And I've never seen this referenced in any of the documentation. Nor is there a tag for crosstalk.

So my question still stands: Is this common when measuring a DC voltage?

  • 1
    You wrote: “Is this a common problem?” I fail to see any problem in what you describe. The behavior you experienced is perfectly normal and, usually, unproblematic. Apr 4, 2018 at 20:04
  • TNX for the comment. In response I posted this morning's plot that shows before and after moving it to the correct pin. The actual voltage was slowly dropping from 12.7 to 12.5 the whole time.
    – SDsolar
    Apr 4, 2018 at 20:34
  • 1
    The real problem is not crosstalk. The problem is you were reading the wrong pin. Is that a common problem? Yes, it happens, as people are often distracted. The fix is pretty simple, and you figured it out yourself: read the correct pin. Problem solved. Apr 4, 2018 at 21:06
  • Mea Culpa. All true. I am surprised it showed any reading at all. It makes me wonder if when I use multiple analog inputs I should use pins that are more widely-separated, kinda like how we use the urinal bank in bathrooms..? ;-)
    – SDsolar
    Apr 4, 2018 at 22:29
  • Majenko just explained how the internals work, and it makes perfect sense. It is not crosstalk at all. He gets the Accepted Answer on merit.
    – SDsolar
    Apr 4, 2018 at 22:40

1 Answer 1


This is normal and expected behaviour. There are a number of factors that influence it, and it will help to understand the basic internals of the ADC.

In simple terms the front-end of the ADC looks like this:


simulate this circuit – Schematic created using CircuitLab

The MUX selects which pin (A0-A5) is being sampled. Switch SW1 connects the Sample And Hold capacitor C1 to that selected input, which then charges (or discharges) to the same voltage as the input.

After the acquisition period switch SW1 switches position and the ADC circuit is connected to the capacitor. Over a period of clock cycles the ADC works out what the voltage across the capacitor is and stores the result in the ADCH and ADCL registers.

Now - on a pin that has nothing connected to it, what voltage will be across that capacitor when SW1 is switched to charge it? Well, this is where your strange results come from:

  1. Any charge already in the capacitor will still be there (which is why it can be good to connect the unused ADC pins to ground through a resistor, to remove that charge).
  2. Signals, either in wires, IC pins, or the silicon circuitry in the chip itself, will be capacitively coupled with what is next to it.

That last one is the most critical for your results. Capacitive coupling.

Place two wires next to each other and they will, through capacitance, try and get the same charge on them. Under most circumstances that attempt to influence the charge is completely swamped out by what is being send down the wire. But, when there is nothing being sent down the wire that charge becomes noticable. A1 will attempt to "float" to the same level as A0, because they're next to each other. A2 will try and float to the same level as A1, A3 to A2, etc.

If you put a signal in to A0 and plot all 6 inputs you will see each has a progressively lower amplitude copy of the signal. It's hopping, capacitively, between the pins. And all because there's nothing to stop it.

If you think "Ah, but it's DC. DC doesn't go through capacitors", then you're wrong. Wrong in thinking it's DC. There's a lot of mistaken assumptions about the labels "AC" and "DC".

DC is not what you have. Yes, there is a "DC component" to what you have (which is manifest as the average of the voltage over time), but there is a large AC component as well. That AC component is what you are graphing in the form of your changing battery voltage.

Voltage is far more complex than just DC or AC. What you think of as AC is actually a waveform with a fundamental frequency (e.g., 60Hz) and zero "DC offset". Add a DC offset to the signal and it's still AC, but compared to the "lower" end of whatever adds the DC offset, it's just the waveform is "shifted up".

Pure DC, and what doesn't pass through a capacitor, has no signal components. There is only 0Hz and nothing else. Pure DC is almost impossible to create without highly specialized equipment. All voltages in normal life vary, and that variance is the AC component of the signal.

  • Right on. Excellent answer, Majenko. Very thorough. That explains a lot. So it is not true crosstalk in the wiring at all. Got it. Thanks.
    – SDsolar
    Apr 4, 2018 at 22:38
  • If you do read the 6 inputs, you will greatly enhance the coupling between them, as you will be connecting C1 to each of them in turn. Apr 5, 2018 at 15:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.