You are on page 1of 6

AUTOMATIC TEMPERATURE CONTROL

Introduction:
The scope of the project is to regulate the temperature of a room by using PICAXE 18 M2
microcontroller to control the operation of a fan (motor).
A thermistor (potentiometer for demonstration) will provide the actual (ambient) temperature
input to the microcontroller. The set point (desired temperature) is provided by a control knob
again using potentiometer for demonstration.
The microcontroller reads from its two ADC inputs (actual and set temperature), process the
raw data, compare and consequently turn the motor on or off, using PWM technique.
The complete project requires the use of a thermistor and fan arrangement. However, for
demonstration purposes, instead of a thermistor, potentiometer is used, as mentioned before.

Objectives:
The main objectives of this project are as follows
To turn on the fan motor when actual (ambient) temperature of the room is greater
than the set temperature (point).
To control the operation of the fan motor by calculation according to the difference
between actual temperature and set temperature. The technique used for the same is
PWM.
To indicate when the set temperature is reached and consequently the fan (motor) is
off.
Equipment Used:
PICAXE Micro controller (PICAXE 18M2):
Picaxe microcontroller is one of the most popular microcontroller used in wide variety
of application because of the compact size and low cost. The micro controller has 16
inputs / outputs as explained in figure below.2

Pin Configuration1

Darlington Array:
Darlington array (ULN2803) is connected to the output of the microcontroller to drive
the load and hence isolates the load from the microcontroller.
N-Channel MOSFET:
The fan (motor) is connected as shown below to the MOSFET and its operation is
controlled by the PWM output from the microcontroller.

Potentiometer x 2 (actual & set temperature):


Since the use of a thermistor for sensing the actual (ambient) temperature was not
practical for demonstration purpose therefore a potentiometer is used in the same
capacity. The second potentiometer is used to set the desired temperature i.e. the set
temperature (point).
LED Indicator:
An LED is used to indicate when the set temperature is reached and consequently the
fan (motor) is off.

PICAXE Editor 6:
The coding was done using the Picaxe Editor 6. The platform also provided the
opportunity to simulate the code first and also see the outputs and inputs using the
debug function in the coding.

Inputs & Outputs:


Inputs
Actual Temperature (POT 1)
Set Temperature (POT 2)
Outputs
PWM output to motor via MOSFET
LED indication.

Programing:
The program consist of three main parts
Defining & Initialising Variables
Main
o Reading from ADCs (POT1 & POT2)
o Comparing Inputs (Actual & Set Temperature)
o Turning PWM off when Set Temperature is reached or there is no difference
between the two temperatures.
o Indicator LED on / off
Transfer Function (Ramping)
o Calculating Response: Scaling the input and calculation the output for the
PWM.
o PWM Output to the output pin.

The flow/structure of the program is demonstrated in the figure below.

Program Sequence

Program Code:

Problems
Shortage of fuses
Fried MOSFETS
PWM out Frequency

Recommendations
Reverse cycle i.e. direction control
Upper and lower speed indications
Emergency Stop Switch
Fail Safe Operation
References:
1. Picaxe Manual 1
2. http://www.picaxe.com/Hardware/PICAXE-Chips/PICAXE-18M2-microcontroller/
3. https://teachmetomake.files.wordpress.com/2011/05/fetswitch.jpg

You might also like