Automatic Temperature Control System using PIC Microcontroller – Flowcode
Watch the Video Tutorial part 1:
An automatic temperature control system has the ability to monitor and control the temperature of a specified space without human intervention. The primary purpose is to manage the temperature of a given area based on settings by a user of the system.
Figure 1: Automatic Temperature Control Block diagram
This project uses a PIC microcontroller to automatically control the temperature of an area. The PIC18F45k22 is used but almost any PIC with enough input/output pins can also be used.
This area could be a small plant, a house or any place or device that require a controlled temperature like an incubator (egg) for example. Figure 1 shows the block diagram of the system to be designed. The desired temperature setting is entered using a keypad and stored in non volatile memory of PIC, in the EEPROM to keep this settings even during system reset or power OFF.
The temperature of the area is measured using an analog temperature sensor, the LM35 precision integrated-circuit temperature sensor is used for this.
The microcontroller reads the temperature continuously and compares it with the desired value. If the desired value is higher than the measured value, then the heater is turned ON to heat the area. The heater is switched OFF once the desired temperature is reached. If on the other hand the measured value is higher than the desired value, then the fan is switched ON to cool off the area until the required temperature is reached. An LCD display shows the measured temperature continuously.
Figure 2 shows the circuit diagram of the project. The LCD is connected to PORTC. The LM35 precision analog temperature sensor chip is connected to the analog input pin AN0 (RA0). A 3×4 keypad is connected to PORTB. The ‘*‘ key of the keypad is used to access setting menu and the ‘#‘ key is used to ENTER (save) the setting in PIC EEPROM. The heater and the fan are controlled using transistors and relays connected to pins RD0 and RD1 of the microcontroller respectively.
During Startup, the LCD will display: “Automatic Temp Control”, after 2 seconds, if there is no reference temperature set, the program will go in setup mode and prompt the user to enter the reference temperature and save it in PIC EEPROM. But if the reference temperature has already been set, the program will go straight in operation mode displaying the reference temperature and the actual temperature.
Figure 2: Automatic Temperature Control Circuit diagram
Note: In hardware design it’s always a good practice not to leave unused pins floating. You can set them as output and connect them to ground preferably via a pull-down resistor to avoid EM interference. Like the unused RB3 pin can be a good candidate.
The Terminals ratings of the relay should depend on the power of the Heater and the Fan. If you decide to use 220V Heater and Fan, use appropriate relays which can handle that voltage and current. The low voltage DC of the coil should be preferably 5V and with low current for the BC108 transistor to handle, or you can use a different transistor. Please observe the safety precaution as 220V (or 110V if you are living in the USA) is very dangerous, if you have never worked with high voltage before, please seek assistance, don’t attempt to do it on your own.
3D System Panel
Flowcode Main Flowchart
You may be interested: Automatic Temperature Control System with MPLAB XC8 compiler
You may be interested: Automatic Temperature Control System with mikroC Pro for PIC compiler
Watch the Video Tutorial part 2:
Watch the Video Tutorial part 3:
EasyEDA is a a great and above all free web based circuit design, simulation and printed circuit boards (PCB) design tool for electronic hobbyists, engineers, teachers, students, makers and enthusiasts. We’re gonna design our project PCB using EasyEDA. for more information, please read: Getting Started with EasyEDA a web-based PCB Design Software
Below on figure 6 is the Printed Circuit Board with components in 3D
Figure 6: Automatic Temperature Control Printed Circuit Board with components in 3D
You can download the full project files (Flowcode Project, Proteus Schematic design and PCB Gerber files) below here. All the files are zipped, you will need to unzip them (Download a free version of the Winzip utility to unzip files).
Flowcode Project: Automatic Temp Control Flowcode
Proteus Schematic: Automatic Temp Control Flowcode Proteus Schematic
PCB Gerber files: pcb-gerber