Arduino Simulation Projects using Arduino Simulation Library Models.

We have already seen in the article “ARDUINO Simulation PCB and 3D Models Libraries for Proteus”,  how to add the ARDUINO simulation, footprints and 3D models libraries to Proteus. Now we are going to see how is simple to use this components models for simulating ARDUINO projects. We can download for example the controlling LED project implemented with a microcontroler:

 

Simple project implemented with a microcontroller model

Fig. 1 Simple project implemented with a microcontroller model

We can replace the microcontroller, capacitors and crystal oscillator with the ARDUINO UNO simulation model:

The same project above implemented with ARDUINO UNO simulation model

Fig. 2 The same project above implemented with ARDUINO UNO simulation model

Let ‘s note that the PB5 output has a different numeration in the two models, but the .hex file should work for both, and also for the project implemented with ARDUINO Pro Mini model.

Click the right mouse button, over the model, and choose “Edit Properties”:

Edit Properties

Fig. 3 Edit Properties

Load the hex file of the blink project in the “Program File” edit field:

Load the Hex file

Fig. 4 Load the Hex file

finally, let ‘s run the simulation:

Run th simulation

Fig. 5 Run th simulation

Regarding the PCB assignment, let ‘s note that the only component that hasn ‘t an assigned footprint is the animated red LED:

Fig. 2 PCB package not specified for the LED component

Fig. 6 PCB package not specified for the LED component

We have to assign one to it: select the component, right mouse button, and let ‘s choose “Make Device”:

Make Device window

Fig. 7 Make Device window

Click onNext, and the “Add/Edit”:

Click on "Add/Edit" button

Fig. 8 Click on “Add/Edit” button

It ‘s shown the “Package Device” window:

Package Device window

Fig. 9 Package Device window

Click on “Add” button and type the keyword “led” on the “Pick Packages” window, and select LED PACKAGE

Type "led" on Pick Packages window

Fig. 10 Type “led” on Pick Packages window

Double click over the first line, under the letter “A”

Double click

Fig. 11 Double click

and click on the anode pin of the PCB:

Click on Anode pin

Fig. 12 Click on Anode pin

Same procedure for the other pin:

Click on Cathode pin

Fig. 13 Click on Cathode pin

Now, let ‘s click on the “Assign Packages” button,

Packagings window shows the PCB assigned

Fig. 14 Packagings window shows the PCB assigned

Next button, select PACKAGE from the Component Properties and Definitions options:

Select PACKAGE

Fig. 15 Select PACKAGE

Leave blank the Datasheet Filename edit field:

Fig. 16 leave blank the datasheet field

Choose USERDVC library, for example:

choose USERDVC library

Fig. 17 choose USERDVC library

Confirm the update request in the next message box

Fig. 18 Update message box

ARDUINO Simulation PCB and 3D Models Libraries for Proteus.

Arduino is an hardware/software open-source microcontroller board. It has been widely accepted in the hobbistic, educational and professional communities due to its versatility, ease of use and programming. This tutorial explains step by step how to simulate, visualize the layouts and 3D models of ARDUINO UNO, ARDUINO MEGA, and ARDUINO Pro mini boards in Proteus.

This article is free, login to read it.

Premium Content

Login to buy access to this content

SPICE simulation with Proteus of a Coils Tester.

Ing. Cristoforo Baldoni

This article deals with the Proteus simulation (version 7 and higher) of a low cost and very useful coils tester, easy to build by yourself. It ‘s the In-circuit LOPT (Line OutPut Transformer) Tester by Bob Parker that allows to evaluate the smooth functioning of a coil by turning on a number of different colored LEDs. It doesn ‘t measure the inductance value of a coil, but rather the ratio of its resistive part and the inductive part. This tester is very useful in finding coils with shorted turns, and wound components like yoke windings and SMPS transformers. Low loss components, will turn on four or more LEDs, while components with short circuits will turn on few or no LEDs. We ‘ll se how to implement and simulate with Proteus the circuit which consists of three sections: the low frequency pulse generator, the ring amplitude comparator and the LED bargraph display. We ‘ll se how to model a coil and try different values for the inductive and resistive component to validate the simulation. The Proteus simulation files of the device are available for download after accessing this article.

 

Premium Content

Login to buy access to this content

Proteus Video tutorials

