Está en la página 1de 2

the noise interval. It’s all quite simple, as to the 7805 (IC3). zapping.

zapping. If you can’t find any worthwhile


you can see. use for the second comparator of IC1, it’s
You can also use a relay with normally- a good idea to connect pin 6 to +5 V and
If you do not have a stabilised 5-V supply closed contacts instead of normally-open pin 5 to ground.
voltage available, you can use the circuit contacts. In this case, simply swap the sig-
at the of the schematic diagram (with a 5-V nals on pins 2 and 3 of IC1 so the relay pulls To improve noise immunity, you should
voltage regulator) together with a simple in when an IR signal is received instead of shield the IR sensor so it is not exposed
(unstabilised) AC mains adapter that sup- dropping out. This saves a bit of power directly to light from a fluorescent fixture.
plies a voltage in the range of 9 V to 12 V because the relay is only energised during (080325-1)

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.

Ruud van Steenis The main component in this circuit consists


of a PIC 16F628. In addition to the afore- mentioned 2×16 character LC display, the
This circuit came about because of the dis-
satisfaction regarding the operation of the
thermostat in a refrigerator. When using D1
IC1
1N4001 7805 +5V
the built-in thermostat, it turned out that it
was necessary to reduce the temperature K1 LCD
setting in the summer in order to keep C1 C2
K4
everything cold, compared to the set- 10µ 10µ
ting in winter. This is probably as a result 63V 63V

of a temperature sensor that is mounted +5V


too close to the cooling element, which 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

means that phenomena such as thermal


leaks and the average temperature in the P1
R7
33 Ω

fridge are not sufficiently accounted for in 10k


+5V
the control loop. K2 +5V
D2

While designing the circuit for this elec- 1N4001 R6


tronic thermostat a decision was made K3
C3
10k

to increase the control range so that it T1


R4
100n R3 R2 R1

would also be suitable for other appli- 2k2 14


4k7

4k7

4k7

cations. Potential applications are the BC547 4 6


temperature control of a (living) room, MCLR RB0
7
RB1
heating of a flower box and obviously 17
RA0 IC2 RB2
8

the etching tank! R5 18


RA1 RB3
9
IC3 1 10
4k7

K5 RA2 RB4
3 2 11
RA3 RB5
The control range is adjustable from -25 °C 2 3
RA4 RB6
12

to +75 °C in steps of 0.25 °C. The hysteresis 1 PIC16F628


RB7
13

is also adjustable. Hysteresis is the temper- DS1820 OSC1 OSC2


ature error at which the system will turn on 16 15 5 S1 S2 S3
X1
or off. A very small hysteresis results in a
very stable temperature but has as disad- 4MHz
MODE

vantage that the heating or cooling system


turns on and off at a high rate, which gen- 080090 - 11
erally leads to extra wear and tear in the

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

También podría gustarte