Creating Your Own Symbols in gschem


Before writing another tutorial on SPICE, I thought of spending some time on creating symbols. This will be necessary because we will be looking at op-amp circuits next. There are op-amps in the gschem library but there are incompatibilities between those and the model files which the manufacturers provide. While trying to figure out how to create symbols, I found an excellent 3 part tutorial on this. I will take you through the creation of an op-amp symbol in this tutorial but I still feel this video will do better than that. Take a look at these before reading on:

References

There are two references you need to look at while making your own symbols. Both are from gEDA. Here are the links:

Custom Symbol Creation – LM741

LM741 – the op-amp everyone knows of. It would be a good idea to have the datasheet with you so go ahead and download it from National Semiconductor. Have a look at the pin details of the LM741. This is the symbol we need to make:

Looks simple? Well it is 🙂

First make a separate directory for all your symbols. Opening gschem. Now save this blank file in the directory you just created. However, change the extension to sym. For this tutorial, lets name it as LM741.sym. We now have a blank sheet. However, there still is the title block – that big rectangle on the entire sheet. Delete it by dragging a rectangle around the title block and hitting the delete key.

Next zoom in till you can see the smallest grid spacing. You should have something like this:

Next go to Add >  Line. Draw a triangle – the shape used for amplifiers in circuits. Use the grid to guide you:

Next we need to draw the pins. As the video says, start by clicking at a point away from the triangle, then click on the triangle. In the following figure, I’ve marked points 1 and 2. You first need to click near 1 and then near 2.

Do the same for the remaining 4 pins.

Looks cluttered? Lets fix that. Double click the pin we created first (non-inverting terminal) and set the following attributes (you’ll find them in the table already).

  • pintype: in
  • pinlabel: +
  • pinnumber: 3
  • pinseq: 1

Next, without closing the dialog box, click the pin below it (inverting terminal) and set the following values

  • pintype: in
  • pinlabel: –
  • pinnumber: 2
  • pinseq: 2

The center pin on top (Vcc) :

  • pintype: pas
  • pinlabel: Vcc (Uncheck the Vis? checkbox)
  • pinnumber: 7
  • pinseq: 3

The center pin below (Vee)

  • pintype: pas
  • pinlabel: Vee (Uncheck the Vis? checkbox)
  • pinnumber: 4
  • pinseq: 4

And finally the rightmost output pin

  • pintype: out
  • pinlabel: Out (Uncheck the Vis? checkbox)
  • pinnumber: 6
  • pinseq: 5

Rotate the pinnumber for the Voltage pins so they can be read correctly. Next select the + and – signs (the pinlabels). You can hold the Ctrl to select multimple components. With these two selected, go to Edit > Color and set the value to Graphic. Your symbol should now look like this:

We’re almost done. We need to add two more attributes to the schematic. Before that go to Edit>Show/Hide Inv Text to show all the hidden attributes. Make sure nothing is selected (all the text should be black). Now place you mouse somewhere above the symbol (zoom out a little if you need to) and press a on your keyboard twice (hit aa). The Add Attribute dialog should appear. Select device from the drop-down menu and set Value to LM741. Uncheck Visible and click OK. You should see the device name on the sheet at the place where you positioned the mouse before calling this dialog. Click on an empty area of the sheet to unselect the device attribute we just created. Place the mouse below this attribute and call the Add Attribute dialog again. This time select refdes and set its value to X?. This is what you should have now:

Finally, go to Edit > Symbol Translate. And we’re done. Save and exit gschem.

Before we stop, we have one more thing remaining to do. We did create the symbol correctly. But gschem should know we created it. To do this add the following line to your gafrc (located in ~/.gEDA). Create the file in ~/.gEDA if it doesn’t exist.

(component-library "<path of symbols directory>")

For example, if the directory is located in ~/EDA,

(component-library "/home/myhome/EDA/symbols")

Save the file and exit. Make sure that the path does not contain ~ or environment variables ($HOME will not work). You can however use a path like “./symbols”.

To check if our symbol got added, open gschem and go to the Add Component dialog. You should see the symbol we just made under the symbols section.

Thats it for this tutorial. Try making a few more symbols yourself. Slowly you can have your own library of symbols depending on the kind of circuits you design. In my next post, we’ll look at how we can use this symbol in our schematic. We will also look at subckt – a way to decompose your circuit into smaller blocks. The op-amp’s characteristics are defined using subckts.

Stay tuned for the next tutorial. Hope you liked this one 🙂