TopicVideo
How to simulate a simple circuit with Proteus
How to create a component symbol in Proteus
How to perform a Time domain analysis in Proteus
How to design a circuit board layout with Proteus ARES

How to Import PSpice models into Proteus

This article explains how to import a SPICE model with the “.model” statement  into Isis of Proteus. Suppose we want import the PSpice model of an NPN Radio frequency transistor BF199. We have the following SPICE source file:

Run Isis and click on “P” button of “Device” to pickup the generic NPN device:

write “NPN” on the keywords edit field and select “Generic NPN bipolar transistor”

GenericNPN

After placing the component on the layout, click on “Text Script Mode” button of left side toolbar and left mouse click on the layout, the Edit Script Block window pops up

Now, copy the text of source SPICE model and paste beetwen the two statements

*SCRIPT SPICE

*ENDSCRIPT

as in the figure below

It’s important to copy the source text between the two statements, otherwise the simulator warns thar can’t recognize the model and replaces it with a default NPN primitive.

Arduino Simulation with Proteus

We ‘ll show how to simulate the celebrated open-source electronics prototyping platform Arduino with Proteus .

 Let ‘s run ISIS Schematic:

isisprodemo

To simulate the core of Arduino platform we need only a few components: the atmega328P Microcontroller, a Crystal and two Capacitors.Let’ s look for these devices in the library:

Click on “P” button and write atmega as keyword:

atmega328p

Double click on the model and this appears under Devices panel:

Same operations for the Crystal and Capacitor:

crystal

cap

Getting Started with Proteus ARES PCB

Let’s start from this complete ISIS Proteus schematic

Proteus_page117_image1

this microcontroller circuit has the following components:

4 diodes 1N4148

2 NPN transistors BC547

2 electrolitic capacitors CAP-ELEC

2 zener diodes a 3EZ8V2D5 and a 3EZ5V1D5

3 resistors RES

a connector D-type 9 pin female CONN-D9

a PIC microcontroller PIC16F877

the PIC16F877 has two hidden pins VDD and VSS, the VDD pin must be set as POWER and the VSS pin must be set as GROUND. When you add a component in ISIS , some components are automatically configured with a PCB footprint, while other components don’t have PCB footprint associated with the component, and you can add it manually. In this case, you must add the appropriate footprint as in the CAP-ELEC example below:

Open the Properties dialog box for the CAP-ELEC component. Click the ? Button to open the PCB package selection dialog

Proteus_page118_image1

Choose a suitable PCB footprint, click OK to finish. Select the PCB footprints for all the components, then open the Netlist Compiler from the Tools menu of Isis Proteus menu Tools -> Netlist Compiler. The settings dialog box pops up, keep the default settings, click OK to generate the netlist file.  After the file has been generated, from the Tools menu select Tools -> Netlist to ARES, this will launch ARES software. You can also use the corresponding button on the toolbar to complete this operation.

Proteus_page119_image3

As you can see that the work area is empty , and we want to use all the elements placed in the list on the left.

Before placing the components, we must draw a border, we use the 2D Graphics Box Mode button to draw the border

Before starting to draw ,we must first select the color, since this is a border, we choose the yellow color (Board Edge), as we can see on the setting tool at the bottom of the main window.

Click in the workspace, hold down the left button ,drag a rectangle of appropriate size ,release the button.

If you later want to modify this size board, you need to click 2D Graphics Box rectangular icon again, right-click on the corner of the board: a control point appears,drag the control point to resize the board. Let’s return to the components placement view by clicking the icon below

Now put the components into the board, in order to get a general view, click F8. This is the result

Proteus_page120_image1

How to connect Proteus with Keil IDE

Thanks for this article to archeng504

Proteus  ISIS can performs a mixed-mode SPICE circuit simulation of analog devices with a variety of models of microprocessors for a complete microcontroller based design. This  feature is called VSM Virtual System Modelling. It can performs RS232 dynamic simulation, I2C simulation and debugging , SPI simulation and debugging, USB simulation, keypad and LCD system simulation functions,  it also has available various virtual instrument devices , such as oscilloscopes, logic analyzers, signal generators. ISIS Also supports third-party software to compile and debug environment, such as Keil uVision IDE software. Keil uVision is an integrated development environment that combines project management, code editing, program debugging and other facilities in a single environment.

