PH415 Computer Interfacing 2013
OSU logo
Temperature Controller

Table of Contents

Temperature Regulator v2

Time for revision 2 of the temperature controller. This time we will construct one using an I2C digital temp sensor, a BJT transistor, and the ChipKit Max32 board. Though using a microcontroller for a temperature controller may be a more expensive option, it provides much more control over the system. A few advantages of using the microcontroller are: more precise control over the temperature, less wasted energy from turning a heater fully on and off, and easy adaptation to systems requiring similar controls. For this task we will be implementing a proportional controller to send a Pulse Width Modulated (PWM) signal to the transistor to control the temperature.

Proportional Control

A proportional controller is a simple linear feedback system. This controller finds the difference between a process variable (in our case the temperature) and a set point (the desired temperature). This difference can be multiplied by a gain factor to scale the output for your system. This control system is not perfect on its own. The proportional controller output will drop to zero before the system reaches the desired value. In order to get the system to stop at the set point an offset variable must be introduced. The proportional controller is just a piece of a more complicated controller called a Proportional Integral Differential (PID) Controller..

Pulse Width Modulation

Pulse Width Modulation (PWM) is a method of controlling average power with a digital signal. A PWM signal typically has a set frequency at which square wave pulses are sent out at specific length. The length of the pulses is called the duty cycle. If measuring the duty in percentage, a 50% duty cycle would be a pulse that is high half of the time and allowed low for the rest of the time. If you look at the two extremes, 100% duty cycle means that the signal will always be high and 0% will be low all the time. For more information on PWM check out wikipedia's article

Task

  • Design a circuit containing the temperature sensor, a power transistor, a 1 watt resistor, and the microcontroller. Configure the circuit so the power transistor will provide current to the resistor. The temperature sensor should be in contact with the resistor to get the most accurate temperature reading possible. The microcontroller will read temperature and turn the power transistor on and off.
  • Use a class to implement the behavior of the controller, a piece of skeleton code is available Here. Use a proportional controler to determine a duty cycle of a PWM signal to apply to the transistor. It would be a good idea to outline the functionality of your code before doing any implementation.
  • Test the code's ability to maintain a predetermined temperature (Stay below 50C), and tweak it as necessary. If you get a proportional controller working well you may want to try implementing a PI, PD, or PID controller if you have time.