Potentiometer issue

I'm having a issue with my Potentiometer first off it is reading full when only turned 3/4 of the way. plus its jumpy not steady. its working fine with a simple code but not this one. plus how could i change the set point using the Potentiometer. i thank anyone that can help. its a 500k Pot.

#include <PID_v1.h>
// Analog output pin
#define outputPin 9
// thermistor analog pin
#define THERMISTORPIN A0
// how many samples to take and average
#define NUMSAMPLES 5
// how long between pid/sampling
#define SAMPLETIME 1000

//Define Variables we'll be connecting to
double Setpoint, currentTemp, Output;
//Specify the links and initial tuning parameters
PID myPID(&currentTemp, &Output, &Setpoint,15,.3,0, DIRECT);
void setup() {
Serial.begin(9600);
analogReference(EXTERNAL);
pinMode(outputPin, OUTPUT);
//initialize PID setpoint *C
Setpoint = 100;
//turn the PID on
myPID.SetMode(AUTOMATIC);
myPID.SetSampleTime(SAMPLETIME);
//pid Autotuner
}
void loop() {

int tt = analogRead(1); // tt is targetTemp
tt = map(tt, 17, 1023, 100, 400);

if (Serial.available() > 0) {
// get incoming byte:
Setpoint = Serial.parseFloat();
Serial.write(tt);
}
uint8_t i;
double average = 0;
// take N samples in a row, with a slight delay
for (i = 0; i < NUMSAMPLES; i++) {
average += analogRead(THERMISTORPIN);
delay(10);
}
average /= NUMSAMPLES;
currentTemp=resistanceToC(inputToResistance(average));
myPID.Compute();
analogWrite(outputPin, Output);
Serial.print("Set Point: ");
Serial.print(Setpoint);
Serial.println(" *C)");
Serial.print("Temperature: ");
Serial.print(currentTemp);
Serial.println(" *C)");
Serial.print("PID output ");
Serial.println(Output);
Serial.print("Target Temp: ");
Serial.println(tt);
delay(SAMPLETIME);
}
double inputToResistance(double input) {
// funtion to convert the input value to resistance
// the value of the 'other' resistor
double SERIESRESISTOR = 10000;
input = 1023 / input - 1;
return SERIESRESISTOR / input;
}
double resistanceToC(double resistance) {
// funtion to convert resistance to c
// temp/resistance for nominal
double THERMISTORNOMINAL = 118000;
double TEMPERATURENOMINAL = 25;
// beta coefficent
double BCOEFFICIENT = 3950;
double steinhart;
steinhart = resistance / THERMISTORNOMINAL; // (R/Ro)
steinhart = log(steinhart); // ln(R/Ro)
steinhart /= BCOEFFICIENT; // 1/B * ln(R/Ro)
steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
steinhart = 1.0 / steinhart; // Invert
steinhart -= 273.15; // convert to C
return steinhart;
}

How much did you pay for the pot? Is it linear or logarithmic? If linear, is it carbon or wirewound, or resistive plastic?

Paul

... and what is the circuit?

Sounds like a wiring problem or a very badly made potentiometer.

Pretty high impedance, subject to noise pickup and arduino likes an analog in Z of 10k or less.

I got the first issue i was using 5v instead of 3.3. still trying to figure out how to change the setpoint using the pot.

i got it thanks for everyones help. all i had to do was write Setpoint = (tt); thought it would be tougher then that.