Thanks Robin. Well at least the Marquee got your attention.
The code is for a differential temperature controller so its not a question of it being too sensitive. As the temperature rises to a certain point the relays are switched on to activate a pump. But this causes the values read by the sensors to jump. Theres nothing i can do about turning the relays on and off, thats the nature of the project. The relays are turned on by sending digitalwrite low (Yes I know its an odd relay board). Which means the voltage being fed to the sensors suddenly increases.
I've read and read and reread everything I can about analogref but I just cant get my head around it. If the 5v pin feeding the sensors on the arduino is jumping around and the sensors output a linear voltage at different temperatures proportional to their input voltage, how does using analogref help fix the reading.
It can't be that hard. everyone else must face this problem with reading analog sensors. We know you can't rely on the voltage from the 5v pin of the arduino to remain stable so how does anyone ever build anything which gives a consistant output from an analog sensor?