Friday, February 1, 2013

Schematic Capture

I said that the next post I made would be about the LED driver circuit - right?  I honestly don't remember and refuse to read my old post.  It's like hearing your voice on a tape recorder - or voicemail I guess.  Tape recorders don't exist anymore. Anyhow that's not going to happen.  You'd think I would have learned by now that every time I say the next post is going to be about something I'm usually wrong.  I only do it to build suspense and try to get people to come back and read the next post.  Of course, this isn't worth much unless people read my blog to begin with - and unless I write a next post...

Instead I'm going to briefly discuss schematic capture and the schematic capture tool that I use.  Briefly put, schematic capture is the process where you generate a schematic diagram for an electrical circuit.  A schematic can serve several functions:
  • Informational only - A schematic is informational only if you just need to draw a circuit to show someone.  You could do this with a 50K schematic capture tool, Visio or with a pen and paper.
  • Layout - You may want to generate a PCB with your circuit on it at some point.  To do this you need a schematic capture tool that can integrate with a layout tool.  I'll discuss layout in a later blog post.
  • Simulation - If you should need to determine how much power your amplifier is dissipating by simulating the circuit you'll need a schematic capture tool that interfaces with a circuit simulator like SPICE.
As you might image your choice of a schematic capture tool depends on which of these purposes you want to fulfill.  Generally the very expensive Electronic Design Automation (EDA) packages contain all of the above: schematic capture, simulation and layout.  You can do anything with them if you can afford them.  In case you can't there are many open-source alternatives which also might suit your needs depending on what they are.  If you want to start comparing schematic capture tools or even complete EDA suites some of the things you'll want to consider are these:

  • Basic Functionality - Your schematic capture tool must be able to support the functionality necessary to do what you want with it.  For example, almost every schematic capture tool can be used to generate schematics for informational purposes but even this is not strictly true - some online circuit tools may not offer an export function. To support layout and simulation functionality it must be able to generate a netlist appropriate to the purpose you intend.  
  • Compatibility - Following from the above, your schematic capture tool must be able to generate outputs that are compatible with other applications.  This may be something as simple as generating a graphic or PDF version of the schematic for publishing and complex as being able to generate a SPICE netlist and stimulus in the proper format for your simulation tool.  Ensure you know what types of outputs the other tools in your EDA toolset will accept.
  • Availability of parts/libraries - The more pre-made parts that are made available with the schematic capture tool the quicker your design process will be.  If a wide variety of parts are not available you'll have to generate them yourself - this can be tedious to say the least. However take note: not all parts are the same.  Some part libraries are only for specific purposes such as simulation.  You can't use those parts to generate a netlist for a PCB program. Vice-versa, parts that can be used to generate layouts may have no simulation information associated with them. It is also generally helpful if the parts are popular and freely available from a variety of sources - parts you can't find or are too expensive aren't very worthwhile.
  • Interface/Ease of Use - There are some very awful schematic capture tools out there.  I won't name names but when you use one of the bad ones it feels like the keyboard is made of needles. Don't tolerate poor software - there are very likely alternatives.
  • Neat features - There are lots of features which are desirable to make your life easier:  Bill of Materials generation is good, Design Rule Checks can help out a lot, integration with source control systems may be worthwhile, etc.  While these features are fun and neat this bullet is at the bottom of the list for a reason: compatibility, library support and ease of use are definitely more important.
 There are many options out there and I've used a few.  Here's a few names you might recognize:
  • Cadence OrCad/PSPICE - Known by many names, this professional suite of EDA programs that let you design electronics from step 0 to product.  It has everything: schematic capture, simulation, layout, a well-stocked component library and a huge price tag.  Seriously, it's tens of thousands of dollars.  This is only for colleges and businesses. While I used it in college and at some places I've worked I wouldn't use it for my personal projects.
  • Multisim - National Instruments' answer to OrCad.  I have very little to say about it.  My university tried switching to it in my junior year and it really failed to impress anyone.  I assume it's also expensive but I've never bothered to check.
  • gEDA - An open source suite of EDA tools that aims to be the free software EDA toolset.  I haven't used this one mostly because it's geared towards Unix/Linux and I use Windows.
  • KiCad - Another open source suite of EDA tools.  I just haven't used this one.
  • Eagle - An EDA suite that is something of a standard in Maker circles.  Everyone tends to use it or release libraries for it. Do you have a part from Sparkfun or LadyAda?  They've released an Eagle library with that part.  I also do not use this - mostly because the free version is restricted and it's not open source (although they have opened up their file formats).
If you want to peruse even more open source/free options take a look at this page for a listing of many open source EDA tools of all kinds (schematic capture, simulation, layout, VHDL authoring, etc.).  I've settled on a suite of tools that works well for me.  Eventually I will document all of them but for today I'll focus on my schematic capture software: TinyCAD.

TinyCAD is a Windows-based open-source schematic capture tool.  While it doesn't come as part of a complete EDA toolset it is able to integrate with a wide variety of other EDA tools.  It doesn't, for example, allow you to simulate circuits but instead allows you to export a SPICE netlist that any SPICE compatible simulation tool (which is the vast majority of them) can accept and work with.  It doesn't have its own layout tool but it can easily export netlists compatible with a wide variety of available layout tools: Protel, Eagle, gEDA and PADS. It can also generate PNG graphics of its schematics for sharing. These options give me the basic functionality and compatibility that I need.

As far as available libraries go it doesn't have quite the number of libraries and parts that Eagle has and is certainly nowhere close to professional-level tools like OrCAD.  I don't view this as a large issue because I've found that no matter how much library support your schematic capture tool claims to have it never has the one part you really need.  If you don't get familiar and comfortable with making your own parts and libraries you'll never go very far making things.  TinyCAD has a good interface for making new parts and since everything is XML-based I could probably even whip up a script to generate rudimentary schematic symbols from information in the datasheet to save me time. There are also efforts out there to develop better libraries that incorporate more commonly-used parts and integrate with SPICE and layout tools.

TinyCAD's interface is not fancy and modern but is straightforward and easy to use.  The only feature I've never quite gotten the hang of is the busses but I'll learn someday. I've never felt confused or angry (well, any more angry than usual) when using TinyCAD.  The workflow lets me quickly capture schematics without issue.  You can't give a schematic capture tool a better compliment than that.

TinyCAD has many neat features that keep me coming back.  The open nature of the libraries, parts and schematics means I can create scripts to manipulate all of my design files to automate my work flow.  It can export a parts list/bill of materials for a design.  It offers a design rule check to make sure you don't connect two outputs and unlike other design rule checks this one has proved useful to me. It allows you to create hierarchical parts - you can create a 5V regulator circuit, save it as a hierarchical part and drop it as a block into any new design you want.  TinyCAD is currently under development and not abandoned like some open source proejcts.  Despite the fact that development has slowed down there is a bug list and feature request list on Sourceforge that is steadily being worked at.  And of course since it is open source you can add in your own efforts at any time. There is also a large busy users' group on Yahoo which can help to answer all of your questions.

If you want to be like me and use TinyCAD I've documented the process of installing, downloading libraries, creating libraries, creating your first part and your first circuit.  Find it here.  The next tool I'll document is the layout tool I use: FreePCB.  But before that I'll discuss a few of the circuits I've created for the costume and some of the lessons I've learned in the process.

Until next time!