Reading 5v analogue sensor

I have a sensor which outputs 0-5v analogue output.
I've noticed that when the sensor has an output of 4v, and I do a analogRead(A3) it returns 1023.

I was expecting to see a figure of 800.

This is the code I used to test the sensor:

void setup() {
  Serial.begin(57600);
}
void loop() {
  Serial.println(analogRead(A3));
  delay(50);
}

Would you expect to get a value over 1000 or around 800 back?

Thanks

Jim

What is your system? Standard Uno running from 5V?
Nothing connected to Aref pin?
Do you have all grounds connected?

I would expect a reading of ~Vin/.00488.
So 4V = ~819

I'm just using an atmega 328 on a breadboard, there is nothing connected to pin21 Aref, is this where I've gone wrong?

Jimster:
I'm just using an atmega 328 on a breadboard, there is nothing connected to pin21 Aref, is this where I've gone wrong?

No, nothing should wire to the pin unless you are using a analogReference(EXTERNAL) command in your sketch. Some recommend wiring a .1 ufd cap from Aref pin to ground for added noise filtering.

Check all your wiring between sensor and arduino board. A link to your sensor might be useful.
Also check your breadboard wiring and be sure you are using proper bypass capacitors on the AVR Vcc and Avcc pins.
Lefty

The sensor is a load cell, I've also replicated the problem using a diode between 5v and analogue input 3. When tested with a digital multi meter it shows around 4.2v but stil 1023 on the serial monitor. There is nothing else in my code, the complete code is above.

Some recommend wiring a .1 ufd cap from Aref pin to ground for added noise filtering.

Yes I would, even up to 1uF.
Also check the decoupling on the supply pins and also make sure you have both the analogue and digital supplies connected on the bread board.
For extra precision wire an inductor between analogue and digital power pins, with a cap to ground on both and feed the power into the digital pin.

Sorry to be lame, but what do you mean by coupling?

Maybe I should start from the beginning, can anyone point me in the direction of a diagram of the minimum components for an arduino where I can read analogue voltages accurately?

but what do you mean by coupling?

Not coupling but decoupling, the art of isolating the power supply from the noise generated by the circuits it is driving.

Google decoupling and my foroum name, I am on an iPad so I haven't got access to my links.
As for a stand alone circuit look at my monome project.

Thanks Mike, I'll have a read.

For anyone else here is the link
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html

Jimster:
I've also replicated the problem using a diode between 5v and analogue input 3. When tested with a digital multi meter it shows around 4.2v but stil 1023 on the serial monitor.

As well as a diode, you need a pulldown resistor connected between the pin and ground. When the DMM is connected, the DMM acts as a pulldown resistor. Disconnect it and the pin will probably float up to 5V.

Check that the Aref pin isn't shorted to anything, and that Avcc is connected to +5V.