Watch the Video Tutorial part 1:

Automatic Temperature Control Using PIC Microcontroller 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.

Automatic Temperature Control Block Diagram

Figure 1: Automatic Temperature Control Block diagram

This project uses a PIC microcontroller to automatically control the temperature of an area. 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. 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. If the temperature reaches a certain critical value 40⁰C or higher, the buzzer will sound continuously and an LED will blink until the temperature deceases below 40⁰C.

An LCD display shows the measured temperature continuously.

This project is complete and can be used as a base for Final Year Project For Engineering Students.

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 clear the value entered during the temperature setup and the ‘#‘ key is used to ENTER (save) the setting to PIC internal EEPROM. The heater and the fan are controlled using transistors and relays connected to pins RD0 and RD1 of the microcontroller respectively.

When the device starts, it reads the Reference Temperature from PIC internal EEPROM, if there is no value saved, it will prompt the user to enter a new Reference Temperature and save it to PIC internal EEPROM. In operation you can press and hold the ‘*‘ for 3 seconds to access the setup menu again if you need to set a new reference temperature.

Automatic Temperature Control Circuit diagram

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.

MikroC Source Code

You may be interested: Automatic Temperature Control System with MPLAB XC8 compiler

Watch the Video Tutorial part 2: 

Watch the Video Tutorial part 3: 

Schematic design Using EAGLE

Any PCB Schematic design software can be used. In this project we used EAGLE due to its simplicity and free (the free version has some limitations but for simple 2 layer boards like this one, those limitations won’t affect us). 

PCB design in EAGLE is a two-step process. First we’re gonna design the schematic, then lay out the board based on the schematic.

Start with a new EAGLE Project. In the control panel, under the “Projects” tree, right click on the directory where you want to save your project, we prefer to use the default EAGLE directory. Select “New Project”. Give it a meaningful name.

To add a schematic to a project folder, right-click your project folder, hover over “New” and select “Schematic”. Add the parts using the the ADD Tool and design a schematic like the one on figure 3 below.

Automatic Temperature Control Schematic in EAGLE

Figure 3: Automatic Temperature Control Schematic in EAGLE

Board Layout Using EAGLE

From the schematic editor click the Generate/Switch to Board command in the toolbar or Switch to Board under the File menu. This will prompt to create a new board based on the schematic when switching to board from the first time. All of the parts you added from the schematic should be there, stacked on top of each other, ready to be placed and routed.

Place all the parts using the MOVE tool on the blank board and route all the airwires. The board is small can be easily routed manually using the ROUTE tool.

Automatic Temperature Control Board Layout in EAGLE

Figure 4: Automatic Temperature Control Board Layout in EAGLE

We routed all the traces on Top layer (Red colour) and created a ground plane on the Bottom layer (Blue colour) by adding a Copper Pour using the POLYGON tool. add some Text on Top and Bottom Silk layers.

Generating The Gerber Files

Now we have reached the final stage of the PCB design, it’s time to generate the Gerber files that we can send to our manufacturing house to build our boards.
Gerber files contain the data about the PCB, where traces, pads, holes are placed, their width and so on. You can generate Gerber files in Eagle by clicking on the CAM processor icon on the toolbar. But there is another easier way to generate Gerber files online from an Eagle board file from PCBWay, the company we use to manufacture our Printed Circuit Boards. Just upload your Eagle board file *.brd to this link: , their online converter supports Eagle boards from 1 to 10 layers. These are the three easy steps you need to follow:

  1. Click on the Browse for files button to upload your EAGLE board (.brd) file.
  2. Click the Run the conversion button to generate Gerber files from your board. There is also a Gerber viewer, this will give you one last chance to analyse your PCB to make sure that everything is correct before you send it to your manufacturing house.
  3. Click on the Download Gerber button to download your Gerber files in a zipped format. The figure 5 below illustrates PCBWay, online Gerber converter.

PCBWay online Gerber converter

Figure 5: PCBWay online Gerber converter

Manufacture the PCB

In any electronic design, the Printed Circuit Board or PCB is one of the most crucial parts with its quality affecting the overall quality of all these devices. For rapid prototyping or for commercial products it’s always a must to use specialized reputable PCB manufacturer instead of doing it yourself.

There are many PCB manufacturing companies in the world that can make you good quality boards, but to find a company that can produce cheap boards of high quality on small order because the first batch of any project will likely be of small quantity and only after you have tested successfully everything and you are happy it performs all its functions as required then you can order boards at high quantity at much small unit cost. You’ll need to select a company specializing in prototype PCB. One of them that we used is called: PCBWay

PCBWay Home page

Figure 6: PCBWay Home page is a China Shenzhen-based manufacturer specializing in PCB prototyping, small-volume production and PCB Assembly service all under one roof with more than a decade experience. They offer quick turnaround PCBs at a very budgetary price. Thousand of engineers, students and hobbyists are using their PCBs for their daily work and study. You can get 10 PCBs for only $5. If you are an Engineering Student or an Educator, you can get your PCB for free from PCBWay with their Students Projects Sponsorship program. For more information on Sponsorship program please click here:

From PCBWay  home page: ,you can use the free online quote system to get your price instantly and immediately after you input a few parameters online. You’ll need first to create an account with them for free by clicking on the “Join” on top right corner as shown on figure 6 above.

Below on figure 7 is the Printed Circuit Board with components in 3D

Automatic Temperature Control Printed Circuit Board with components in 3D

Figure 7: Automatic Temperature Control Printed Circuit Board with components in 3D

You can download the Gerber files of this project for free or you can simply order the PCB of this project from this link:

Each time a person orders this PCB, we will get 10% commission of the total PCB cost. That’s how you can also support us for more tutorials.

Watch the Video Tutorial part 4:

You can also download the full project files (MikroC source code and Proteus Schematic design ) below here.
All the files are zipped, you will need to unzip them (Download a free version of the Winzip utility to unzip files).

MikroC Source Code: Automatic Temp Control mikroC Project

Proteus Schematic: Automatic Temp Control mikroC Proteus Schematic