I want to use the "temperature sensor" feature of the ADC.
I use Kinetis K22F Sub-Family processor, for which the temperature slope is (Typ.) 1.62 mV/C and the ADC resolution is 16bit.
I read carefully AN3031 and the post about the slope calculations here and SW implementation wasn't a problem.
My MCU Vcc is powered by 3.0V +-3% via LDO.
1. For a reason I don't understand, any minor change in Vcc result with a major temperature error:
Shouldn't the 3% error be negligible if ADC proportional to 1/Vcc :
Delta_ADC = a/100 - a/103 = a*3/10000
2. Is there a way to use another reference (i.e. VREF) for the temperature sensor?
Thanks
Solved! Go to Solution.
I promised to update:
I have a gizmo powered by battery (non-constant Vcc).
I used the internal reference voltage as the source for ADC temperature sensor.
My VREF is trimmed by a value measured as part of manufacturing (at room temperature).
I managed to test the results for a few units in a controlled oven:
As you can see, the result are obviously linear and the different units constants do not differ much.
Conclusion - one can measure temperature with ADC without a stabilized Vcc.
I won't do the statistical analysis (which will require much more data anyway), but I assume the measure mistake is up to 2-3 Celsius, which is perfectly OK for MY needs.
I don't see your math, but let's 'assume' you measure a Vtemp of 738mV, AND make the assumption you don't re-calibrate Vtemp25 but take the datasheet nominal 716mV. IF your 'VCC reference' IS 3.00V, each LSB will be .04577mV, so 738mV nets 16,122 counts. Using:
Vtemp_mV=3000L*cpuTemp/65536
returns to 738, naturally. 25000-(738-716)*617 yields 11,426mC or 11.4C.
IF VCC is ACTUALLY 3% 'low', each LSB is .0444mV/LSB, so 738mV comes in at 16,620 counts. Using the same two equations, you will come up with 761mV, making -2.8C. A huge error, agreed. The 'small differences' in temperature voltages magnify the errors. 761 is indeed 3% above 738, BUT 'twice as far from 716'. A variation on the butterfly effect.
Also, the +/-10mV 'tolerance' on the uncalibrated Vtemp25 yields another +/-6C error. There is also +/-4% slope tolerance.
If you want to 'do better' in the 'worst case', you can certainly start by using Vref for the ADC reference -- I use a REF3030, which gives me +/-0.6% over devices/temp/age. A 0.6% 'low' reference, in the above case, yields 0.0455mV/LSB, a 738mV conversion result of 16,219 counts, 742mV, 8.9C. Only 2.5C off...
Better reference parts are obviously available, like MAX6071AAUT30 (about +/-0.1% over devices//temp/age). But you would also then want to calibrate each CPUs 'Vtemp25', and ideally find the slope for each device from a second temperature. You might also want to alter my math to work in 'tenths of millivolt' integers, as each mV in my integers represents 0.62C granularity.
Or 'give up' and put in an external ambient sensor like ADT75B...
Thanks for clarifying the butterfly effect.
Regarding the reference, which I guess I have to use:
- How do you configure the ADC for an external Vref?
- Is there a way to use the internal Vref as well?
The internal bandgap is 'no better' than your LDO -- +/-3%. So I don't see any help there! Vref1.2 spec for 'factory trim', over temp (Table 33 of spec sheet K22P80M120SF5) is 1.198+/-3.3%. I don't know if 'user trim' tolerance (+/-0.17%) can apply over the full device temperature range. In any case, use of Vref1.2 requires dedication of the Vref_out pin to an external 0.1uF capacitor.
To use an external Vref requires either that your package HAS the Vref pins available, OR that you power the entire part from said 'high accuracy source', which in this case might be an LT1461CIS8-3 for 'some current'.
Selection of ADC reference is in ADCx_SC2, the two LSBs REFSEL, which for 00 is the 'default Vref pins', and 01 is the 'alternate source'. Section 3.7.1.7 of K22P80M120SF5RM calls these out as external VrefH/VrefL, and 1.2V internal Vref respectively.
I was not sure REFSEL refers to the temperature sensor channel as all documentation mention Vdd only.
If true, This is good news because I do have access to Vref output and I can measure it across the relevant tempratures and do diffrential adjastments (assuming it didnt change that much from last measure). I will probably have to calibrate the linear constants v25 and m too...
I will update on my resolution here.
I promised to update:
I have a gizmo powered by battery (non-constant Vcc).
I used the internal reference voltage as the source for ADC temperature sensor.
My VREF is trimmed by a value measured as part of manufacturing (at room temperature).
I managed to test the results for a few units in a controlled oven:
As you can see, the result are obviously linear and the different units constants do not differ much.
Conclusion - one can measure temperature with ADC without a stabilized Vcc.
I won't do the statistical analysis (which will require much more data anyway), but I assume the measure mistake is up to 2-3 Celsius, which is perfectly OK for MY needs.
Hi Elkana,
First of all, thanks for your sharing.
I have some queries about with the experiment illustration.
1. You use the internal 1.2V as the ADC voltage reference sources, did you trim the internal VREF at a specific temperature or trim every time when the temperature varies?
2. Does the 0303, 030f, 0s12 stand for the level of the Vcc?
I'm looking forward to your reply.
Thank you in advance.
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
1. No. The trimming is done as part of the manufacturing process at about room temperature, then value is saved in flash and re-used every measure.
I know it's not perfect, but it's good enough for my needs and as you can see, it's pretty linear as it is. If you are interested in a certain threshold(s) (as I am), you can measure your TRIM value at this temperature, so you get better accuracy near that value.
2. These are just IDs (MAC suffix, actually) of the tested units.
Good luck,
Elkana.
So you'll have to pardon us if I don't see how your test validates 'over various Vdd' -- sounds like several units, probably all with 'new' batteries. Can you re-run the same three units, same temperature span, but this time with a 'silicon diode' in series with each battery, or some other way to simulate a 'much lower' battery voltage?
The batteries were not all new. voltage varied 2.4V-3.0V under load
I'm not quite sure what you're trying to get at. We know, of course, that REFSEL sets the conversion reference for the ADC, and it is that 'conversion uncertainty', in ADC counts, that leads to ALL the error I noted above -- a 3% error in conversion of an absolute voltage, differenced from an 'assumed' exact reference temp, which leads to the 'unexpectedly large' temperature result deviation. A more accurate ADC reference just means you will get a 'better answer' (less tolerance uncertainty) for any exact given input voltage.
I do not know what voltage-source feeds into the Vbe 'temperature reference cell', but I assure you that the current-source driven from said voltage is 'pretty well constant' over a wide variation in said source voltage, and ANY effect such voltage (then secondly current) variation would have on the measured Vbe 'drop' which is the temperature-cell will be a VERY small tertiary effect. You can treat the Vtemp measures as absolute voltages for all intents and purposes -- just 'absolutes' that 'vary some' from device to device (both in Vtemp25 voltage, and slope!) based entirely on the exact 'doping' and 'etching' processes for particular parts.
If you ARE going to rely on the internal Vref1.2, either AS the selection for ADC reference, OR, as you imply, as a 'second measurement' with which to 'calculate back' to the 'current Vdd' level as ADC reference, I would like to see Freescale explain the 'user calibrated tolerance' for said Vref over temperature, as I don't understand how it can be 'significantly better' than factory trim (+/-3.3% over full temperature).
If you only found this 'helpful', what else are you looking for to be an 'answer'?