Reference voltage

I would like to read out a variable resistor (in the form of a engine oil temp resistor) more accurately than I am currently doing.

Can I simply set the analogReference to INTERNAL, but still supply +5V to the sensor?

I hope this doesn't break my Arduino. I.e. supplying more than 1.1V to the analog input pin.

Am I correct when saying that anything supplied above +1.1V will be read out as 1.1V (and therefore 1024)?

At normal engine operating the total resistance will be somewhere around 210 Ohm. Does this generate a too high current through the Arduino?

Am I correct when saying that anything supplied above +1.1V will be read out as 1.1V (and therefore 1024)?

Yes that is right, as long as the input doesn't go over 5V you will be fine.

At normal engine operating the total resistance will be somewhere around 210 Ohm. Does this generate a too high current through the Arduino?

How is this wired up? The analogue input has a high impedance so it doesn't draw much current.

Am I correct when saying that anything supplied above +1.1V will be read out as 1.1V (and therefore 1024)?

to be precise, it will be 1023

The internal reference voltages of the ATmega are NOT precise. 1.1V really means 1.1V+/-10% (or so…actual numbers are in the datasheet).

Yes, how is your circuit wired up? Voltage divider? If so, what is the other resistance value? How much is your temp sensor’s resistance going to change? That will help answer the question of how much current you’re drawing.

where in the datasheet does it say the 1.1 reference can vary +/-10% ?

Table 26-7 of the ATmega328 datasheet, for example: Vint (internal voltage reference) Min: 1.0, Typical: 1.1, Maximum 1.2.

That’s 9.1%, and given that they only specify these numbers with 1 digit of precision (i.e., not 1.200) I’d venture it’s between 0.95V-1.25V.

That’s over the full voltage (1.8 – 5.5v) and temperature operating range, with a regulated 5v supply would you really expect the internal reference to vary anywhere near that amount?

Yes, I would expect that much variance anyways. Accurate references are individually laser-trimmed and I doubt Atmel goes to that extra level of expense.

These are inexpensive microcontrollers, with inexpensive imprecise on-chip oscillators, inexpensive imprecise A/D's, and an inexpensive imprecise voltage reference. It does the job it's meant to do, but if you want high clock accuracy you use a crystal, high A/D accuracy you use an external part, and high voltage reference accuracy, you use an external reference.

Just my experience.

I am traveling at the moment so can't test it myself, but if you have a reasonably accurate voltmeter, could you see how much actual error you get with your ATmega ADC measurements when using the internal reference.

Sounds like a fun thing to try with several boards and get some statistics. I'll just look at the AREF output directly rather than do A/D conversions as those will be subject to the inaccuracies of the converter itself. Sounds like a project for this weekend...I'll post the results.

The adc converter is specified to be accurate to within a few bits, so its much better than 1%, but whatever is the easiest way to test the reference.

I hope its not too much trouble, it will be interesting to know the results.

Thanks for all the replies! I’m really having touble putting the right knowledge together (although Grumpy_Mike’s site helped alot).

I wired it (the oil temp resistor going right into the engine’s carter) up as follows:

So (correct me when I am wrong) I concluded: supplying 1.1V ref voltage will set the highest temperature of the sensor to:

((10 Ohm * 5V) / 1.1V) - 10 Ohm = 35.5 Ohm
This results in a high temp range (>150degC).

But actually I want to filter out >2000 Ohm and apply the ADC resolution to the part from 2000 Ohm - 40 Ohm. But I think I will get enough resolution when setting ref to 1.1V (temporary when I read out the oil temp since the orther sensors should use a ref of 5V).

But actually I want to filter out >2000 Ohm and apply the ADC resolution to the part from 2000 Ohm - 40 Ohm.

You can't easily do this, you would have to use operational amplifiers.

Only question that remains is:

When I do set the reference voltage to internal (1.1V), but still supply 5V as drawn above. How do I calculate the resistance value? (So I can lookup the value in a R->Temp table).

I used to do this with: ((1023*10 Ohm) / measured voltage) - 10 Ohm

But obviously this is not correct anymore since 1.1V is now 1023? :-/

Hmm I think I figured it out already.

Since the maximum measurable voltage is 1.1 Volt this equals 1023. This means when we theoretically measure 5V we should get a value of 4560 (1023*5/1.1). So to measure R:

R = ((4650*10)/input value) - 10

In which 10 is the constant resistor value.