Step by Step Procedure of Develop a Microcontroller Projects

I am sure the term ‘Microcontroller’ must be familiar to you. It is a single chip which contains the processor, the memory along with the input/output pins embedded inside it. We often use microcontrollers for embedded applications, as a controller to control any actuators such as motors or displays.
I am sure there must be many of you, who would love to build your own embedded system or let me say a simple project using a microcontroller. Now for this, you need to have a basic idea about each step required to develop a microcontroller based project. So here I am explaining the basic steps to build a microcontroller based project.
But before that, let us get an idea about the project we would like to design and the theory behind it.

Aim of the project

To design a LED flash light system using Microcontroller

Theory

The LED flash light system can produce the light through light emitting diode. The incandescent lights used in traditional flash light consume more energy and have very less life time. The LED lights on the other hand, consume less energy and have long life.

Basic Idea Behind the Design

The microcontroller generates the output logic pulses so that the LED light is switched ON and OFF at certain intervals. It is a 40 pin microcontroller. The Crystal interfaced to input pins of the microcontroller provides  accurate clock signals at the crystal frequency.

Steps in developing the project

Step1: Circuit Designing

The 8051 microcontroller crystal operates at 11.0592 MHz frequencies because it can give exact clock pulses for data synchronizing. Two capacitors are connected to the crystal oscillator with range of 20pf to 40pf which is used to stabilize the clock signals. The 8051 microcontroller at some times goes to block state or missing time calculation.
At that time we need to reset the microcontroller. When the microcontroller is reset, it takes maximum 3sec time delay with the help of the 10k resistor and 10uf capacitor.

Circuit Components:

Hardware Components:
  • Yellow LED
  • Crystal
  • Reset
  • 8051 microcontroller
  • Capacitors
  • Resistors
Software Components:
  • Keil compiler
  • Proteus software
  • Embedded C language
Circuit Connections
The 5v DC supply is given to the 40 pin of the microcontroller which  drives  the circuit. The crystal  is connected to the 18 and 19 pin of the microcontroller. The reset circuit is interfaced at 9 pin of the microcontroller. The Yellow LED is connected to the pin P0.2 of the microcontroller.

Step 2: Microcontroller Program Coding

  • First open the Kiel uVison2 software. This shows the menu bar with file, edit, view, project and tools option.
  • Select the project option and select the ‘new project option’ from the drop down menu. Give a name to the project and click on ‘save’ button to save the project. A folder named ‘target’ is created.
  • Select a microcontroller for your project. Here I am selecting ‘Atmel’. Select the exact type of Atmel microcontroller from the drop down menu. Here 89C51 microcontroller is selected. A folder with the name ‘source group’ is created in the ‘target’ folder.
  • Click on the ‘File’ menu on the menu bar. Select ‘new file’ from the drop down menu.
Kiel Window
Kiel Window
  • Write the code on the blank space.
The LED Flash Light program:
#include
sbit LED= P0^2;
void delay( unsigned int a);
void main()
{   LED=0;
While (1)
{ LED=0;
delay(600);
LED=1;
delay(600);
}
}
void delay (unsigned int b)
{   unsigned int k;
for(k=0;k}
  • Save this code with ‘.C’ extension.
  • Right click on the ‘source group’ folder icon and select ‘add files to group’ option.
  • A window appears. Select the ‘C’ file to be added.
  • Select the ‘debug’ menu. It checks the program for any errors.
  • Right click on the ‘target’ folder icon.
  • Select the ‘option for Target’ option.
  • A target window opens with a menu bar. Click on the ‘Target’ menu.
  • Set the crystal frequency for the microcontroller.
  • Click on the ‘Output’ menu. A window appears
  • Click on the ‘create hex file’ button. A hex file is created.

Step 3: Circuit Drawing

This is circuit is designed with help of Proteus software. It is circuit design software which contains a database of components which we can use to build the circuit. Each and every component is available in the components library.
Proteus window using the circuit
Proteus window using the circuit
  • Open the Proteus software. A window with a menu bar appears.
  • Click on the file menu.
  • Select ‘new design’ from the drop down menu.
  • Click on the library menu.
  • Select ‘pick devices/symbol’ from the drop down menu.
  • Select the relevant comment by double clicking on it, so that the component appears on the window.
  • Add all the components and draw the circuit with proper connections.
Circuit Diagram
Circuit Diagram

Step 4: Code Dumping

Loading the code to the microcontroller is called dumping. The microcontrollers understand only binary language. So we need to load the hex code into the microcontroller. There are lots of softwares available in the market for loading the code to the microcontroller. Here I am using ‘Willer’ programmer software to dump the code to the 8051 microcontroller. The programmer kit comes with software along with the hardware kit.
This software needs to be installed onto the computer. The hardware kit comes with a socket, on which the microcontroller is placed. Here are the steps to load the code onto the microcontroller.
Willer Programmer hardware kit
Willer Programmer hardware kit
Willer software window
Willer software window

  • The hardware (programmer kit) is interfaced to the computer through a serial cable
  • The microcontroller is placed on the socket of the hardware kit. Press the lock button to ensure the microcontroller is connected to the board.
  • Open the software installed in the computer. It will display some operating modes.
  • Select any mode. A window with a menu bar appears.
  • Click on the ‘file’ menu and select ‘load file’ option from the drop down menu
  • Click on the ‘auto’ button so that the hex file is loaded to the microcontroller.

Step 5:  Simulating the Circuit

  • Open the project in the proteus software.
  • Click on the ‘Debug’ menu.
  • Select the ‘start debugging’ option. The LED starts blinking, which indicates the circuit is running.
  • After some time, select the ‘stop debugging’ option. The LED will now stop blinking.

So ready to build your own project, aren’t you? You must have noticed, I have given a very basic project using a microcontroller and written the code in ‘C’ language. But the microcontroller understands the assembly language.


So here I leave a task for you. Write this same code using Assembly language, in the comment section below.
Post a Comment
My photo

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation. I believe everyday can become a Electrician with the right learning materials.
My goal with BLOG is to help you learn Electrical.
Powered by Blogger.