peltier fridge thermostat

yamato96

New Member
built a controller for a peltier minifrigobar, hacked the original circuit between the power supply and the original thermostat.

the goal is to adapt the frigobar to a incubator to a steady 34ºC

Used a picaxe 18 high power board with a picaxe 18x as the controller. a bit overkill for now but usefull later on other brainstorms.

Ds18b20 on input C.0

optocoupler output on out B.0

sertxd to monitor the shabang.

the code:::::::: well in this matter im very basic BASIC, but with the command readtemp i can do the job easaly, but with readtemp12 im having some troubles in defining w1 value to trigger output B.0

Went to code snipets forum page and pasted the code to PE, but in the sentence "if w1<xxxxxx then heat_on", im confusing bcd to ascci and binary to decimal and 12bit to temperature , just simply to define value of w1 and some correlation to 34 degrees celsius. any help apreciated. thanks 4 ur time.

==================================================================================

Code:

init:


low b.0
pause 50


main:




readtemp12 0,w1


if w1<21250 then heat_on


low b.0


goto convert


convert:


let b9 =43 'Display + (43) space (32)
IF W1 > 64655 THEN ' info - 55 degrees = 64656
let b9 =45 'Display - (45)
W1 = - W1 ' info if - ie w1=1000 display - 10.00 C
ENDIF
W1 = W1 * 25 / 4 ' info + ie w1=8500 display 85.00 C

BINTOASCII w1,b8,b7,b6,b5,b4
IF b8 = "0" THEN : b8 = " " :ENDIF ' zero blanking b8
IF b8 = " " AND b7 = "0" THEN : b7 = " " :ENDIF ' zero blanking b7

SERTXD (CR, LF, "Temperature ",b9,b8,b7,b6,".",b5,b4," Degrees C", CR, LF) 'resolution to 0.06


goto main


heat_on:


high b.0


pause 1000


goto convert

===============================================================================

thanks 4 ur time.
 

BeanieBots

Moderator
Not sure exactly what your code is trying to do but ReadTemp12 returns a value which is 16 times greater than the actual temp in degC.
Don't forget to use a word varable!

ReadTemp12 pin,wordVar
WordVar*10/16 will return a value of 340 when the temp is 34.0C
You can then use BINTOASCII to convert to digits and slip in a "." in the right place to display it.
 

yamato96

New Member
the goal is when the temperature inside the frigobar is lower than 35ºC, turn the peltier on for heating. the sertxd is simply to debug in terminal. The code is pasted from code snipets forum area related to ds18b20.

wrote a simpler code to try correlate 12bit with 8bit values in terminal and gave me the value of ~566 - 35ºC.


================================================================

init:

low b.0
pause 5000

main:




readtemp12 0,w2
pause 750
readtemp 0,b0
pause 750
sertxd (#w2,13,10)
sertxd (#b0,13,10)
if w2<566 then heat_on
low b.0

goto main

heat_on:
high b.0
pause 1000
goto main
 

SAborn

Senior Member
If all you want is 34C then why use readtemp12 at all, just use readtemp as this will return just the full degree value.

Depending on your driver circuit you could use PWM to control the temp by adjusting the power to the heater.
 

hippy

Ex-Staff (retired)
If all you want is 34C then why use readtemp12 at all, just use readtemp as this will return just the full degree value.
It's a fair point and worth doing that while developing a program, getting it to work how that's wanted even if not perfect. Move on to more complicated stuff when it is working.

READTEMP12 does give better resolution and that's handy if adding hysteresis which is desirable for any maintain a constant temp application. For 34.0C heating can switch on at or below 33.9C and off at 34.1C or above for example which would hopefully be more stable than with a whole degree heating and cooling.
 

yamato96

New Member
Thank u all 4 ur input. Il have to study and read more, cause already forgot alot of stuff

Here is the finished code (4 now).
===========================================================
init:


low b.0
pause 50


main:




readtemp 0,b13


pause 50


if b13<34 then heat_on


low b.0


goto convert


convert:


readtemp12 0,w1
pause 50
let b9 =43 'Display + (43) space (32)
IF W1 > 64655 THEN ' info - 55 degrees = 64656
let b9 =45 'Display - (45)
W1 = - W1 ' info if - ie w1=1000 display - 10.00 C
ENDIF
W1 = W1 * 25 / 4 ' info + ie w1=8500 display 85.00 C

BINTOASCII w1,b8,b7,b6,b5,b4
IF b8 = "0" THEN : b8 = " " :ENDIF ' zero blanking b8
IF b8 = " " AND b7 = "0" THEN : b7 = " " :ENDIF ' zero blanking b7

SERTXD (CR, LF, "Temp ",b9,b8,b7,b6,".",b5,b4," ºC", CR, LF)'resolution to 0.06


goto main


heat_on:


high b.0


pause 1000


goto convert

===========================================================

The output values are: Lowest value - 33,93 ºC Max.value - 34,06 ºC. I think my queen honeybees will love it. :)
 
Top