Name:
readinternaltemp
Syntax:

READINTERNALTEMP voltage, offset, variable

READINTERNALTEMP voltage, - offset, variable

Voltage - is a constant that indicates the power supply voltage. Options are:

IT_5V0 5V supply
IT_4V5 4.5V supply
IT_4V0 4V supply
IT_3V5 3.5V supply
IT_3V3 3.3V supply
IT_3V0 3V supply
IT_RAW_H Raw word reading (high setting, above 4V only)
IT_RAW_L Raw word reading (low setting, any voltage)

Offset - is an optional correction factor, defaults to 0 Variable - receives the temperature data.

Description:

The readinternaltemp command reads the analogue voltage drop across 2 (low) or 4 (high) internal diodes. This gives a very approximate temperature indicator.

This command is used to provide an indicator of the internal temperature of the chip. It is designed to be used as a cooling failure warning threshold device, not an accurate temperature sensor! For accuracy use a DS18B20 sensor and the readtemp command instead.

Internally an ADC reading is measured across two or four diodes that are linked to the power supply. As temperature changes the ADC reading will also vary. As the ADC reference is the supply voltage the reading will also change with a change in supply (e.g. as a battery runs down). When IT_RAW_H or IT_RAW_L are used, the raw reading is returned in a word variable. Offset is ignored in these cases and so should be set to 0. When the other settings are used the PICAXE attempts to mathematically change the value into an approximate reading in degrees Celsius. If desired an 'offset' can be added or subtracted from the raw reading before this conversion occurs to try to improve accuracy.

Kindly note this system can never be an accurate sensor and should only be used as an indicator of extreme temperature only. Thresholds and offsets will vary from part to part. For accuracy use an external DS18B20 instead!

Advanced information

The mathematical equations used to attempt to convert the raw values into degrees Celsius are:

  5V0 RAW_H +/- K -508 * 14 / 13 + 5
  4V5 RAW_H +/- K -450 * 14 / 15 + 5
  4V0 RAW_H +/- K -378 * 14 / 18 + 5
  3V5 RAW_L +/- K -668 * 14 / 10 + 5
  3V3 RAW_L +/- K -647 * 14 / 10 + 5
  3V0 RAW_L +/- K -609 * 14 / 10 + 5

18M2 Firmware

Please note the 'readinternaltemp' command is only supported for 18M2 firmware D.x (PICAXE chips labelled 18M2+) and is not available for use with 18M2 firmware 2.x (PICAXE chips labelled 18M2).

The PICAXE compiler will syntax check code for an 18M2 as correct when using the 'readinternaltemp' command but will generate an error when an attempt is made to download into an 18M2 with firmware 2.x.

Applies To:
08M2, 14M2, 20M2
See Also:
Related Create:
    Share:
    Print:

    Title

    Description

    Code Example:
    main:	readinternaltemp IT_5V0,0,b1
    	debug
    	pause 500
    	goto main
    Copy Code Submit an Example

    Submit Your Own Code!

    You must be logged in to submit code examples. Login now.

    Comments

    • Posted by scott-s

      Hi, does anyone know why the following happens?

      [code]

      'all initial stuff, hi2csetup, etc.

      readadc10 B.0,w1 'happens about 7 times for w1 to w7, different pins

      readinternaltemp IT_RAW_H, 0, w8

      'all outputs go off here

      [/code]

      I deduced this by commenting out lines in my code - commenting out this one stopped some LED outputs from turning off. I don't think it is resetting the entire Picaxe though, and I am using a 20M2.

    • Login to leave a comment.