40 Responses to Creating Your Own Symbols in gschem

  1. John says:

    Finally, a comprehensive and mostly complete description of how to create symbols in gschem. Much better than reading 5 different (and largely incomplete) documents to figure out how to do this, and what the attributes really are and which ones are required/optional.
    Thank you!!!!

    • Ashwith says:

      Thanks John! Really appreciate your kind words. Let me know if I have left something out which you feel should be there and I’ll try to fill it up 🙂

      • roshni says:

        Hi Ashwith,

        I had a model created on LTspice using the text editor and added it to the new symbol on ltspice which was my new component to the library. I was wondering how do I do this in gschem . If you could help?

        Thanks
        Roshni

      • Ashwith says:

        If you created a model file like this:
        .MODEL 1N4007 D(IS=76.9p RS=42.0m BV=1.00k IBV=5.00u CJO=26.5p M=0.333 N=1.45 TT=4.32u)

        Then there is no difference between LTSpice and gEDA. You just need to tie the model with the symbol in the schematic. This tutorial explains how for a diode. It’s the same for any SPICE model/sub circuit.

    • Indeed, a really comprehensive tutorial. Thanks Ashwith.

  2. Geza says:

    I was concerned about using a schematic editor at the very first time in my life and right away I had to create my own components. Expected a long learning curve, but you tutorial worked like charm, and I was working on my design in no time.

    Appreciate your time and energy to create this tutorial.

  3. Iffat Brekhna says:

    Thankx dude!!

  4. Erich says:

    Very helpful. I created my 17 segment LED display and couldn’t figure out why gschem crashed whenever I tried to attach a net to a pin – but suspected I needed to sort out either footprint or pin related info. Now I know how to sort out each pin’s characteristics!

  5. Ronaldo Viera says:

    Awesome Article! Congratulations!

  6. Mandeep says:

    Hi Ashwith,

    I am not able to see tool bar which consists file, edit, view and other options on the gschem window, as shown in above examples. I am using ubuntu and gchem version v1.0.00, not sure if this is the correct version but this is what the gspiceui tar ball says: gspiceui-v1.0.00.tar.gz. Can you please tell me what could be a possible cause? This will be agreat help.

    thanks,
    Mandeep

    • Ashwith says:

      I don’t use Ubuntu but I think the Unity interface could interfere with toolbars. Ubuntu has tried to unify the application’s menu with the top Unity panel (To make it Mac-Like).

      Can you see the menu when gschem is not maximized?

  7. Hajni Hoffer says:

    Is it possible somehow to create an own symbol which I could use for instance in an e-mail????
    Actally I would like people to see my own-created symbol.
    Could you help me to solve that?
    I can already make my own symbol, but if I copied it here you would not see anything just points or something.
    Maybe I would have to register my symbol somewhere?

    Thanks for your answer in advance!

    Hajni, from Hungary

    • Ashwith says:

      You mean you want a symbol as an image? If so, that is possible. Just click File > Write image. You’ll see a window pop up asking where you would like to save it. Sorry about the late reply.

  8. Keith Ostertag says:

    Hi Ashwith- Is there a list of pin types? I have seen “in” used for input, and “pas” used for passive, what are the others? How important are they?

    Thanks,
    Keith Ostertag

  9. Hi, thank you! It helped me a lot. Thanks.

  10. OldETC says:

    Pin Sequence is sets the order the pins are emitted to the netlist. When the schematic is used with ngspice or other simulators, the simulation relies on the pin order to set up the simulation netlist which will determine which components are connected to the external components, and so enable the simulation to recieve signals and power at expected points.
    If the device has multiple slots, the slot definitions will determine which signal pins are used for each simulated device in the package. It is vital that the pinsequence matches that expected by the SPICE model. No one seems to discuss that in the symbol creation guides, but to really benefit from the tools, it should always be presented this way.

    • Ashwith says:

      Hi OldETC,

      Thank you for your comment. I was quite new to symbols when I wrote this tutorial (I still am since I’ve rarely used them) so I didn’t realize that stating this is important. I did know that the pin sequence depends on the order in the SPICE model but I took it as something that’s obvious.

      I totally ignored slots before. Thanks for telling me about this. This is definitely quite important.

  11. Jorge says:

    Hi Ashwith! Thanks for these excellent tutorials. It had been helpful for me.
    I would like to share a solved trouble about the gafrc file modification. When I added the (component-library “”) line, I did it by copy-paste method, and by some reason, the quotation marks gave to gschem some problems. It wasn’t able to add my symbols directory and I didn’t found my recent editing symbol. The solution was to erase those quotation marks and replace these by new ones, without any previous format.
    Thanks a lot! 🙂

    • Ashwith says:

      Hi Jorge! I’m happy the tutorial was useful to you!

      I am aware of the issue. The problem is WordPress seems to be converting the quote characters to something different so it doesn’t work. I think I should make a note asking people to type it out and not copy and paste it.

  12. Pingback: XBMC Light Dimmer – PCB – Part One | Synforge

  13. Pingback: Pengantar Elektronika di Linux – Aplikasi Pengganti EAGLE, Proteus, dan Multisim untuk Desain Rangkaian dan PCB | Ade Malsasa Akbar

  14. satish says:

    Hai..Ashwith I’am satish from West godavari . I working with fedora in electronics lab gEDA.
    so in this gEDA simple RC circuits simulation verified witg NGSpice.. Results are Observed.
    But I Testing ce amplifier using bjt in library simulating with ngspice some error got it. in this gEDA component Library Active components are not used? It is the first time on this work. I saw the many examples but i dont understand.. plese help me How to use Active components in gEDA ..EX: BJT,Diode…

  15. Pingback: create your own symbol in gschem | diy.raks

  16. Andrew says:

    One error which caught me out for a few minutes is that you don’t remind us to save as a .sym file type rather than a .sch. A minor edit, but a worthwhile one!

    Other than that, a very good tutorial. Thanks!

    Now I have a decently labelled FET 🙂

    • Ashwith says:

      I do talk about saving it correctly – right at the beginning 😉 It’s the first step.

      Glad you found the tutorial useful. Please do share it with others! 🙂

  17. LED Panel says:

    That is a very good tip particularly to those fresh to the blogosphere.
    Short but very accurate information… Appreciate your sharing this one.
    A must read article!

  18. Pingback: Como importar símbolos para o esquemático do gEDA | arthurcvm

Leave a comment