pcb-rnd knowledge pool
Importing LTspice schematics into pcb-rnd for board layout
ltspice by Erich S. Heinzle (VK5HSE) on 2017-02-09 | Tags: howto, file format, format, ltspice, sim, simulation, convert, load, import, schematics, menufile |
Abstract: How to import netlist+footprint data from LTspice. This feature allows the circuit that was worked out in LTspice to be realized quickly in pcb-rnd without having to redraw the schematics (e.g. in gschem) first.
Pcb-rnd has a very modular architecture, allowing import and export modules to be coded up quite quickly.
The latest development efforts have revolved around increasing the number of schematic layout tools that pcb-rnd can obtain netlists from.
Some institutions and engineers like to do their simulation in LTSpice . LTSpice works rather well under the wine windows emulator on Linux.
There is already the option of porting the LTSpice schematic to a gschem schematic with a tool like translate2geda , which can then produce a netlist for pcb-rnd, but if no further modifications are needed to the schematic, then the option of importing the design directly into pcb-rnd remains attractive.
An LTSpice import plugin was therefore created to import a pair of files:
an LTSpice schematic (.asc), and
a netlist exported from LTSpice in "Mentor" (.net) format.
The pair of files (.asc and .net) contain enough information to allow pcb-rnd to populate a new layout with their associated connection data.
The only difficulty with this process is that LTSpice does not routinely allow a footprint attribute to be associated with a component.
One workaround for this is to abuse the "mfg=" manufacturer field in the parts libraries for the passive components, by inserting a footprint designator such as
".pcb-rnd-ACY(300)"
in a new component for use in the layout. The library with the new part is then saved, so that the part remains available subsequently.
The above text represents a standard axial 300mil pin spacing device in pcb-rnd.
The reason for the prepended period is to make sorting the list of components in the library by manufacturer simpler.
The "mfg=" field is saved for passive devices in the exported schematic (.asc) file, but the "mfg=" field is not explicitly saved in the schematic (.asc) file for non-passive devices.
One workaround is to make a new library part identical to the desired part, but append the footprint information to the library part name, i.e.
giving the following results in the (.asc) schematic file,
namely, 2N2222.pcb-rnd-TO92
Modifications to the default libraries may be the preferred approach in a computer lab or multi-user teaching environment.
These sorts of hacks would not be needed if LTSpice allowed the addition of arbitrary attributes and had a netlist format or schematic format that preserved and printed the additional information.
For those who can't be bothered editing the inbuilt libraries, the schematic file can simply be modified manually with the addition of lines like
SYMATTR Footprint TO92
i.e.
after each SYMBOL declaration.
This is probably the simplest and quickest approach... but... these additional attributes will get scrubbed by LTSpice if the schematic (.asc) file is opened and saved again by LTSpice subsequently. So a new copy should be made and modified in this way to avoid losing the information if the original is re-opened in LTSpice.
With pcb-rnd running, the LTSpice netlist and schematic can be loaded; here it is being done via the command line interface, using the command
:LoadLtspiceFrom(/home/user/path/to/layout.asc)
The easier way is of course via the "File:Import:..." menu.
The layout editor, on finding valid .asc and .net files, will load the parts and the connection data into the new layout
The parts can be selected, and then dispersed via the menu
after which they can be appropriately arranged:
In this simple demonstration design, using a variety of footprints for the sake of example, connectors for the voltage sources were omitted, but can be added manually to the .asc file easily enough prior to loading by pcb-rnd with something like the following
SYMATTR Footprint HC49
directive, i.e.
With easily extended modular infrastructure now in place within pcb-rnd, additional import plugins are planned for other schematic layout tools as well.
This LTSpice import is now available from the svn , and is expected to be in the next formal pcb-rnd release.