Why do i need GND while using analog pin 0 ?

Hi!

Im a beginner and im doing this example. http://arduino.cc/en/Tutorial/ReadAnalogVoltage

But i don't realy understandning why i just need GND? I know that is ground. The potentiometer scales of the voltage from 5V to like 3V and send it to analog pin 0. analog pin 0 read the voltage and print it out to the monitor.

Why do i need the GND if i only want the voltage goto analog pin 0? Like putting a reistor between pin 5V and analog pin 0.

EDIT: This is the same thing! http://arduino.cc/en/Tutorial/DigitalReadSerial

Why need GND here?

Why do i need the GND if i only want the voltage goto analog pin 0?

Because voltage is a potential difference between two points, one is the analogue input and the other is ground. If you don't connect the ground you have only have one point and you can not measure the voltage on one point. In fact it is meaningless to try.

Grumpy_Mike:

Why do i need the GND if i only want the voltage goto analog pin 0?

Because voltage is a potential difference between two points, one is the analogue input and the other is ground. If you don't connect the ground you have only have one point and you can not measure the voltage on one point. In fact it is meaningless to try.

So you're telling me that if 2.5V goes to GND and 2.5V goes to analog pin 3, im gonna land on half of 1024? Which is 512. If 0V goes to GND and 5V goes to analog pin 3, im gonna land on 1024? Or 1023 in this case.

Is this the same as digitalRead() ?

you can not measure the voltage on one point

....Zen and the Art of Electrical Engineering

Can you show me an example there if 5V goes stright into analog pin 0. The monitor will show a position, and if 4V goes into analog pin 0, the monitor will show another position?

So you're telling me that if 2.5V goes to GND and 2.5V goes to analog pin 3, im gonna land on half of 1024?

Come on don't be silly. You are banding about terms you do not understand. How can you have 2.5V going to ground? 2.5V with reference to what???

However if you have for the sake of argument a 2.5V battery, and you connect the negative to ground and the positive to the analogue in then yes you will get a reading of 512 (half 1024 ).

Can you show me an example there if 5V goes stright into analog pin 0. The monitor will show a position, and if 4V goes into analog pin 0, the monitor will show another position?

Yes this will happen only if the ground of this voltage is connected to the ground of the arduino. If you take a 1.5V battery and connect the positive to the analogue in and leave the negative unconnected you will get random readings because your input is floating.

So you're telling me that if 2.5V goes to GND and 2.5V goes to analog pin 3, im gonna land on half of 1024?

As @Grumpy write to you, wrong words. On analog pin you read something, referred to 0V on GND. What read? For example a voltage from 0 to 5V that you change with a potentiometer (see this): http://arduino.cc/en/Tutorial/AnalogReadSerial

It's not right to talk of "0v going to ground and 5v to the analog pin". You need to think of it as a potential of 5 volts between ground and the analog pin. The normal assumption is that ground is at 0 volts.

If you arrange things so that the voltage at the analog pin (compared to ground) is 2.5 volts then the Arduino should read half of 1024 as you say.

If you connect a potentiometer so that one end is connected to ground (0v) and the other end is connected to 5v then when you turn the knob the voltage at the centre terminal can sweep between 0v and 5v and you can read that with the analog pin as a number between 0 and 1023.

...R

persson121: So you're telling me that if 2.5V goes to GND and 2.5V goes to analog pin 3, im gonna land on half of 1024? Which is 512. If 0V goes to GND and 5V goes to analog pin 3, im gonna land on 1024? Or 1023 in this case.

Is this the same as digitalRead() ?