Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

B2Spice TUTORIAL

During this tutorial, you will build a linear circuit consisting of a voltage source and two resistors. The purpose of this tutorial is to help you become comfortable with B2 Spice A/D v5, which includes the Circuit Editor (to draw the circuit) and the Virtual Instruments. To complete the tutorial, go through the following steps: Open the B2 Spice Program: Place the Devices Draw the Wires Set the Component properties Set up the Virtual Instruments Test the circuit Simulate the circuit. Save the Circuit

Tutorial #1: Step 1


Open the B2 Spice Program After installing B2 Spice v5, go to the Windows START menu and navigate to the B2 Spice v5 menu and run B2 Spice v5. This will bring up a clean circuit window. The cursor will be in the form of the selection arrow. If the cursor is in the form of an hourglass, then the program is busy.

Tutorial #1: Step 2


Place the Devices Pull down the Common Parts menu by depressing the mouse button while the arrow cursor is over the menu title, and while keeping the mouse button pressed down, move the cursor down to the entry named Resistor. When you release the mouse button, the ghost image of the resistor will be following the arrow. Click the mouse button where you want to place the resistor. After placing the device, it remains selected. This allows you to duplicate or rotate the device immediately after placing it. Next, you will make a duplicate of this resistor. To duplicate the resistor, simply hit the space bar (this is a short-cut for the command Repeat Place Device in the Edit menu.) Place this second resistor to the right of the first resistor. Next, choose Ground from the Common Parts menu and place it at the bottom of the circuit. You will then need something to designate a node to be measured. There are several ways of doing this.

The first and easiest way of doing so is to choose a Voltmeter (Horizontal) from the Common Parts menu and place it above the rightmost resistor. The voltmeter is not an active part of the circuit. Its only purpose is to probe a voltage signal. The second way of designating a node is by using a Marker device, also found in the Common Parts->Markers->Voltage Probe Marker menu. The marker has the advantage of being small and is also used to make virtual connections, designate subcircuit pins, and setting initial voltages and guesses. For this Tutorial, we will be using the Marker / Voltage Probe. Select it from the Common Parts>Markers->Voltage Probe Marker menu and place it

Tutorial #1: Step 3


Draw the Wires First, choose the wire drawing tool from the toolbar at the top of the screen under the menus. To keep it simple, start by drawing a single segment wire. Click at the rightmost end of the resistor (R). Release the mouse button and move the mouse, and the wire will follow the cursor. Move to the left terminal of the second resistor, and double click there. (Alternatively, you can click once with the left button to complete the segment, then click once with the right button to release the wire from the cursor.) After you are done with the wire, notice that at the points where the wire intersects the terminal of a device, there is a bold point where a connector is automatically inserted. Now draw a wire composed of multiple segments. Click where you want to start the wire, at the top terminal of ground. Then move left to the location where you want the first segment of the wire to end, and click once there. Continue drawing segments until you reach the ground, then double click. The second wire should now be complete. If there is still a wire following the cursor around, then click with the right mouse button to get rid of it. To add a power supply click on the Common components and scroll down to the Voltage Source and click once to insert it. COMMAN PARTS -> VOLTAGE SOURCE

Finish drawing the wires necessary to connect up the circuit so that it looks like the following figure.

R1
2K

N1

R2
3K

V1
1

To clean up the circuit, click on the Selection Arrow cursor in the Toolbar in the upper left corner of the circuit window. With the selection arrow, you can move devices, vertices, and segments. Simply position the selection arrow so that its tip is on top of any device, line segment, or vertex, then depress the mouse button, and drag the item with the mouse button still down. Release the mouse button when the item is where you want it to be. All wires are rubber banded when you move objects around. If you want to delete an object, select it with the selection arrow, and then choose Delete from the Edit menu.

Tutorial #1: Step 4


Set the Component Properties Switch back to the Selection Arrow by depressing the current tool. Since the Selection Arrow is the default tool, it will be active when no other tool is active. You can also switch to the Selection Arrow temporarily by depressing the Shift-Ctrl keys. The cursor will remain the Selection Arrow until you release the keys. Using the Selection Arrow, double click on the leftmost resistor. This brings up a dialog box in which you can change the resistance and name of the resistor. Set its resistance to 2000 Ohms (you can type in 2K). A picture of the dialog box is shown below.

Next, you will set the second resistor's value. Right mouse button click on the rightmost resistor, and choose Edit Simulation Model, then set its resistance to 3K. Finally, double click on the Marker and name it N1 if it is not already named so. An important thing to note is that the node that the Marker is attached to will take the name of the Marker, and if more than one Marker is named the same, both will have a "Virtual" connection, meaning that the nodes will behave as if a wire is connecting them.

R1
2K

N1

R2
3K

V1
1

Tutorial #1: Step 5


The first thing to consider is how the circuit will be stimulated. There are two instruments that can inject a signal into the circuit - the Power Supply and the Function Generator. In this instance, we are using the DC Power Supply. Double click on the symbol and set up the Voltage Source Properties. Choose the constant bubble and type in the value. Note: Units are volts.

Select OK.

This completes the circuit entry process. You are now ready to simulate the circuit.

Tutorial #1: Step 6


Simulate the circuit Choose the TEST button on the LHS sidebar. Select the DC SWEEP test by clicking on the Basic DC Sweep square. A tick will indicate the chosen simulation type.

NOTICE ANYTHING DIFFERENT IN THE CIRCUIT? well.

You might want to add the ammeter as

COMMON PARTS -> AMMETER (HORIZONTAL) (1)

Now, setup the Test by clicking on SETUP button. Next, continue with setting up the test by sliding along the DCSWEEP line and click on the arrow.

Enter Source is V1 from drop down menu; Property is DC and fill in the specifics in the next three lines. Start value = 0v, stop value =5v and increment is 0.1v. This set the source to run at 0v and check the circuit performance. Then increase the voltage to 0.1volts and run a check on circuit performance, then step up the voltage to 0.2v continuing in steps until the voltage is 5v. At each step, the circuit will run a simulation and provide the current and voltage values (I(am1) and V(n1) respectively) as you have requested. Make sure that Graph square is checked. Now, you are ready to simulate, click on the RUN>> button. RESULTS: The screen will change to show the results of the simulation. Note the top half [Log Window] indicates errors in circuit simulation if there is any. The spice messages are important in informing you if everything ran without a problem. You need to take note of these. The bottom half displays a graph of the current i(am1) vs source voltage v1.dc and node voltage v(n1) vs source voltage v1.dc. You can select a plot to highlight any one; Y axis label will change as accordingly. In following graph, current plot (yellow) is highlighted. 8

Note: You can choose plot display option by going to EDIT PLOTS option at left most of screen when your graph tab is selected (Blue). In following figure, only v(n1) is selected.

You might also like