Here a simple example to demonstrate a debugging session of a Proteus simulation project using  Keil . The communication is achieved through TCP/IP. This method has the advantage that a debug session can be run either on one computer or on two computers using the local network without any external hardware.

The core of the circuit is a microcontroller AT89C51.  A seven segments 6 digit LED dispaly is connected to the microcontroller. The segment code pins (a, b, c, d, e, f, g, dp) are connected to the port P1 of the microcontroller, six pins of the microcontroller port P2 are connected to the digit code pins ( 1, 2 , 3, 4 , 5, 6 ). We want display LED charactures with a strobe effect.

Proteus_page84_image3

 

Let’s draw the circuit schematic

Add the required components to the object selection window. Pick the components into the Schematic: click the Object Selector button, as shown

On the “Pick Devices” window edit the “Keywords” Input  “AT89C51”  to find the object library , and the search results are displayed as shown:

Proteus_page86_image1

In the “Results” column list,  select the first item “AT89C51”, again on the  “Pick Devices” window edit the “Keywords” “7 SEG” and choose the “7SEG- MPX 6 – CA – BLUE”, (6 -digit common anode 7 LED display ) as shown in the image

Proteus_page87_image1

Finally, edit the ” Keyword” RES, and select the single result as shown

Click the “OK” button to add the devices window.

How to connect components in Proteus: Wiring up Components

Connection between two objects: Line automatic path function (Wire Auto – Router or WAR)

 

left-click the first object connection point . if you want that ISIS automatically gives away the line path, simply left click on another connection point.

On the other hand , if you want to decide the alignment path , simply click the left mouse button at the desired point you wish a corner.

The wire automatic path function eliminates the need for you to draw each specific path wire. This feature is enabled by default , but that feature can be disabled in two ways. If you just left click on the two connection points , WAR will select a suitable path, but if you point a connection point , then one or several non-connected point position , ISIS will think that you are in the manual alignment path , the line will allow you to click on each corner of the path . left-clicking another connection point to complete. The other way to skip the WAR mode is by using the Tools menu in the WAR command to disable it .

This is very useful when you want to set directly between two connection points for example in the case of a diagonal path.

Repeat wiring (Wire Repeat)

Suppose you want to connect an 8-byte ROM data bus to the main data bus circuit, we have the ROM, and the bus as the one placed in the picture below.

First, left-click A, and then left-click B, draw a horizontal line between the A and B . Double-click the C, and the repeat wiring function is activated, the wiring between C and D is done automatically . Double-click the E, and it will be wired with F. The repeat wiring function copies a complete line path. If the auto-repeat function is on, It allows you to connect different wires or pins to the bus, simply connecting the first and following each pin with a double click, the connection will be carried out automatically.

Drag line (Dragging Wires)

There are some special methods that can be used to wiring two components. If you place the mouse pointer everywhere between the ends of the wire, there will be a corner and you can drag the corner of the line. Note: in order to work, the cable connected to the object can not have a label , otherwise ISIS will think you want to drag the object .

Move segment or segments group  (To move a wire segment or a group of segments)

suppose you want to move and drag a selection window as if it were a single line segment: left-click “Move” icon ( in the toolbox ) ,

left-click to choose the final position of the block. If the if the new wiring is not satisfactory  , you can always use the Undo command.

Getting Started with Proteus

Thanks for this article to archeng504

 

After installing Proteus , run ISIS Proteus Professional, will appear the following window interface :

windowinterface

 

Following is a brief description of each part of the function :

1. Schematic Editor window (The Editing Window): As the name implies , it is used to draw the schematic . Blue box as editable area, to put it inside the component . Note that this window is no scroll bar , you can use the preview window to change the schematic visual range .

2. Preview window (The Overview Window): It shows the two elements, one is this: When you are in the component list, select a component, it will show a preview of the element ; Another is that when you mouse focus falls on the principle diagram editor window ( ie, place the component into the schematic editor window Or after the Schematic Editor window, click the mouse ) , it will display the entire schematic diagram of the thumbnails, and will show a green box , green box which is the content of the current diagram window displays the contents of Therefore, you use the mouse to click on it to change the location of the green box , thereby changing the schematic visual range.

 

Proteuspage28image3

 

3. Model Selection Toolbar (Mode Selector Toolbar):

Main Modes:

1 * Select elements (components) ( selected by default )

2 * Place the connection point

