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.

Important:

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

Figure 3: Automatic Temperature Control Flowcode 3D System panel

Flowcode Main Flowchart 

Figure 4: Automatic Temperature Control 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: 

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 5 below.

Automatic Temperature Control Schematic in EAGLE

Figure 5: 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 6: 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:  https://www.pcbway.com/member/brdtogerber.aspx , 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 7: PCBWay online Gerber converter

Manufacture the PCB

In any electronic design, the 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  a China Shenzhen-based manufacturer specializing in PCB prototyping, small-volume production and PCB Assembly.

They offer quick turnaround PCBs at a very budgetary price. You can get 10 PCBs for only $5 and new member’s first order completely free for the $5 bonus.

From PCBWay  home page PCB Instant Quote,you can use the free online quote system to get your price instantly, they have now added more advanced PCB options when you place an order: Standard PCBQuick-turn PCBSMD StencilAssemble, FPC/Rigid-FlexPCB Design.

Figure 8: PCBWay advanced PCB options

They are now running a Full year Sale with up to 30% off for Advanced PCBs (Rogers, HDI and aluminum PCB).

And Extra 25% off for Flex PCB and Flex-rigid PCBs. Turn Time can be from 24 Hours.

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

Automatic Temperature Control Printed Circuit Board with components in 3D

Figure 9: 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: https://www.pcbway.com/project/shareproject/Automatic_Temperature_Control_System_with_PIC_Microcontroller.html

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.

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