Making a thermostat using DS18S20 digital temperature sensor

Joe Blog

New Member
At the moment my project is to make an egg incubator temp controller. I have made the project however, I am not particularly pleased with the accuracy. The inaccuracy is + or - 1 degrees C and I figure that this is due to the fact that my program only reads the digital signal from the sensor to 1 degrees C. Could you suggest a program so that it controls to 0.065 degrees c. I know it uses binary but I am not quite clear how to program it. I am using an 08m2 chip at the moment but will upgrade.

init:
low 0 ' outputs off
low 1
main:
readtemp 4,b1 ' read temperature
if b1 < 34 then prog0
if b1 > 34 and b1 < 35 then prog1
if b1 > 35 and b1 < 36 then prog2
if b1 > 36 and b1 < 37 then prog3
if b1 > 37 and b1 < 38 then prog4
if b1 > 38 and b1 < 39 then prog5
if b1 > 39 then prog6
if b1 > 40 then prog7
goto init ' ok so switch everything off

prog0:
high 0
goto main

prog1:
high 0
wait 25
low 0
wait 5
goto main

prog2:
high 0
wait 20
low 0
wait 10
goto main

prog3:
high 0
wait 17
low 0
wait 12
goto main

prog4:
high 0
wait 15
low 0
wait 15
goto main

prog5:
high 0
wait 7
low 0
wait 22
goto main

prog6:
low 0
goto main

Prog7:
sound 2, (50,50)
 
Top