Lt-FreePcb : LTSpice and FreePcb working together

User projects written in or related to FreeBASIC.
jmg
Posts: 89
Joined: Mar 11, 2009 3:42

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby jmg » Jun 14, 2016 7:07

enform wrote:Hello ,

LTSpice is a good simulator ; It exports a netlist without packages .
FreePcb is a good Pcb designer , easy to use ; it can import a netlist with packages .

Lt-FreePcb builds a netlist with packages from the LTSpice netlist and it copies positions of components from
the schematic file ( *.asc) to the FreePcb project file ( *.fpc ) .
It's easy to start a pcb like this ...

This is the help file :

Code: Select all


I don't know a complete free software for simulation + Pcb .

LT-FreePcb is an interface between LtSpiceIV  and FreePCB , that imports :

 - a netlist exported by LtSpice ( PADS-PCB ) : example : xxx.net

 - the LtSpice project ( xxx.asc ) with the components positionned like you want for the pcb ! this is the     initial reference for positionning !

 - the FreePcb project ( xxx.fpc ) with the components not positionned in FreePcb

 - no packages in the netlist exported by LtSpice ; LT-FreePcb uses ' by default ' components + components by click on a list .

 - these components are created by me , for LtSpice and for FreePcb  ( new librairies to include where they are needed ) .   

LT-FreePcb exports :

 - a netlist for FreePcb ( Mod_xxx.net )

 - the FreePcb project ( Mod_xxx.fpc ) updated with new components ( if you want that ) , and position of components : initial positions are taken in the LtSpice project ( xxx.asc ) , and you can adjust them visually with the mouse ( positionning  x , y , zoom vertical and horizontal ).

LT-FreePcb cannot create a project for FreePcb from scratch  ... ( I cannot , too much complicated ...) , so i have to begin  a project  in FreePcb with only a netlist , and save it for LT-FreePcb :

 
 - in LtSpice :

 - begin  a project with the components positionned like i want for the pcb  ; important , nothing is magic ...

 - save the netlist (choice : PADS-PCB ) --> ( xxx.net )  and the project ( xxx.asc )


 - in LT-FreePcb :

 - Load the netlist exported by LtSpice  ( xxx.net )

 - choose components 'by default ' , click  Final.net  , choose the LT project ( xxx.asc ) in the file selector

 --> change components , packages , or not  ( also in case of click on ' Update ' , continue here )

 - Save.net for FreePcb --> ( Mod_xxx.net )

 - don't close LT-FreePcb


 - in FreePcb :

 - begin  a project   xxx.fpc

 - import a ' Final ' netlist ( Mod_xxx.net )
 
 - save the project without positionning the components


 - in LT-FreePcb :

 - Auto place . Ask for xxx.asc  in a file selector . now , --> resizing with the mouse

 - Save.fpc , choose the FreePcb  project ( xxx.fpc ) in the file selector ; it will be updated to Mod_xxx.fpc


 - in FreePcb :

 - reload the project WITH the new name ( Mod_xxx.fpc ) : components are positionnned

 - continue the job . There is no backannotation , but the xxx.asc file can be modified in LT .

         - Click ' Update ' in  LT-FreePcb .

         - New values are loaded , ' Final ' net is displayed , continue to :  ' --> change components ,  packages , or not '
--------------------------------------------------------------------------------------------------------------

in ' packages-lt.txt ' :

Do not modify the lines : *Header  , *------------- , ***** , *DEFAULT PACKAGES* and *END* ; they are used as marks .
In the lines  :  n-to92-ebc ,n-to92-bce , etc  , suffixes 'ebc' , 'bce' ,'bec' , are used for netlist calculation . Do not modify 'ebc', 'bce' ,'bec'.

Datas are editable  :

A / Packages before *DEFAULT PACKAGES* .(space between lines is only for clarity ,you can remove it).
    You can add or remove packages in the good place. ( ex : bc 548,bc107 ...  -->  under n-to92-ebc)