3 * place a label ( the bus will be used )

4 * Place text

5 * for drawing bus

6 * for placing subcircuits

7 * for instant editing component parameters ( first click on the icon and then click the element you want to modify )

Tools:

1 * terminal interface (terminals): There VCC, ground , output, input and other interfaces

2 * Device Pin : for drawing pin

3 * Emulation chart (graph): used for various analyzes, such as Noise Analysis

4 * recorder

5 * signal generator (generators)

6 * Voltage Probe: to be used when using simulation charts

7 * current probe : Using simulation to be used when using simulation charts

8 * Virtual Instrument :  in the image above, an oscilloscope

2D graphics (2D Graphics):

1 * Drawing Lines

2 * draw a variety of boxes

3 * draw various circles

4 * draw a variety of arc

5 * draw various polygons

6 * draw various text

7 * draw symbols

8 * paintings origin , etc.

4 . Component List (The Object Selector):

For the selection of components (components), terminal interface (terminals), the signal generator (Generators), simulation chart (graph) and so on. For example , when you select ” Component (Components) “, click the ” P ” button will open the selected component dialog box, select an element after ( click on the ” OK ” after ) , the device will be displayed in the list of elements , later to use this element, just in the component list can be.

5 . Toolbars direction (Orientation Toolbar):

Rotate :

The rotation angle can be an integer multiple of 90 .

Flip:

Flip Horizontal and vertical flip finish . Use: Right-click the component , and then click ( left-click ) the corresponding rotation icon.

6 . Simulation Toolbar

1 * Run

2 * single-step operation

3 * Pause

4 * Stop

AVR microcontroller simulation example:

We want design an AVR driver for a LCD1602 and monitor it with an oscilloscope data lines. Parts of file formats generated by the compiler are different, such as ICC is COF, IAR is D90, GCC is COF, ELF. Proteus supports files COF, D90, HEX , etc.

Run Proteus Professional , the following window appears :

Proteus_page30_image2

 

1, Add the components, in this case ATMEGA16, LM016L (LCD1602), after we’ ll add the oscilloscope.Click the “P” button to select Component dialog box appears

Proteus_page31_image2

KEYWORDS of the dialog box , enter the ATMEGA16, get the following results :

>
Proteus_page31_image1

Click OK, and close the dialog box , then the components listed in the list ATMEGA16, also find LM016L. The end result :

2 , place components: the component list, select Left ATMEGA16, in the schematic editor window, click the left button , so ATMEGA16 is placed in the Schematic Editor window . Similarly placed LM016L.

Proteus_page32_image5

Add “ground” : Left Select model selection toolbar icon appears:

Left selection GROUND, and in the schematic editor window, left-click , so that the “ground” was placed into the Schematic Editor window .

Add Oscilloscope: Left Select model selection toolbar icon appears:

Left selection OSCILLOSCOPE, and in the schematic editor window left click , so that the oscilloscope is placed to the Schematic Editor window.

place components paying attention to place them inside the blue box of workarea.

3 . Connection. AVR, LCD ‘s VSS, VDD, VEE don’t need connections , the default VSS = 0V, VDD = 5V, VEE =-5V, GND = 0V

4 . Add a simulation file. Right click before on ATMEGA16 then select Edit Properties

in the Program File , click the File Browser dialog box, locate lcd_C.hex file, click OK to finish adding files.Set Clock Frequency at 8MHz, click OK to exit.

5 . Simulation

Click Start simulation :

Description: red for high, blue represents low, gray represents uncertainty level (floating). Running in the Debug menu, you can view the AVR related resources.

6 , the source code debugging

Proteus supports COF file debugging. Be sure to create this file in your compiler options.Complete the schematic drawing and add debug files (COF file ) , click:

the AVR Source Code window appears , if the state does not appear in the debugger , go to Debug menu to find .


Proteus_page35_image2

Let’s say something about these icons

1 * continuous operation , it will exit the single-step debug state , and close the AVR Source Code window

2 * single-step operation , skip directly encountered Functions

3 * single-step operation , will enter its internal encountered Functions

4 * out of the current function , when using 3 * into the internal function , use it immediately on exiting the function returns a function , it should be seen in conjunction with the 3 *

5 * run to the line where the mouse

6 * Add or remove a breakpoint , the breakpoint is set using the program will stop at the breakpoint.