Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Universal Thermostat
compressor (cooling) or pump (heating).
The hysteresis can be adjusted from 0.1 °C
(very stable temperature) to 10 °C (practi-
cally no control at all...) in steps of 0.1 °C.
The settings can be changed with 3 push
buttons and the information is displayed
on a 2×16 character LCD. The settings are
stored in the EEPROM inside the PIC. Dur-
ing normal operation the LCD is used to
display the actual temperature.
4k7
4k7
K5 RA2 RB4
3 2 11
RA3 RB5
The control range is adjustable from -25 °C 2 3
RA4 RB6
12
82 elektor - 7-8/2008
R7 C2
X1
IC2 C3 C1
K3 P1 IC1
T1
K1
D2 D1
R5 R1 K5 R6 R2 R3 R4
K4
K2
S1 S2 S3
temperature sensor, type DS1820, also based on the rated coil voltage of the relay
serves an important role in the circuit (con- that is used, 12 V, for example. COMPONENTS LIST
nected to K5). Fortunately the DS1820 is Keep in mind that when using this circuit to
already factory calibrated, so this saves us replace the thermostat in a fridge, the com- Resistors
R1,R2,R3,R5 = 4kΩ7
from a difficult task. A classic 7805-regula- pressor motor which is to be controlled is R4 = 2kΩ2
tor and a common transistor pretty much directly connected to the mains and a safe R6 = 10kΩ
complete the circuit. The clock source for implementation of the complete circuit R7 = 33Ω
the PIC is supplied by a 4 MHz ceramic reso- is therefore absolutely essential. P1 = 10kΩ preset
nator with built-in capacitors (Conrad Elec- Capacitor
tronics order number 726406/726507). If this circuit is used to heat, for example, a C1,C2 = 10µF 63V
There are two switching outputs from flower box, it can be useful to replace the C3 = 100nF
the PIC, one for cooling applications and switching transistor with a HEXFET. A pro-
Semiconductors
another one when heating is called for. totype circuit with an IRFP3710, supplied D1,D2 = 1N4001
When cooling, the refrigeration system a 12-V heating element with 1.5 A without T1 = BC547
obviously has to be turned on when the any trouble at all, while the losses where IC1 = 7805
IC2 = PIC16F628-04/P (programmed, with
temperature is too high, while when heat- so small that no heatsink was required. software # 080090-11)
ing, the appropriate action needs to be The 5-V output voltage from the PIC was
taken when the temperature threatens in this case sufficient to turn the FET on Miscellaneous
to become too low. A jumper in this cir- properly. X1 = 4MHz ceramic resonator
S1...S3 = miniature push button
cuit makes the selection between cooling K1,K2 = 2-way pinheader
(jumper 2-3 on K3) and heating (jumper 1-2 The program in the 16F628 fills only about K3,K5 = 3-way pinheader
on K3) possible. half of the available program memory K4 = 16-way pinheader
When the circuit is turned on, the display space. Because there was no compelling DS1820 and 3-way ribbon cable
LCD with 2x16 characters
shows ‘ temperature’ with underneath that need to program the whole thing in a par- PCB #080090-1 from www.thepcbshop.com
the actual temperature in degrees Cel- ticularly ‘compact’ way, the PicBasic Pro
sius. If the sensor is not connected then an compiler was used for generating the hex
error message will be displayed. By holding file for the PIC.
down the ‘Mode’ button until an asterisk Both the source file (1820THER.BAS) as well cable is connected to the DS1820, you
appears, the text ‘set temperature’ appears as the hex file to be programmed into the can cover the sensor entirely with a thin
and you can set the desired temperature 16F628 (1820THER.HEX) are available free layer of two-part epoxy glue and (before
in steps with the + and - buttons. By press- from the Elektor website as file number the glue has set) shrink a small length of
ing the Mode-button again it is possible to 080090-11.zip. heatshrink tubing around it. This gives a
set the desired hysteresis with the + and The source code is liberally commented, good, waterproof seal.
– buttons. so that making changes (changing the
A hysteresis of 1 °C means that with a tem- temperature range, for example) is quite Alternatively you can buy a ready-made
perature setpoint of 20 °C and when heat- straightforward. waterproof DS1820 sensor (for example
ing, the output becomes active when the The temperature is initially set to 20 °C and Conrad Electronics # 184037/184052).
temperature drops below 19 °C (20–1), the hysteresis to 2 °C. These have, however, a type of telephone
while everything turns off when the tem- cable that is somewhat thicker than the rib-
perature reaches 21 °C (20+1). For the sensor it is best if you use a ‘plain’ bon cable.
To connect the circuit to external equip- DS1820 and fit it with a length of 3-way (080090-I)
ment a relay control (via K2) was chosen ribbon cable. When using it with a refrig- Downloads
because of safety considerations. The erator this has the advantage that the The source- and hex-code for this project, 080090-
transistor can easily handle currents up to sensor cable can be easily routed to the 11.zip, as well as the layout for the PCB (080090-1.zip)
100 mA and a free-wheeling diode sup- outside because the rubber seal on the are available as a free download from the Elektor
presses the back-emf from the relay coil. fridge door still closes sufficiently well to website.
The power supply voltage can be selected seal around the cable. Once the ribbon
7-8/2008 - elektor 83