B / Default packages after *DEFAULT PACKAGES*  : ( But always 13 DEFAULT PACKAGES in the same order ).

3 for resistors          : RC05 (5*2.54mm), RC06 (6*2.54mm), RC07  (7*2.54mm)         . The 1st  will be checked at start !  choose the order here
3 for axial capacitors   : CK05 (5*2.54mm), CK06 (6*2.54mm), CK07  (7*2.54mm)         . The 2nd  will be checked          ! . . . . . . . . . .
3 for radial capacitors  : RAD-248 (1*2.54mm), RAD-394 (2*2.54mm), RAD-630   (3*2.54mm) . The 2nd  will be checked          !
3 for diodes             : DO-7 (4*2.54mm),DO-15 (4*2.54mm) , DO-26 (6*2.54mm)        . The 1st  will be checked           !
1 for inductor           : IND-06  (6*2.54mm). ( 1 actually by default , 3 by manual choice in the clickable list ).

Packages for Transistors with standard names and packages ,or specific names (and footprints names in pcb software):
    bc547,bc639, etc ...,n-to-92ebc or n-to-92bce ,n-to-126 bce ,... TO-220 bce , TO-3P bce . NPNs and PNPs .
    you can use (click on it) generic packages : n-to-92ebc , n-to-92bce , etc , if footprints exist in Freepcb  .

After simulations with LTspice , you can replace the transistors by these packages ,before saving the netlist ( just 2 clicks ) ; ( ex : bc547 becomes n-to-92ebc , a generic )
 original packages in LT are made for Spice only , with specific pinouts ( always C = 1 , B = 2 , E = 3 ) , this is why i use new packages .

For resistors,capacitors,diodes and inductors , no changes , packages are correct . LtPcbNetlist will attribute a default package .

After that ,manual changes are possible by clicks .

But for inductors , the names are created by me  : IND-05 , IND-06 , IND-08 .( 0x * 2.54mm) .

For analog ICs , actually only one specific package : DIP8 for ' TL071 '  . For a ' TL072 ' , maybe later ... ?

------------------------------------------------------------------------------------------------------------

Commands :

- Load.net : netlist from LtSpice   ( xxx.net )

- Final.net : netlist for FreePcb  . You have to select the LtSpice project ( xxx.asc ) , the Final netlist is displayed

- Auto place : global positionning , sizing pcb

- Update : reload the netlist , if the netlist has been modified in LtSpice , or if you want change  ' by default ' components  : choose a new ' by default ' component , and click ' Update '

- Save.net : save the netlist for FreePcb . The xxx.net is renamed  Mod_xxx.net

- Save fpc : the project xxx.fpc (from FreePcb) is updated with the new positions and saved Mod_xxx.fpc

How to :
  - change a component  in the 'Final' tab  : select a new component in the global list and click on the one to change in the 'Final' tab:
      ex : Q1   BC547  @n-to2-ebc   -->  Q1   BC549C  @n-to2-ebc 
 
    the package of a res , cap , ind , diode can be changed ; but for a transistor only if the footprint is the same : ebc , bce ...

    because the net will not be modified .

Place all the files  in the same directory . Good luck !




Download : http://www.packupload.com/W5U5PJFYUZ6

Download 2 : http://speedy.sh/cqU5T/Lt-FreePcb.zip with 2 jpg : main window and sizing + standard.bjt

MD5 : 2037DBCBA7E86B1B52C4382DDD7A043F Lt-FreePcb96.exe

179 Ko (183 808 octets)

No install , just an exe .
enform
Posts: 179
Joined: Apr 24, 2011 12:57
Location: France

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby enform » Aug 07, 2016 10:24

@jmg,
sorry for the delay , I am not here very often ;
And you want ... ? :-) A new version ? possible , i have to work a bit to upload that ...
Salutations
jmg
Posts: 89
Joined: Mar 11, 2009 3:42

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby jmg » Aug 07, 2016 20:26

