If you want to keep something at a certain temperature, say a block of aluminum, you’ll need a thermocouple and some sort of heating element. While you could turn a heater on and off abruptly in a sequence appropriately known as “bang-bang,” a more refined method can be used called PID, or proportional-integral-derivative control. This takes into account how much the temperature is outside of a threshold, and also how it’s changing over time.
As shown in this example by Electronoobs, PID control can be accomplished using an Arduino Uno, along with a type K thermocouple and a MAX6675 module for sensing. The Arduino sketch reads the data and sends the proper amount power to a heating element via a MOSFET in order to maintain the desired temperature without excessive oscillations.
What I want, is the aluminum block below to have let’s say, exactly 100 degrees. I’ll control the real temperature using a K type thermocouple. To read the data I’ll use the MAX6675 breakout module and control the PID algorithm with and Arduino. Finally, to apply power we will make a small circuit using a MOSFET or maybe a TRIAC in case of high AC voltages. This will be a close loop. The thermocouple measures the real values, the Arduino creates the signal applied to the MOSFET and this transistor will control the power of a heating element inside of the aluminum block and once again the thermocouple will measure the value, that’s why it’s a close loop.
Be sure to check it out for an introduction to this powerful control scheme!