Blinking LED using Arduino Simulation in Proteus

Arduino Circuit

Hey everyone. I hope you will be fine.

Today, we are going to start Arduino Controller Programming simulation in proteus which is not only beneficial for the Electrical/Electronics Engineer but also for the beginners who are keen to learn Arduino programming.

Today I’m going to explain a brief introduction of Ardunio Controller with the help of simple example and then do it’s simulation in proteus.

Then in the coming lectures, I will give you depth knowledge about how to do programming & uses of Arduino Controller.

Blinking LED using Arduino Simulation in Proteus

What is Arduino Controller?

Arduino is a microcontroller based platform which means that it is a little computer and you can program it to do things. It interacts with the world through electronic sensors, lights, and motors etc.  

Unlike previous microcontroller, the Arduino does not need a separate piece of hardware (called a programmer) in order to load new code onto the board – you can simply use a USB cable. Additionally, the Arduino IDE uses a simplified version of C++, making it easier to learn how to program.

Arduino Hardware:

An Arduino is such a kind of board which contains a microcontroller, typical an 8-bit AVR such as the ATmega8, ATmega168, ATmega328, ATmega1280, and ATmega2560, plus power supplies, crystal, and female headers to interface with various peripheral boards.

Arduino consists of both a physical programmable board and a piece of software, or IDE (Integrated Development Environment) that runs on your computer. With the help of that you can used it to write and upload code to the physical board. A program for Arduino is called a sketch. Arduino programs are written in C or C++.  However only two functions need to be defined to make a program that continually loops.

 

Setup (): a function run once at startup that performs initialization

Loop (): a function called repeatedly until the board powers off

Arduino Controller

Proteus Simulation:

Arduino is a modern microcontroller board, which become very popular among engineers but one problem with Arduino is that there’s no virtual tool to test its coding. So, if you need to test the coding for Arduino, you have to buy the hardware but it becomes expensive. To solve this problem its library has been developed and now you can test the Arduino coding via Proteus quite easily.

Today, we will have a look on the working of Arduino coding in Proteus. In order to test the coding in Proteus, we need hex file of the program so we will see how to get the hex file of Arduino. First of all I will provide the download link for Arduino Library and how to add it in Proteus and then we will have a look on how to get the hex file of Arduino sketch which is not a difficult task and finally we will have look on how to upload the hex file into Proteus and get a working simulation.

Adding Arduino Library in Proteus:

  • Unzip the folder, you will find two files in it named as ARDUINO.LIB and ARDUINO.IDX
  • Now place both of these files at this location C:\Program Files (x86)\Labcenter Electronics\Proteus 7 Professional\LIBRARYe. in the library folder of Proteus software.

Now open Proteus ISIS and open the component library and search for Arduino as shown in below figure. You will get three Arduino board, which are currently supported by this library. Click on any of these boards and design your circuit.

Proteus Window

Getting Arduino HEX File:

  • Now next thing which we need to do is to get the hex file of Arduino, which isn’t much difficult. Open the Arduino software and click on File and then Preference. A new window will open up as shown in below figure.Arduino Software
  • Tick both of the options which are encircled in the above figure and which are named as compilation and upload. Now click OK to close this preference window.
  • I am going to use the blink example of Arduino and then do some interesting changing in it to design a multi blinking LED circuit. After writing your code, click on compile and you will see a lot of lines in the output pane.
  • After the completion of compilation, you will find a link in the output pane as shown in the figure below; you don’t need to find it as it will be the second last line.
  • HEX File LocationThis is the link for your hex file, copy this link and paste it in location which is shown in the below figure of your proteus design. Your hex file is now uploaded in proteus.
  • When you compile your program, an error message is shown as in the above figure but there is no need to worry about it because no Arduino hardware is attached to you PC.
  • HEX File Adding LocationNow click the play button on the proteus and the circuit will start run.

    Single LED Blinking Via Arduino in Proteus:

    As you know that we have done both the things, i.e. added Arduino library in Proteus and also get the hex file. Now we design circuit in Proteus, I have designed a simple circuit as shown in below figure.

  • Arduino Circuit

    Code:

    void setup()

    {

    // initialize digital pin 13 as an output.

    pinMode(13, OUTPUT); // sets the digital pin as output

    }

    void loop()

    {

    digitalWrite(13, HIGH); // sets the LED on

    delay(1000); // waits for a second

    digitalWrite(13, LOW); // sets the LED off

    delay(1000); // waits for a second

    }

  • Multi LED Blinking Via Arduino in Proteus:

  • As you know that we already have done both the things, i.e. added Arduino library in Proteus and also get the hex file. The multi blinking LED circuit design as well as coding is also quit simple. I have designed a multi blinking LED circuit as shown in below figure.
  • Multi Blinking LED Circuit

    Code: 

  • void setup(){// initialize digital pin 12 as an output// initialize digital pin 13 as an output.pinMode(12, OUTPUT); // sets the digital pin 12 as output

    pinMode(13, OUTPUT); // sets the digital pin 13 as output

    }

    void loop()

    {

    digitalWrite(12, HIGH); // sets the LED on

    delay(1000); // waits for a second

    digitalWrite(12, LOW); // sets the LED off

    delay(1000); // waits for a second

    digitalWrite(13, HIGH); // sets the LED on

    delay(2000); // waits for two second

    digitalWrite(13, LOW); // sets the LED off

    delay(2000); // waits for two second

    }

    ***************************

    I hope it will be helpful for you. Next time I will explain other simple examples for better understanding of Arduino programming.

    Any query related to this will be welcomed. Take care for the next time.

    ALLAH HAFIZ……

Leave a Reply

Your email address will not be published. Required fields are marked *