SPICE Simulation Part 6: How to Make Your EAGLE Libraries Ready for SPICE

Sam Sattel November 27, 2017

5 min read

Autodesk Fusion Logo

Elevate your design and manufacturing processes with Autodesk Fusion

Welcome back to our final SPICE Simulation Series, Part 6! In Part 5 we showed you how to make your existing schematic designs SPICE compatible, but what about your parts? Chances are you have your own libraries that you know and trust. In this blog, we’ll be showing you how to make those libraries SPICE compatible in a few simple steps.

Starting Basic with Intrinsic Devices

We’re going to assume that you already know how to create libraries in Autodesk EAGLE. If you don’t, be sure to check out these past installments to learn how:

Our focus here won’t be on how to create a new library from scratch. Instead, we’ll be showing off the difference for how to make SPICE compatible parts. All this requires is the addition of one final step when you create a new device.

Example Library

We’re going to run through this tutorial using the existing ngspice simulation library. If you want to follow along open this library now from your Autodesk EAGLE Control Panel. Select File » Open » Library, then open the ngspice-simulation.lbr file. This can be found in the /cache/lbr folder in the Autodesk EAGLE directory.

ngspice directory

After opening the library file, you’ll be greeted with the Library editor. In a typical workflow, you’ll first create a package and symbol and then link those together with a device. As you can see in this library, we have some pre-populated symbols and devices. Packages aren’t needed since this library is made solely for SPICE simulation.

library editor spice

All of the magic to convert an existing part to a SPICE compatible one happens in the Device editor. Let’s start this process from scratch and pretend that we need to make a new device. Follow along:

  1. In the Library editor select the Add Device button.
  2. In the Add Device dialog enter a new device name, then select OK.
    add-device-name
  3. In the Warning dialog select Yes to confirm you want to create a new device.

This will open a new Device editor, which is where we need to do several things including adding a symbol and mapping it to a spice model. Here’s how:

  1. First, select the Add icon on the left-hand side of your interface to open the Add dialog.
  2. Choose the R symbol in the list, select OK, and then left-click to place the resistor symbol in the main window.
  3. Press Escape to get out of symbol placement mode and then select Cancel on the Add dialog to close it.
resistor symbol added

We now have a symbol added to our device; this is a standard process that you should be used to when making a library. As you can see this symbol already has its gate and value fields added. Let’s make it SPICE compatible with the following steps:

  1. Select the Add Model icon on the left-hand side of your interface; this will open the Add Model dialog.
  2. We need to match the Spice Type to the kind of symbol we’re working with. Select R: Resistor in the drop-down options, then select the Map button to continue.
    spice-type-resistor
  3. By default, a resistor will come loaded with an Intrinsic Device/No Model. All we need to worry about is mapping the Symbol Pins to the Model Inputs. This is already done for us, so select OK to continue.
part map resistor

Back on the Add Model dialog, you’ll notice a green checkmark has been added next to the listed resistor. Your device is now simulation ready! Save it, and you’re good to go.

add model resistor complete

Getting Advanced with Loaded Models

The resistor device was super easy to convert to SPICE since it uses the default Intrinsic Device type. However, what happens if you make a device that requires a model? We’ll look at that now.

This time we’re going to make a diode SPICE compatible, which requires the addition of a loaded model. Head on back to your Library editor, make a new device, and you’ll meet us once again in a new Device editor.

Just like before we’ll go through the process of adding a diode symbol to our device

  1. Select the Add Add-icon icon on the left-hand side of your interface to open the Add dialog.
  2. Choose the DIODE symbol in the list, select OK, and then left-click to place the diode symbol in the main window.
  3. Press Escape to get out of symbol placement mode and then select Cancel on the Add dialog to close it.
device editor diode

Now we have our diode symbol added to our device, with a similar gate and value as our resistor example. This process has been identical up until now. Let’s look at the differences when mapping it to a SPICE model:

  1. Select the Add Model icon on the left-hand side of your interface to open the Add Model dialog.
  2. For the Spice, Type choose D: Diode and then select the Map button to continue.
spice type diode

Here’s where things look a little different. When working with our resistor it took us to the Map Pins tab first, but for a diode, we have some settings to configure the Load Model tab.

Loading the Model

By selecting the Load Model button, you can load a model saved locally on your computer. In this example, we can use one of the EAGLE default models. Look in the /models folder within the EAGLE directory and select the DMOD.mdl file.

dmod model file

Saving the Model

The second setting to configure is where to save this particular model. There is no need to save this model in any location as it will be saved within the library. Once your model is loaded select the OK button to continue.

Mapping the Model

Now we need to map our Symbol Pins to the correct Model Input. EAGLE might have already done this for you. If not, click the OK button at the bottom of the dialog, this will lead you to the Map Pins tab, then change Symbol Pin A to link with Model Input: N+, and Symbol Pin C to link with Model Input: N-. Once those are set select OK to finish.

pin map diode

Back on the Add Model dialog, you can see we have our checkmark next to this diode. It’s now simulation ready!

You’re a Part Mapping Pro

All it requires is one extra step to go from a regular library to one that’s simulation ready. Whenever you make a device in the future to be sure to add a SPICE model to it, and then map pins to models to keep your parts future proof. When you place any of these converted devices on your next circuit design, you’ll be able to run your SPICE simulation without any extra work. Remember though, EAGLE ships with a ngspice-simulation library that includes plenty of SPICE compatible parts. Before reinventing the wheel be sure to check this library to see if your device hasn’t already been created.

Ready to make your libraries SPICE compatible? Try Autodesk EAGLE 8.4 for free today!

Full-access Fusion Trial
Unlock all of Fusion's advanced features and functionality - free for 30 days.
Start Free Trial

Tags and Categories

Eagle

Get Fusion updates in your inbox

By clicking subscribe, I agree to receive the Fusion newsletter and acknowledge the Autodesk Privacy Statement.