A thermistor is a resistor that changes in value according to it’s heat. In actual fact all resistors change in value as they heat up or cool down, but thermistors are manufactured to show a large resistance change.
By placing the thermistor as the top or bottom resistor in a potential divider circuit varying temperatures can be turned into varying voltages which a PICAXE can read.
Thermistor response is not linear, and so the readings will not change in exactly the same way as with a potentiometer. In general there is a larger resistance change at lower temperatures.
Because of this non-linear response and the need to calibrate for a particular sensor chosen it is often easier and more convenient to use a digital temperature sensor such as the DS18B20.
Thermistor (temperature)
Schematic
PCB
Reading a thermistor
The following program will read the thermistor value and display it as the contents of the 'b1' variable.
- Code Example:
-
main: readadc C.0, b1 ; read the value debug ; show the value read pause 1000 ; wait a short while goto main ; repeat
Copy Code Submit an Example
Temperature level indicator
This program will read the thermistor value and, depending on that value, will light one of three LEDs to indicate what range it is in.
- Code Example:
-
main: readadc C.0, b1 ; read the value if b1 < 100 then light1 ; range 0-100 = 1 if b1 < 145 then light2 ; range 100-145 = 2 if b1 < 175 then light3 ; range 145-175 = 3 goto main light1: high B.1 ; switch on LED 1 low B.2 ; switch off LED 2 low B.3 ; switch off LED 3 goto main ; loop light2: low B.1 ; switch off LED 1 high B.2 ; switch on LED 2 low B.3 ; switch off LED 3 goto main ; loop light3: low B.1 ; switch off LED 1 low B.2 ; switch off LED 2 high B.3 ; switch on LED 3 goto main ; loop
Copy Code Submit an Example
Create Module
A thermistor (and 10k pull down resistor) may be connected to the generic terminal block create module.
Bill of Materials
Description | Code | Qty | |
---|---|---|---|
Miniature disc thermistor | SEN005 | 1 | Buy Now |
10k resistor (pack 100) | RES10K | 1 | Buy Now |
Simulation
Submit Your Own Code!
You must be logged in to submit code examples. Login now.
Share