Potentiometer value changing whilst not touching the potentiometer

Basically what the title states. I have a potentiometer hooked up to an uno on an analouge pin to read the value from the potentiometer. However the value keeps going from 0 to 1023 and then back to 0 despite me not touching the potentiometer and I have no clue whats causing this

int sensorValue;

void setup()
{
  Serial.begin(9600);
}

void loop() 
{
  sensorValue = analogRead(A0);
  Serial.println(sensorValue);
  delay(100);  
}

Ive attached a picture of the serial monitor. Would appreciate any help. :slight_smile:

What happens if you add this to setup()?

pinmode(A0, INPUT);

econjack:
What happens if you add this to setup()?

pinmode(A0, INPUT);

Shouldnt be necessary.

A schematic, with component values, on the other hand, is necessary.

econjack:
What happens if you add this to setup()?

pinmode(A0, INPUT);

now the values range from 50 to 980 so its a step in the right direction

Please see reply #2

AWOL:
Shouldnt be necessary.

I thought the pin might float otherwise...no?

No. with a pot properly connected the pin would always have some voltage on it. The OP probably doesn't have the pot wired up right. But he won't show what he has so we're just left to guess for now.