Now is the time to build a small project.

Microcontrollers are excellent for controlling simple and not-so-simple processes. MCPs are common on controllers that regulate temperature, pressure, humidity, position, velocity, and more. For that reason, it is very interesting to practice our design skills by building a controller in an STM32 MCP. So let’s do it.

Problem definition

I plan to build a general controller for a general plant. Well… that doesn’t help for designing anything. Let’s make it concrete.

In real life, a controller is necessary to regulate a known process, so it is weird to start by defining a controller for an undefined plant. The world doesn’t work like that. Then, I’ll start by defining a process to control.

The plant

By popular demand, the process to control is the temperature of a small cell incubator with a volume of 500 cm3. The incubator is made of aluminum and has one heating element, a 20 Ω, 25 W resistor. Although the incubator is usually closed, the user can open it at any time. To make it more interesting, I’m going to put an aperture at the bottom with an area of 700 mm2 to allow passive heat flow. The ambient temperature outside the box is 21°C. The inside temperature is measured with a PT100 resistance thermometer. Now you know what I really have in mind ;).

In summary, the input is the voltage applied to the heating element, and the output is the PT100’s resistance, which depends on its internal temperature.

Control strategy

Heat transfer processes are linear, and the plant described above is stable. In addition, we know that there will be a visible delay between applying the action and detecting its effect. Nothing fancy. So, a Proportional-Integral-Derivative (PID) controller is sufficient.

Requirements

Having a better idea of the problem to solve, we can now state the requirements for the controller.

  1. The incubator internal temperature range goes from room temperature to 60°C.
  2. The controller can apply positive heat only. There is no cooling mechanism in the incubator.
  3. The steady state temperature should be reached in a period of 1 minute.
  4. The steady state temperature has a tolerance of 0.5°C.
  5. Over- and undershoots are accepted in a range of 4 times the steady state tolerance (±2°C)
  6. The controller action has to be calculated based on the temperature difference between the inside and outside temperatures of the incubator.
  7. If the temperature reading is lost, the controller sets the action to zero.
  8. The action consists of an analog signal in the range ±10 V.
  9. The controller’s maximum output current is 2.5 A.

Implementation strategy

I’ll build the project following the standard engineering design process:

  1. Conceptual design
  2. Basic engineering
  3. Details engineering
  4. Construction

Each step is treated in a different post.