Arduino issues with accurate ADC and heat?

I have an Arduino project for my motorcycle.
It shows the current gear display.
The motorcycle gear has a voltage between 0-5.1V and is very accurate - I tested it with a multi-tester.
The ADC Port has a voltage divider (1:2) made of two large resistors (1M).
I noticed 2 months ago that when the temperature rises (I have an onboard I2C thermometer connected to Arduino) the reading of the gear voltage goes down.
I thought that the initial resistors I used for the voltage divider were not high quality (some ebay cheap ones) and don't have a low PPM/C. So I bought military spec resistors (50 PPM/C).
The problem is not solved.
Which leads me to think that perhaps Arduino is the source of the problem.
In particular the problem is becoming noticeable at temperatures above 80F.

Some people suggested connecting the gear wire directly to a port, without a voltage divider, but that seemed to me as quite risky.

Any ideas?

EDIT: I'm using the Duemilanove, and otherwise have no issues with it.

BigMan73:
I noticed 2 months ago that when the temperature rises (I have an onboard I2C thermometer connected to Arduino) the reading of the gear voltage goes down.

Have you measured whether the actual voltage signal received at the Arduino goes down? That would tell you whether the change was caused by some temperature-related inaccuracy within the Arduino's ADC, or something in the external circuit.

PeterH:

BigMan73:
I noticed 2 months ago that when the temperature rises (I have an onboard I2C thermometer connected to Arduino) the reading of the gear voltage goes down.

Have you measured whether the actual voltage signal received at the Arduino goes down? That would tell you whether the change was caused by some temperature-related inaccuracy within the Arduino's ADC, or something in the external circuit.

I measured the voltage of the motorcycle gear line, and it hasn't changed.
Should I measure the voltage between the analog port (e.g. A4) and GND?
I will do so.

1MOhm is too much for a good reading.
The analog input should have 10k, so you could use a diviver of two 22k resistors (or less).
Do you also have a delay of 20ms after setting: analogReference(DEFAULT);

Now you mention it, ground current could be a problem. That can cause all kinds of strange effects.

Krodal:
1MOhm is too much for a good reading.
The analog input should have 10k, so you could use a diviver of two 22k resistors (or less).
Do you also have a delay of 20ms after setting: analogReference(DEFAULT);

Now you mention it, ground current could be a problem. That can cause all kinds of strange effects.

I thought so too, regarding the resistance values, and started with similar resistor sizes.
It caused the motorcycles ECU (computer) to show an error code, since the ECM has its own gear measuring circuits (ADC) in parallel to my circuit. The reading is actually very accurate when it is not too hot - I just went to the bike (it cooled down from the morning ride) and now Arduino shows 75.4F, and a clean accurate of 5.00V for the Neutral gear (which is correct).

Regarding analogReference(DEFAULT); - I don't have any such call in my code.
I just simply call analogRead directly.
"
int value = analogRead( ANALOGPIN_GEAR_POSITION );
"

Do I need to call it at all? If I understand correctly the function call isn't mandated for default (5V) behavior.

I always use analogReference(), but after reading carefully I think it is not mandatory.

If the issue turns out to be heat-related, I see two approaches.

One, measure on-board temperature with a LM35, TMP36 or similar analog temperature sensor. Alternatively, a DS1B20 might work great too. If the influence is somewhat linear, you could use the temperature sensing to correct your readings.

My preferred choice would be to read a series of reference resistors. Use their output via a least squares approach to correct your offset and gain on the ADC and you can continuously fix the problem.

Constantin:
If the issue turns out to be heat-related, I see two approaches.

One, measure on-board temperature with a LM35, TMP36 or similar analog temperature sensor. Alternatively, a DS1B20 might work great too. If the influence is somewhat linear, you could use the temperature sensing to correct your readings.

My preferred choice would be to read a series of reference resistors. Use their output via a least squares approach to correct your offset and gain on the ADC and you can continuously fix the problem.

I do have an on-board temperature sensor - DS1631, it resides on the Shield. Forgot to mention that the resistors are also on the shield (SparkFun Proto Screw Shield). The DS1631 readings are 100% reliable so far.
Also have another temperature sensor (DS18B20/OneWire) in the front of the bike. Arduino is under the bike seat. The readings between them are not that different - about 5F at most (which makes sense, given their locations).
I have found a workaround to the problem - I do recognize the 1st gear consistently (because it always has voltage < 1.5V), so I know 1st Gear should be 1.33V (normally) and I use a compensation of the difference. e.g. If the 1st voltage gear reads 1.00V by Arduino, I know that it should be actually 1.33V and therefore add 0.33V to all other gear readings. It works, but I would like to understand why this happens.

As for the other option, thanks but I ran out of Analog ports space..they are all used..

Multiplexers are your friend. With four pins, you can control up to 16 input channels. On a thermistor board I have designed, 5 inputs are precision resistors that are used for the offset and gain calculation.

Constantin:
Multiplexers are your friend. With four pins, you can control up to 16 input channels. On a thermistor board I have designed, 5 inputs are precision resistors that are used for the offset and gain calculation.

I thought about it (actually I have a PCF8591 which I used during early development), but it is a quite a complex solution and does nlot resolve the fundamental question - why isn't the ADC solution I have (resistors and/or Arduino) working properly with heat?
My resistors are the best money can buy (I think) - top of the line. They are extremely accurate and also have a very low PPM/C. I'm not ruling them completly out yet, but it doesn't make sense. For a voltage divider to show 1V instead of 1.33V the resistors need vary considerably, and I I can't see why at 80F the military spec resistors would suddenly do it. They are designed for much higher temperatures.

So it seems to be logical that something is either wrong my particular board, or with the Arduino design, or specifically with the Duemillanove design in regards to ADC.

Is there some hidden (pull up?) resistor somewhere on the board or AVR that can cause such behavior?

EDIT: When I ride next weekend, I will measure the voltage of A4->GND and at least then I can see if the problem is the voltage divider or not.