# Weird Voltage Noise

I'm new to this forum, so hello to everyone out there.

So I have an Uno with A0 connected to the positive end of a chain of LEDs (they light up when a motion sensor goes off, clunky, but it works), and the negative end is hooked up to the GND of the analog side of the Uno. It runs the following code:

``````void setup()
{
Serial.begin(115200);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
}

void loop()
{

Serial.println(printVals(A0));
}

float printVals(uint8_t pin)
{
float voltage = sensorValue * (5.00 / 1023.00);
return voltage;
}
``````

And when I open the Serial Plotter, I get a weird square wave for the voltage (when there is 0V on the LEDs, I used a volt meter). Out of curiosity, I added a jumper cable from A2 to +5V (the red wire in the diagram) and added plotting for A2, and this solved the problem - except now, the read on A0 is about 0.53.

Now, I'm more of a software guy, so I figure just subtract 0.53 and move on (varies only +- 0.03V), but I want to know: What in the world did that jumper cable do?   • There is a tiny capacitance in the ADC sampler, and if the signal you are measuring is weak, the stored charge in the ADC can affect the reading, depending on what else is going on. Like multiplexing readings from A0 and A2. – Dave X Dec 24 '17 at 4:24
• A0 connected to the positive end of a chain of LEDs - you did what? Can you sketch up a schematic? – Nick Gammon Dec 24 '17 at 5:04
• A square wave of what values? – Mark Smith Dec 24 '17 at 6:58
• The square wave is between 0 and roughly 0.5, and when I added the jumper, it was a mostly straight line at about 0.5V. – Alex Kelley Dec 24 '17 at 17:32
• It is better to use an optocoupler. This will give the galvanic isolation between the devices. And use a digital input instead of an analog. Since the indicator has only two states. – AltAir Dec 24 '17 at 19:32