PID Controlled Temperature

Keywords: C, PIC

During my exchange to UPV (Polytechnic University of Valencia) I decided to learn how to implement a PID controller in C. I did this by making a simple temperature controller project using a PIC18f4520, simulated in Proteus ISIS 7 Professional.

The project shows two identical temperature controllers, both connected to a seven segment display to show the current temperature. The simulation starts at 20°C, with a desired temperature at 50°C. The temperature controllers consists of two heaters which can either be ON or OFF. The left one is turned ON when the temperature is < 50°C and turned OFF when the temperature is > 50°C. The right one is controlled by a PID with a PWM signal as output, running on 2 Hz.

The video will show that the left one reaches and exceeds the desired temperature, while the right, PID controlled heater will reach 50°C and stay put.

The source code can be found on GitHub here.

Demo on YouTube:

Write a Comment