Discussion Forum


Tips and Tricks


Circuit Cookbook


Electronics Reference


Links




This page is under heavy construction, but should be available soon... Meanwhile, feel free to download Netscape Communicator 4.5 (Or later), which is the web browser I recommend for viewing this site when it will be ready.

Download Netscape!

Digital Thermometer





The following circuit will use the Basic Stamp to read a thermistor R1 ( 271-110 at Radio Shack), convert the signal that it will send serially to an 74HCT164 shift register, which in turn, will convert it to a signal the 7-segment LED display will use to display the temperature.


The program listed displays the temperature in degrees Celsius, but it is easily arranged to get it to display in degrees Farenheit (by eliminating the conversion from °F to °C).
This circuit was built to test the capabilities of the 74HCT164 8-bit serial-in/parallel-out shift register and to familiarize myself to the Shiftout command of the basic Stamp 2.
Using only another shift-register, it would probably be possible to drive 8 displays using only two other lines (by driving the Ground line of the LED display high or low) but I have not tried this, as it would be easier to use the MAX7219 chip, which uses only two Stamp lines to do the same job...
(Notice the pinout of the display, it is CBADEFG... I made a mistake doing the connection and did no feel like reprogramming everything)
The program is pretty long and clumbsy, but it works...

dataP con 1
Clock con 2
therm con 0

check_temp:
high therm 'discharge capacitor
pause 100
RCTIME therm,1,W0 'read thermistor
W0=W0+10 'adjust the reading
W0=W0/7
W1=W0*W0/25*3/50
w0=w0*255/2125+W0
W0=162+W1-W0
W1=W0-32 'convert into celcius
W0=W1*5/9
pause 1000 'pause before next reading
gosub displaytemp
goto check_temp
end

dispdeg:
W0=10
Gosub displayW0
pause 300
W0=11
gosub displayW0
pause 300
goto check_temp

displaytemp:
if W0<10 then under10
if W0<20 then under20
if W0<30 then under30
if W0<40 then under40
if W0<50 then under50
goto check_temp

under10:
gosub displayW0
pause 500
goto dispdeg

under20:
W3=W0
W0=1
gosub displayW0
pause 300
W0=12
gosub displayW0
pause 50
W0=W3
W0=W0-10
gosub displayW0
pause 500
goto dispdeg

under30:
W3=W0
W0=2
gosub displayW0
pause 300
W0=12
gosub displayW0
pause 50
W0=W3
W0=W0-20
gosub displayW0
pause 500
goto dispdeg

under40:
W3=W0
W0=3
gosub displayW0
pause 300
W0=12
gosub displayW0
pause 50
W0=W3
W0=W0-30
gosub displayW0
pause 500
goto dispdeg

under50:
W3=W0
W0=4
gosub displayW0
pause 300
W0=12
gosub displayW0
pause 50
W0=W3
W0=W0-40
gosub displayW0
pause 500
goto dispdeg

displayW0:
lookup W0,[%00111111, 3, %01011110, %01001111, %01100011, %01101101,%01111101, %00000111, %01111111, %01101111, %01100110, %00111100, 0],W2
' 0 1 2 3 4 5 6 7 8 9 degree C clear
shiftout Datap,clock,msbfirst,[W2]
return


Martin-Luc Girard

Any comments? E-Mail the Webmaster