ATtiny25 temperature measurements

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I copied the following from the ATtiny25 datasheet.

T = { [ (ADCH << 8) | ADCL ] - TOS } / k

where ADCn are the ADC data registers, k is a fixed coefficient and TOS is the temperature sensor
offset value determined and stored into EEPROM as a part of the production test.

Does anyone have any idea where this TOS value might be stored? I have not been able to find any reference to it on the Atmel site or the Freaks site. It's not mentioned in the iotn25.h file either.

AVR Studio gave me this dump of eeporm

:10000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00
:10001000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0
:10002000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0
:10003000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0
:10004000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0
:10005000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0
:10006000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA0
:10007000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF90
:00000001FF

My program is just using flash, so I don't think
I cleared the eeprom.

Any ideas?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The TOS is an offset value which you need to figure out for yourself, and store, based on the temperature probe you are using.

If you place the probe in melting ice and then boiling water, you should be able to spit out your ADCL and ADCH values for each test and then come up with two formulas, solving for the variables (you know that T = 0C for the first and T = 100C for the second).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

My program is just using flash, so I don't think
I cleared the eeprom.

When you do a chip erase--normally done at the start of an ISP sequence--both the flash and EEPROM are erased.

Try a virgin chip, and Read EEPROM before any other operations.

It certainly IS strange that the datasheet has no other references to TOS.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Geoff wrote:
The TOS is an offset value which you need to figure out for yourself, and store, based on the temperature probe you are using.

If you place the probe in melting ice and then boiling water, you should be able to spit out your ADCL and ADCH values for each test and then come up with two formulas, solving for the variables (you know that T = 0C for the first and T = 100C for the second).

The temp probe on the ATTiny25 is on the chip die. I doubt the OP wants to freeze or boil his board.

I am using tiny25s in a current project. You read the temp sensor by setting MUX bits. I think I enabled it once just to see if it worked.

The app i did has code to use the ADC to set a PWM value as a user input value read from a pot. If the ADC is out of range at boot I can have other option.

As the ADC routines are interrupt driven, I hate to waste things, So figured I could re use the sampling sum and average code to monitor the temp. Just change the MUX bits.

Did not quite as I expected work as when nothing is connected to the sample ADC line it is in tri state and the ADC samples in the middle. To use the other modes I either have to ground the parameter pin or pull it high. By choice I made the parameter pin the same one as the SCL line. That way with future versions I could use TWI to set the parameters and provide a diagnostic return from the chip.

I never looked into calibrating the temp sensor. As the sensor is on the die, It does not do too much good to tell if the coil or FET is overheating. By the time these parts get hot enough to signal the chip die they are gone. When the boards were built, everything worked and there has not been too much need to provide user input or feedback.

I wonder if the TOS for a given part could be stored like they do the OC byte in a special place. As noted I have not looked into the calibration. One would think that given the integrated nature of the tiny25 that there would be some sort of detail apart from destructive test or freezing or boiling a board.

There are between 48 and 96 Tiny25s in my project. (Yes it is related to a player piano.) Calibrating each one for temperature would be a real chore. So I have not done anything more with the onboard sensor.

-julie

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I wonder if the TOS for a given part could be stored like they do the OC byte in a special place.

Isn't that what they imply in the datasheet?
Quote:

...TOS is the temperature sensor offset value determined and stored into EEPROM as a part of the production test.

But where is it?

[edit] I pulled out two virgin ATTINY25-20PU chips, gussied up the STK500, read the signature OK, and read and edited the EEPROM. All EEPROM bytes were 0xff.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jporter wrote:

The temp probe on the ATTiny25 is on the chip die. I doubt the OP wants to freeze or boil his board.

Fair enough too! I assumed it was an external probe.

Sounds like you still have to calibrate it yourself - you will probably find some variation between chips but that only matters if you need to be highly accurate.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I actually broke down and wrote to Atmel technical support. I’ll share any response that comes in.

My opinion is that either the data sheet included the note as wishful thinking. Or, possibly the production test engineer forgot to add the routine to store the byte. It seems like a good idea to me, if it works.

I have tried several chips and the temperature numbers returned were very different. The equivalent of 50 degrees F.

The device seems to measure very close to 1 LSB per degree C. As I recall from some Thermodynamics class that I took in a past century, a silicon diode characteristic is a forward voltage change of 1 mV per degree C.

So, the base resolution in C is one degree. Once you do the conversion to F and bring in the 9/5 coefficient that decreases the resolution to almost 2 degrees F. The datasheet only claims +/- 10 degree C accuracy anyway. For my application the resolution should be OK but I do want to calibrate multiple units to report the same room temp as a minimum.

My application is for monitoring the voltage of units like batteries in an electric car, or individual solar panels. The small modules will be attached to the unit under test so knowing the ambient temperature seemed like helpful data to have.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is the ATmel responce:

"Nothing is stored in the EEPROM before you do it yourselfes, so the value 0xFF will appear in all memory spaces."

The document currently on their website is marked Preliminary. So, the reference to a stored value should be corrected in any final version.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One possible alternative interpretation of the datasheet would be that the "production test" spoken of is not something which Atmel does prior to shipping the part. Maybe it's a test which you must design yourself and incorporate into the finished product's "production test".

That would fall in line with Geoff's suggestion, but maybe you could choose some less destructive "reference" temperatures.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good point. Because of my background, I only thought of production test as final chip test, because Atmel is a basically a chip company. But, you are correct that a board level production test would be another opportunity to store a correction factor.

I responded to Atmel and said I thought the datasheet was in error. Perhaps they will clarify.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have searched for more answers regarding this same topic and wrote to Atmel. It doesn't address where TOS is stored in EEprom so I assume it is all user controlled. They now have an App note that describes temperature compensation in detail.

The application note AVR122 on Calibration of the AVR's internal temperature reference can be download from www.atmel.com/avr -->Application Note