@enform Since I posted that, I did more tests on LTSpice, including the XVII beta, and found what is possible to store & preserve in the SCH, varies inconsistently by component type.

It is close, and some parts do allow you to enter & keep a usable PCB Package, but not all Parts do this, it varies by model-type used, which makes results erratic.

The fix looks simple -> just make the action consistent, and I fed back the info to the LT Spice author, but got no reply.
I suspect there is low interest in having LT Spice used more generally (ie not just as a Linear Products Simulator).

Hard to tell how the ADI merger/takeover will affect LTSpice.

Since then, also KiCad now has a demo of a Spice Coupling, which looks very promising.
http://www.avrfreaks.net/forum/spice-integrated-kicad

This may be a better long term path - a proper SCH flow, that does have PCB links, with Spice-Added.
enform
Posts: 179
Joined: Apr 24, 2011 12:57
Location: France

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby enform » Aug 08, 2016 9:50

LTSpice and FreePCB are light tools ; for an amateur , possible and good choices . Not a big choice too ....
Kicad is heavier , i made a test and i could not find out an auto-index feature for new components like R1 , R2 , R3 , etc ; only manual ...
probably my fault ??
A few weeks after , i killed my HDD and now , on the new one , Kicad is not installed .
Well , wait and see , I need PCB tools very rarely !
marcov
Posts: 3116
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby marcov » Aug 10, 2016 13:14

freepcb's dataformats are plain text and somewhat documented. It is easy to write some specific software to manipulate.

We did a 1000+ component print with freepcb using 4 layers, which was a led matrix that were individually switchable and per row PWMable.

The basic design had a lot of similar parts of the prints (the rows were the same, but there were exceptions to make room for larger components, the leds needed to remain spaced evenly to make the luminosity of the lamp the same everywhere).

We hacked the format so we had a script (freepascal program) to place parts, then reloaded it into freepcb (to make freepcb recalculate all positions of all pins of the parts), and then ran a second part of the program to create links, areas, via's and some of the silkscreening.

There were tools to query hand edits to extract links which generated code that could be copy-pasted into the script.
jmg
Posts: 89
Joined: Mar 11, 2009 3:42

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby jmg » Aug 10, 2016 20:41

freepcb's dataformats are plain text and somewhat documented. It is easy to write some specific software to manipulate.
...
We hacked the format so we had a script (freepascal program) to place parts,


KiCad is very similar - it has easily read/generated text files.
We did something very similar, using the inbuilt Python engine / Board Info Access in KiCad, for loading placements (XYRS) from an existing design in another CAD tool.
The direct data access makes the Script very compact, and in this case we actually generated the python from another script...

Many of the commercial CAD pgms have binary-only data, especially at the lower end where they turf-protect , and shut-in customers. Best to avoid those entirely.
marcov
Posts: 3116
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby marcov » Aug 10, 2016 21:52

jmg wrote:
freepcb's dataformats are plain text and somewhat documented. It is easy to write some specific software to manipulate.
...
We hacked the format so we had a script (freepascal program) to place parts,


KiCad is very similar - it has easily read/generated text files.
We did something very similar, using the inbuilt Python engine / Board Info Access in KiCad, for loading placements (XYRS) from an existing design in another CAD tool.
The direct data access makes the Script very compact, and in this case we actually generated the python from another script...


Is there also a C level api that could connect FB or FP ? Or even C++ if must be ?
aurelVZAB
Posts: 388
Joined: Jul 02, 2008 14:55
Location: Croatia
Contact:

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby aurelVZAB » Aug 13, 2016 8:05

I must sayy that i never like d LTSpice ,,Electronic workbench or Circuit Maker yes...
so i was wondering anyone here tried to create something like simple analog circuit simulator
maybe using some external libs ???
enform
Posts: 179
Joined: Apr 24, 2011 12:57
Location: France

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby enform » Aug 13, 2016 14:13

