Arduino Temperature Controller

Digital Temperature Controller using arduino, here we are using arduino as main controller, this temperature controller controls the temperature of any heating device with given set points, It also displays state of the device either on or off and current temperature.

As the name implies, a temperature controller is an instrument used to control temperature. The temperature controller takes an input from a temperature sensor and has an output that is connected to a control element such as a heater or fan.

To accurately control process temperature without extensive operator involvement, a temperature control system relies upon a controller, which accepts a temperature sensor such as a thermocouple or RTD and LM35 as input. It compares the actual temperature to the desired control temperature, or set-point, and provides an output to a control element.

What Are the Different Types of Controllers, and How Do They Work?

There are three basic types of controllers: on-off, proportional and PID. Depending upon the system to be controlled, the operator will be able to use one type or another to control the process. In this Arduino example we are making on-off type controller.

On/Off Control

An on-off controller is the simplest form of temperature control device. The output from the device is either on or off, with no middle state. An on-off controller will switch the output only when the temperature crosses the set-point. For heating control, the output is on when the temperature is below the set-point, and off above set-point. Since the temperature crosses the set-point to change the output state, the process temperature will be cycling continually, going from below set-point to above, and back below. In cases where this cycling occurs rapidly, and to prevent damage to relays and valves, an on-off differential, or “hysteresis,” is added to the controller operations. This differential requires that the temperature exceed set-point by a certain amount before the output will turn off or on again. On-off differential prevents the output from “chattering” or making fast, continual switches if the cycling above and below the set-point occurs very rapidly. On-off control is usually used where a precise control is not necessary, in systems which cannot handle having the energy turned on and off frequently, where the mass of the system is so great that temperatures change extremely slowly, or for a temperature alarm. One special type of on-off control used for alarm is a limit controller. This controller uses a latching relay, which must be manually reset, and is used to shut down a process when a certain temperature is reached.

Proportional Control

Proportional controls are designed to eliminate the cycling associated with on-off control. A proportional controller decreases the average power supplied to the heater as the temperature approaches set-point. This has the effect of slowing down the heater so that it will not overshoot the set-point, but will approach the set-point and maintain a stable temperature. This proportioning action can be accomplished by turning the output on and off for short time intervals. This “time proportioning” varies the ratio of “on” time to “off” time to control the temperature. The proportioning action occurs within a “proportional band” around the set-point temperature. Outside this band, the controller functions as an on-off unit, with the output either fully on (below the band) or fully off (above the band). However, within the band, the output is turned on and off in the ratio of the measurement difference from the set-point. At the set-point (the midpoint of the proportional band), the output on:off ratio is 1:1; that is, the on-time and off-time are equal. if the temperature is further from the set-point, the on- and off-times vary in proportion to the temperature difference. If the temperature is below setpoint, the output will be on longer; if the temperature is too high, the output will be off longer.

PID Control

The third controller type provides proportional with integral and derivative control, or PID. This controller combines proportional control with two additional adjustments, which helps the unit automatically compensate for changes in the system. These adjustments, integral and derivative, are expressed in time-based units; they are also referred to by their reciprocals, RESET and RATE, respectively. The proportional, integral and derivative terms must be individually adjusted or “tuned” to a particular system using trial and error. It provides the most accurate and stable control of the three controller types, and is best used in systems which have a relatively small mass, those which react quickly to changes in the energy added to the process. It is recommended in systems where the load changes often and the controller is expected to compensate automatically due to frequent changes in set-point, the amount of energy available, or the mass to be controlled

What you will learn?
  1. How to connect keys and LCD to arduino?
  2. How to take key input?
  3. How to Read Temperature sensor LM35?
  4. Controlling device as per set point.
Components Required
  1. Arduino Uno
  2. 16×2 LCD Display
  3. keys
  4. Relay
  5. 1K Resistors Qty. 3
  6. BC548
  7. LEDs
  8. LM35 Temperature Sensor

Arduino Temperature Controller Circuit

Circuit is constructed using Arduino Uno and LM35 temperature sensor and other components. We are using 16×2 LCD to display current temperature and set points. LM35 gives analog output proportional to the temperature which is given to Arduino analog input A0. Which is then compared with set points if it is more than set point, It means the temperature is more so we turn off the heating element such as heater which is connected to relay output. If temperature is less we turn on the relay (heater). We are displaying status of heater on off on the LED and LCD also. Two tactile switches are used to set the temperature set point.

Arduino Temperature Controller Circuits
Temperature Controller Circuits

Temperature Controller Arduino Code

                Program is constructed using one library “LiquidCrystal”. Program have different modules, Setup, Loop. In setup we initialize all the IO connections and LCD, Keypad. In main loop we are taking set point inputs and constantly measure current temperature and compare it with set points. If it is more than set point turn off heater, else turn on heater. You can add some hysteresis.

Conclusion

This code demonstrates how to construct digital temperature controller using arduino.

We have used combination of LCD and Temperature sensor LM35 to make simple temperature controller using Arduino. Apply temperature to LM35 sensor more than set point  it will turn on the relay (Heater). if it is less it will turn off the relay.

9 thoughts on “Arduino Temperature Controller

  1. Hi!
    If we use a LCD shield with the tipical buttons… is possible to use the buttons for change the setpoint? Something like:

    int x;
    x = analogRead (0);
    if (x 0)
    {
    SetPoint–;
    }
    }
    else if (x < 200) {
    {
    if(SetPoint<150)
    {
    SetPoint++;
    }
    }

    Thanks!
    Alex.

    1. Here is the hysteresis code

      //Check Temperature is in limit
      if((Temperature -5)> SetPoint)
      {
      digitalWrite(RELAY,LOW); //Turn off heater
      digitalWrite(LED_RED,LOW);
      digitalWrite(LED_GREEN,HIGH); //Turn on Green LED
      }
      if((Temperature +5)< SetPoint) { digitalWrite(RELAY,HIGH); //Turn on heater digitalWrite(LED_GREEN,LOW); digitalWrite(LED_RED,HIGH); //Turn on RED LED }

Leave a Reply