CM2000 , yes i like it ; Electronic workbench , i don't remember well , it was a long time ago , is it free and/or limited ?

Ltspice doesn't looks very convivial , but with a little bit of training , is not so 'strange' ; with a few short-cuts for Res , Cap , npn ....

Powerful features are a bit hidden , using scripts : see examples ... for example it can read and write waves files , i have experienced

that , reading a low frequency FM signal , with a FM demod in the shematic and the ( analog ) result was a new wave file on the HDD .

Then it could be printed with another tool . Not so bad for free ...

You can find out libs and sch at the Yahoo group ; i made my own components for this tool for LtSpice and FreePcb . Take 'time' ...

But among theses components , many was for drawing only , not simu : DIP16 pins , DIP18 , etc , for FreePcb only .

With this tool , the link between the 2 , sch and pcb is easy ; the components are pre-positioned in FreePcb . But no succes a t all .

If needed , i can retrieve on my HDD some libs and sch and send by email ?
jmg
Posts: 89
Joined: Mar 11, 2009 3:42

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby jmg » Aug 13, 2016 22:18

marcov wrote:Is there also a C level api that could connect FB or FP ? Or even C++ if must be ?


Good question.
A quick look finds nothing, but you would think once one API is done, other languages should be easier...
Is there a reason Python is not good enough for what you need ?
D.J.Peters
Posts: 8239
Joined: May 28, 2005 3:28
Contact:

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby D.J.Peters » Aug 14, 2016 1:38

My current choice is ngspice and it's free (open source).

You can simulate anlog/digital and verilog circuits.

ngspice.bi and a simple C-API test: viewtopic.php?f=14&t=24956

I have to read the manual at first ;-)
(pdf with more than 500 pages)

Joshy
jmg
Posts: 89
Joined: Mar 11, 2009 3:42

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby jmg » Aug 14, 2016 8:49

D.J.Peters wrote:My current choice is ngspice and it's free (open source).

You can simulate anlog/digital and verilog circuits.

ngspice.bi and a simple C-API test: viewtopic.php?f=14&t=24956

I have to read the manual at first ;-)
(pdf with more than 500 pages)

Joshy


Nice link - ngspice I think is the one KiCad is also interfacing to, so it is nice to see a FreeBasic API too :)
marcov
Posts: 3116
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby marcov » Aug 14, 2016 12:07

jmg wrote:Is there a reason Python is not good enough for what you need ?


Yes. I learned long ago that it is prudent to limit the number of languages and better know the ones you really need well, than many shallow. I don't see Python as particularly useful or attractive, except for cases like this when it is forced upon you.

I've some proficiency in Basic from QB and occasional VB/VBS usage. (QB from before my Pascal years, and while I was part of the Delphi team at a former employer I occasionally helped out with the VB6 team)

So simple matter of time to get proficient in it vs usability.
jmg
Posts: 89
Joined: Mar 11, 2009 3:42

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby jmg » Aug 14, 2016 20:29

marcov wrote:
jmg wrote:Is there a reason Python is not good enough for what you need ?


Yes. I learned long ago that it is prudent to limit the number of languages and better know the ones you really need well, than many shallow. I don't see Python as particularly useful or attractive, except for cases like this when it is forced upon you.
...
So simple matter of time to get proficient in it vs usability.

I can understand that. I will watch for mention of other APIs in KiCad.

I've used Pascal a lot, and also use a VB variant in CAD scripting, and have done limited Python in KiCad.
In both CAD scripting usages (VB / Python) by far the biggest time sink, is not the language itself, but the API structure.
From what I have done, Python has the most compact code. (once you get the API right...)
marcov
Posts: 3116
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Lt-FreePcb : LTSpice and FreePcb working together

Postby marcov » Aug 15, 2016 18:43

jmg wrote:From what I have done, Python has the most compact code. (once you get the API right...)


Well, that is another mark against it then :-)

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 5 guests