The Good Stuff

The actual libraries can be found here: http://github.com/sfriederichs/TinyCAD-Libraries until they are included in the main TinyCAD distribution. There are no warranties, no guarantees and quite possibly no correct parts or information. Use them at your own risk.

Purpose of this library


This parts library is an attempt to create a comprehensive collection of parts that people request for use in the TinyCAD schematic capture utility. The parts library is meant to fulfill several criteria:
  • Provide a collection of 'generic' schematic parts for high-level design that encompass a large range of actual parts - NPN transistors, resistors, capacitors, crystals, etc.
  • Supply a list of commonly-used electronic and mechanical parts with schematic symbols for TinyCAD
  • Limit the part selections to those which are likely to be easily, quickly, and cheaply available to an average hobbyist
  • Offer complete pin definitions to ensure that Design Rule Checks catch all likely errors
  • List proper FreePCB footprints for each part (where applicable) to ease the task of board layout
  • Include accurate manufacturer information (part numbers, series names, web page links) as well as supplier part numbers
  • Provide rough pricing estimates and minimum orders from common suppliers for use with cost estimation
  • Use pictures to provide visual reference and confirmation of part type, package, color, etc
  • Have basic specifications for each part (voltage, current, heat dissipation) as well as links to the most recent manufacturer datasheets
  • Explain common usage of each part, pitfalls and 'tricks' for usage including complete schematic and layout examples
  • Provide SPICE-simulatable parts libraries

The library does not fulfill all of these criteria currently, but this is a wiki and everyone is free to add content as they see fit. However it is worth noting that for ease of organization this parts library is maintained as a CSV file, while the schematic symbols are saved as TinyCAD XML and the pictures are JPGs. All of these are stored separately and once a week I will execute a python script that gathers up all the information and generates the new MDB libraries for TinyCAD as well as an HTML files for each part that are included here.

Therefore, if you want to add a new part it is easiest for all parties involved if you simply post on the discussion area the part information to me along with links or attachement to a picture and schematic symbol if necessary. I will add it to the list and the automated process will create the necessary files. As I said I will try to do this every week to maintain the libraries. If you want to update the tips and tricks for each part just go ahead and do it on the wiki and I will backpropogate all of those changes to my local files then publish them to the wiki (until I find a better way of working with this mess).

Explanation of the library structure

The first row is titles. The script ignores them. Perhaps at some point in the future I can retrieve column header information from the file itself but for the time being it is hard coded in the script.

Each line in the CSV is either an electronic part or a mechanical part - but it is always a 'part'. Electronic parts fall into one of three categories: schematic parts, non-schematic and simulation parts. Electronic schematic parts usually have a package associated with them for layout purposes, while mechanical parts generally do not. There are exceptions to each rule - panel mount parts don't have layout packages because they won't be laid out. Some mechanical parts include electrical connections (standoffs connected to copper ground for instance) that necessitate layout package information. Each schematic part has a schematic symbol - it may be general (NPN transistor - used for most switching/signal/power NPN transistors) or specific (FTDI232RL - very specific pinout, etc). The schematic symbol is dictated in the 'TinyCAD Symbol' column. The actual XML symbol information is stored in a symbol directory in files that follow the naming convention <Symbol_name>.xml. The script used to create the library finds the proper file with the symbol in it and puts it in the database. The layout package comes from the 'FreePCB Footprint' column. All of these names have to be found somewhere in the included libraries of FreePCB or you'll get errors when you try to lay out. The 'Picture' information is the file name of a picture I or you have taken myself of this part. It gets integrated into the HTML on this page by a python script I have. The 'Datasheet' column is a link to a recent datasheet for this part.

Each part exists within a library. Each library is denoted by markup within the CSV file, specifically, in column 1 the text will be 'file' and in column 2 it will have the name of the file that should be created. The end of the records is denoted by text of 'end' in column 1.

This markup is all for the python script. Otherwise it is human-readable.

What is needed most


Again, this library is not complete but needs your suggestions/help to make it more useful for everyone. What I don't have that I'd like is the following:
  • Surface mount parts - I don't hardly use them yet so if you have a good collection I'd like to know about it
  • SPICE simulation parts - I have not gotten into this yet but I know some people have libraries out there. I don't fully understand how the process works and how to simulate it afterwards so if someone wants to educate me I'd greatly appreciate it
  • Your suggestions - This effort isn't just for me although it started that way. Right now it's useful to me, if you want it to be useful to you I need to know how I can do that
  • Any problems - Is a package wrong? Is a chip out of production? I'd like to know and if you're feeling frisky, tell me the new information as well
  • Pretty symbols - I'm not against prettiness, I just don't have artistic talent/time to make new great-looking symbols. If you have symbols that you will allow me to use or create new ones for this library let me know. Also let me know what copyrights are applied to it and what I can do with them.


Why mechanical parts?


Mechanical parts are an odd thing to include in a schematic capture utility. However, there are several reasons for doing this:
  • For completeness of the bill of materials - mechanical parts cost money too
  • Some mechanical parts (such as standoffs) require layout parts, usually mounting holes. If the parts are not included then there must be external record of what mounting holes are necessary, etc. You also often need to show that these parts are connected to some ground plane or other copper area. Keeping this information elsewhere unnecessarily increases complexity.
  • We need to find mechanical parts too - it's not simple to find screws or standoffs sometimes. Electrical hobbyists don't usually think too much about enclosures or mounting or connectors but it's often crucial. The parts list shows you where you can get them and at what price.
  • To keep track of custom part number provided by, for instance, a board house.

Resources


Parts

Generic Passives


Choke

AKA: (Magnetically Coupled) Inductor, Common Mode Choke, differential choke?
RefDes: L?
Prominent manufacturers:
Important attributes: Inductance


A choke is essentially two coupled inductors - kinda like a transformer. But where the transformer's job is to transmit large amounts of power or isolate things, the choke is designed to give high frequency signals a path to ground that avoids a load. Go to this website and look at figure 3 (and while you're there read the whole site):

http://www.butlerwinding.com/inductors/common-mode2.html

Essentially, the coupling of the two coils and the induced magnetic fields dampen out any common-mode signals on the two lines (usually high-frequency noise) but not the desired load current (which is going one direction in, and another out, thus not the same).

The inductance is measured on one coil! Nothing else makes sense as the two coils are really separate inductors. If you want to use it as an inductor just don't hook up the second coil. If you want to use two inductors DON'T HOOK UP THE SECOND COIL! It's magnetically coupled to the first one! You will get undesired effects!

http://www.aikenamps.com/Chokes.html

PTC

AKA: Resettable fuse, PPTC
Ref Des: RP?
Prominent manufacturers: Raychem
Important attributes: Hold current, trip current, maximum voltage

PTC stands for Positve Temperature Coefficient. It is a resistor that varies its resistance positively with heat. The effect of this is most-often used to act as a resettable fuse for circuit protection. The PTC is placed in series with the components to be protected from high current. The resistance of the PTC is negligable at room temperatures, but when current flows through it it heats up. If the current through the PTC exceeds the trip current then its resistance will quickly become nearly infinite - it opens the circuit so no more current can flow. If the power source is removed then the PTC will cool down until its resistance becomes negligable again, at which power may be reapplied.

PTCs can be paralleled to increase current limits. Two PTCs in parallel will have twice the trip and hold current, three will have three times, etc.
Often varistors are put in parallel with PTCs to protect them from high-voltage spikes. This is effective due to the fact that most PTCs have low maximum voltage ratings compared to the currents that they can handle.
Puting two PTCs in series has no real effect. If an overcurrent situation occurs then one PTC will likely trip before the other, and when power is removed one might become a short more quickly than the other depending on the tolerances in its attributes. This effect is not particularly useful given the fact that it can't be designed for.

Varistor


AKA:
Ref Des: RV?
Prominent manufacturers
Important attributes:

A varistor is a variable resistor that limits voltages to a certain level. It is typically used to protect voltage-sensitive components in situations where voltage spikes are encountered. Two typical varistor current-voltage responses are seen in the figure below. Varistors are used by placing them in parallel with the elements that need to be protected. Varistors can be used with PTCs to increase the level of protection for sensitive circuits.

moz-screenshot.jpgmoz-screenshot-1.jpg
Figure x - Two typical varistor current-voltage characteristic curves
Figure x - Two typical varistor current-voltage characteristic curves


Oscillators


Oscillators are any number of devices that produce a waveform to be used to run a clock. The most popular type is a crystal oscillator. These use quarts crystals to generate a very specific frequency

Oscillator Type

Quartz Crystal - all frequency ranges and accurate to about .001%
Ceramic Resonator - all frequency ranges and accurate to about .5%
RC oscillator - uses RC network and an amplifier to produce a sine wave. Watch out for temperature-dependent frequency changes. The output sine wave might be distorted if steps aren't taken to avoid it.


Tolerance
Tolerance for oscillators is often measured in ppm (parts-per-million). This is because many oscillators are such low tolerance bands that the percentages would look absurd (for instance, 1ppm accuracy is .0001%).

Type

Ceramic Resonator

A ceramic resonator is something of a quick and dirty resonator. It uses the electromechanical properties of a certain piezoelectric material to create resonance (aka, oscillation) of a specific frequency. I'm unsure of the practical differences between these and crystals.

Crystal Oscillator

Crystal oscillators use a tuned quartz crystal to produce a sine wave of a given frequency. Typically the frequency is accurate to about .001%, but can has a tolerance of 8ppm (parts-per-million, in this case that would be .0008%). Crystal oscillators are the way to go if you need a very accurate timekeeping. The most accurate are the 32.768KHz watch crystals. They are used for high-accuracy real-time clocks. Crystal oscillators require specific load capacitors to operate. The value is different for all frequency ranges so check the datasheet for specifics. A popular package for the crystal oscillator is the HC-49(U/US) package. It's through hole and looks like a shiny metal rectangle with rounded ends. You've probably seen them before.

Clock Generator

A clock generator is some form of oscillator paired up with extra circuitry to produce a square wave instead of a sine wave. Some are programmable via a resistor. They can utilize any method of generating the frequency, so the accuracy of the frequency varies based on that.

RC Oscillator

This is a quick and dirty oscillator. One example would be a Wien-Bridge oscillator. The general idea is that you select the R and C for a specific frequency and then use an amplifier to produce the sine-waveform. The amplifier will resonate if the phase shift goes beyond 360 degrees. That's not the hardest part - the hardest part is to ensure that the amplifier doesn't simply go into saturation. Complicated circuits are used for that and it's outside the scope of the discussion for this guide, but you can always check out the Wikipedia Page if you're interested.

Inverter Oscillator

This isn't strictly a component, but it's a way to get a clock signal for cheap. The idea is to take two inverters and connect them such that the input of inverter 1 is the output of inverter 2, and the input of inverter 2 is the output of inverter 1. When you apply voltage, the inverters will start flipping each other's waveforms just as fast as they can. For most inverters the propagation time of the gate is measured in nanoseconds, and the slew rate of the output from LO to HI will also only take nanoseconds. This will give you a fairly fast clock that's also a square wave. Of course, you can't be certain it will stay at one frequency, and you can't even be certain what that frequency will be. Needless to say, since this is the cheapest trick it's also one of the worst, but in a pinch it can get you a clock signal.

Generic Semiconductors

TVS Diode

AKA Transorb
256px-Transient_voltage_suppression_diode_symbol.svg.png
Two different TVS schematic symbols


A TVS diode is a transient voltage suppression diode. It is essentially two zener diodes placed in opposing parallel to each other. It will limit the voltage bidirectionally (or unidirectionally if it is designed that way) to its predetermined breakdown voltage and will conduct the excess current up to its limit before it fails. It operates very similarly to a varistor with a few differences:

  • It reacts more slowly than a varistor. The varistor will react on the level of single nanoseconds where the TVS diode takes tens or hundreds of nanoseconds typically.
  • The varistor can typically handle much higher current - on the order of thousands of tens of thousands of amps versus the TVS diode's average of 50A
  • The TVS diode has an effectively infinite life if operated within its ratings where the varistor will break down after a certain number of surges, usually on the order of hundreds.
  • The TVS has lower parasitic capacitance in general.

Given these differences the varistor is used more often in very high amperage situations for protection where the TVS diode is used for lower power applications.

There is a table comparing the two types of components here: Wikipedia Page on Varistors

Useful Links:
http://en.wikipedia.org/wiki/Transient_voltage_suppression_diode
http://en.wikipedia.org/wiki/Varistor

Transistor

Transistor as switch how-to: http://www.ermicro.com/blog/?p=423

Connectors


Generic DC Plug


Here's a good page on DC plug basics: http://www.appropedia.org/Low_voltage_connection_basics

Electromechanical Parts


Switches/Buttons


Switches are great. Well, not great great, but great enough. Who doesn't love that satisfying click when you press down a control and see something happen? I know I do. It feels like power.

Generally, switches and buttons perform the same electrical function - choose between one of two states. Open or close a connection. There is a difference though. I like to think of switches as having the mechanical action that when you switch them, they stay switched. So you can have a two position switch and flip back and forth between them with the (toggle, actuator, dolly, rocker)

Rocker switch
This is the type of switch where it stays in the position you set it in. It could have a

Hardware



Hardware is difficult at first, but it doesn't have to be!

Light Pipes


If you've taken apart some consumer electronics you might have seen these. They're clear pieces of plastic that help to transmit light from LEDs or other sources to a panel. They're used in the situation that your PCB can't be mounted so that the lights are visible just by drilling a hole in the enclosure, or perhaps if you need a sealed enclosure. Here's an example. You're pretty good to go with any type of press fit or panel mount light pipe. Sadly, Digikey doesn't have the length of the pipe or the diameter as search options, so you'll have to hone in on the one you want by selecting for other criteria and then scanning the remaining options. Light pipes can come in several different colors, but clear or diffused white is a good option as it simply holds the color of the LED. And you can get LEDs in more colors than you can get light pipes so just go with that.

Enclosures


Bare electronics are NOT happy. They need a nice warm plastic box to live in otherwise they get sad and eventually release their magic smoke in an act of spontaneous suicide. Ok, maybe not. But an enclosure is useful for any number of reason. Keeping things from getting wet, dirty, shorted out, etc. You can also mount buttons, LEDs and other user interface things on an enclosure.

If you've ever been to Radio shack then you're very aware of the generic blue plastic boxes that are marketed as 'project boxes'. These are the most basic and ugliest of enclosures. You have to drill holes and make cutouts for them to be useful. And they don't have any nifty features. You can do much better.

Let's go over what you may want to look for in an enclosure.

Material


Plastic

Plastic is always an all-around great choice for an enclosure. It is fairly easy to work with (tools you have will probably suffice), durable, comes in many colors, etc. It's non-conductive if you want that. The one thing I've noticed about plastic enclosures is that you can't always work with it cleanly. My punch will certainly make a good mark in plastic, but my drill leaves ickies on the holes afterwards. I have to work everything over gently with the dremel and even then it doesn't look great. One good thing about plastic is that if your enclosure has plastic end-panels then you might be able to have custom end panels made that fit everything perfectly and are laser-cut so they have no ickies. I haven't tried this myself, but you can try yourself with the Minicuts service. Pololu also has a similar service. In fact, Minicuts has a whole page showing you links to other places, so that's cool. In fact, laser cutting (and engraving and etching) is pretty common, so you might be able to find a place that does it locally.

ABS plastic seems to be your basic 'everyplastic' if you don't care too much. It accounts for nearly 2000 of the 2600 or so 'plastic' boxes on Digi-Key, so go with that. The Minicuts service gives you acrylic plastic panels of either 1/8" or 1/4" in a variety of colors. ABS stands for acrylic something something, so I suppose the two will play nice. I mean, they won't explode, right?

Metal

Metal can be good because it's conductive. You can terminate shield connections on it for added protection and noise reduction. Other than that, it's hard to work with. You might need high-powered tools to do anything other than drill holes in it. You pretty much have your choice of steel (hard, heavy, difficult to work with) and aluminum (lighter). Watch out for rust.

Design


You can have a handheld a ma jig, a keyfob, a generic box, slanted top, etc. Your basic 'box' seems to be called 'Cover Included' on Digikey. 'Split Sides' means that the half of the sides is connected to the top, and half to the bottom (unlike a 'regular' box that has a top that's one piece and sits on the sides, for this design the sides sit on each other). Hinged lid is exactly what it says on the tin. 'End Panel' is a good one. That means that at least one end of the box is removable. This means you can either take it out of the enclosures and drill holes in it easier or you can replace it with a custom panel from Minicuts (or elsewhere). Do mind that most of the end panels I've seen have a lip or thin edge that fits into a part of the box so they are locked into place when everything is put together. Minicuts can't do this for you, so you might want to thin the panel out a bit yourself or make a little smaller than the original end panel and make sure that it's secured to something else (like the PCB).

Features

You have lots of good features with enclosures from Digi-Key.

'Battery Compartment' of any type is pretty much what you'd expect. Your options are generally 9V or AA, or maybe AAA batteries. It seems that at least a few of the enclosures with battery compartments include battery hardware for mounting, so that's a plus.

'PCB Supports' are a great feature. They give you a place to put mounting holes on your PCB that you don't have to drill yourself (which might make them, um, incorrectly placed. Especially if I'm doing it by hand). Get that if you are making your own PCB. Otherwise you'll have to drill holes by hand for one reason or another, and I don't like that.

'Power Plug' was a surprise to me - it doesn't INCLUDE a power plug, it IS a power plug. Just like a wall wart. Kinda cool though.

'Card Guides' are places to slide in a PCB rather than screw one in. Could be useful if a guide a close enough to allow components to stick outside of the case.

Thickness


Eh, don't really know. Generally, if it fits the other dimensions you need and has the features you want then you should go with it no matter what the thickness. .1" seems to be popular? It's half of the plastic boxes

NEMA enclosures were something I'd heard of before, but I didn't know why I would use one. Turns out it's a standard specifying environmental protection levels. A good summary is found on Digi-Key here.

In addition you can also look at my guide to choosing and modifying enclosures.

Screws


'Screws' is something of a misnomer. A screw is something that generally has a pointed head and cuts itself into the material you're screwing (THAT'S WHAT SHE SAID! Oh God, that's so wrong..) Wood screws and concrete screws do this. 'Screws' used with electronics are what I would call bolts - tiny ones. They fit into a pre-made thread or create their own thread in a soft material (mostly plastic). Sometimes you'll deal with real screws (the pointed ones) - especially with enclosures. If you're dealing with electronics you have rather few options to worry about for screws. If you get a pre-made enclosure then the screws will come with it (just don't lose them!). And the screws you'll need most otherwise don't have too many options to foul you up.

Below is a simple overview of the options that will foul you up. This is terribly basic compared to Wikipedia's article on screws: http://en.wikipedia.org/wiki/Screw
It's also quite basic compared to this nifty page here: http://www.boltdepot.com/fastener-information/Type-Chart.aspx

So that leaves only several important factors with screws:

Thread


The basic thing about thread is that only like threads go together. If you have to try hard to screw something in chances are that the threads aren't right - so stop before you break something. There is a page here that details many technical details about thread size and shows how and why threads are named the way they are. Take a quick look and you'll generally see coarse threads and fine threads and a whole bunch of threads that read like '4-40'. And all that has meaning. That's the theory. The practicality of it is this: threads must match each other for them to work! If you are given a part and you want a screw for it then find out what thread it is and use that. Thread sizes come in forms including: Mx (x is a number), #x, and x-y. Find that then match it. If you have the choice then follow this rule: use 4-40 thread. It seems popular and I've had little trouble finding parts that match that thread. Plus most enclosures, standoffs, etc I've picked up randomly have used it so it's a good bet.


Length


This is at least easy. How long does it need to be? If you're screwing down a PCB then find the thickness of the PCB and then figure out how much room you have on the other side for it to screw into. Get something longer than the PCB, but shorter than the maximum distance on the other side. And do make sure that the length of the screw is the length below the head and not the overall length of the whole thing.

Head type


You've probably thought about this one but haven't formulated too much of an opinion about it yet. Head type refers to what shape the head is. Below are some examples (courtesy of Wikipedia)

400px-Screw_head_types.svg.png

A is referred to as a 'pan head' type, B is a 'button', C is 'round' and D is 'truss'. What's the most important thing about these? On the bottom of the head they're flat. This means that whatever happens they will stick up above whatever they're being screwed into. This can be undesirable or just OK. If you're holding a PCB down then, yes, the PCB is flat and you probably want the bottom of the screw head to lay flat against it (and you don't care if it sticks up above it either). E is the interesting type - countersunk head. For this screw, if you provide an appropriately countersunk hole then it will lay flat with the top of whatever it's holding down. Many enclosures use these to ensure that the top of the enclosure is flat and free of any raised heads. F is 'oval'. I don't know what it's used for. No, I didn't read the Wikipedia article (I'm smarter than that, DUH!) and yes, I'm sure that their use is in there somewhere.

In general, go with pan if you have the choice. They're great all-around. Use countersunk for when you have a countersunk hole to put one in and you want a nice flat surface afterwards.

Drive Type


You already know this one! Philips or flathead? Philips is the one that looks like an 'x', and flathead is just a line. That's easy! There are some esoteric drive types out there (star, torx, square, bristol, spline). In general just avoid those - the tools are not as easily available. Hex heads are good - they just use allen wrenches or such to tighten them. Easily available, but I prefer good old Philips. Flathead just annoys me. My screwdriver always falls out of the slot (that's what.. oh nevermind). Philips is easy and cheap.

Material


In general your only major choices here are metal or not metal. Sure, there's different types of metal and sure, there's platings you can worry about. You know what I worry about? Conductive or non-conductive? Cheap or expensive? Nylon or plastic screws are non-conductive and may be necessary in some situations. Metal is conductive in general. Platings? No idea. Get the cheapest one unless you have extra durability (salt fog, rusting, deep space, etc) requirements.

One thing I CANNOT stress enough: threading plastic and metal together is a BAD BAD BAD IDEA! If you have a metal standoff please try to get metal screws. If you have a nylon or plastic standoff, try for non-metal screws. If you mix the two and screw up threading one into the other, the metal threads will happily tear the plastic threads to pieces and it will feel like everything's fine. It doesn't take much pressure to ruin plastic threads when they're up against metal.


Appendix A - Python TinyCad Library Creator


The Python TinyCAD Library Creator is a Python script that I whipped up to take text data from a CSV file (containing part names, numbers, schematic symbols, FreePCB footprints, etc) and a TinyCAD MDB library (containing a collection of schematic symbols) and turning that information into a TinyCAD MDB library file.

Step one for using this app is to install it. This requires three things: the Python script, Python 2.6.x, and the latest Python Win32 Extensions (for Python 2.x).
Python 2.x - You'll need the latest 2.x version of Python. This is separate from the 3.x version. The 3.x version is not functionally equivalent to the 2.x version. Currently, the latest released version is 2.6.5. It can be downloaded here.
Python Win32 Extensions - These extensions are a set of libraries that allow a Python developer to access some of the functionality of the Win32 library. Particularly, we're interested in the functions to allow us to access MDB databases. The latest version can be downloaded here. Make sure that you download the version that is compatible with Python 2.6: the name ends with '-py(ver)' (ignoring the extension). At the time of this writing, that would be '-py26'.
Python script - It cannot be gotten at the moment. I haven't uploaded it to GitHub yet. I will. Soon.

To make all of these files work together properly, first install Python 2.x. That shouldn't have any problems, so install the Python Win32 Extensions afterwards. Also, should be no problems. So now do this: Go to Start->Programs->Python 2.6 (it's new) -> PythonWin. PythonWin will open up. Now go to the Tools menu->COM Makepy Utility. The 'Select Library' window will open. Go down the list to find 'Microsoft DAO 3.6 Object Library (75.0). Select it and hit 'OK' The window will disappear and some text will start to appear in the 'Interactive Window' PythonWin window. It'll look like this when it's all done:

PythonWin 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32.
Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for further copyright informationGenerating to C:\Python26\lib\site-packages\win32com\gen_py\00025E01-0000-0000-C000-000000000046x0x4x0.pyBuilding definitions from type library...
Generating...
Importing module
That's done. There has to be a specific directory structure for this to work. It should be preserved in the ZIP file that the whole shebang came in, but just in case it wasn't:
\
\README
\Libraries
\Libraries\MDB\Symbols\symbols.mdb
\Libraries\MDB
\Libraries\TCLib
\Libraries\ZIP
\Libraries\CSV
\Libraries\CSV\parts_list.csv
\Parts List Generator
\Parts List Generator\plgen_mdb.py

MDB files will be created in \Libraries\MDB, \Librares\TCLib is a good place to put the TCLib formatted files, and the \Libraries\ZIP should house the ZIP file of everything. The files mentioned have to go in those places relative to the 'Parts List Generator' directory for the script to run.

You're probably best off finding the Python script and right clicking it, then selecting 'Edit with IDLE'. IDLE is Python's built-in editor and debugging environment. We'll be able to see any debug output here so we can ensure the program is running correctly instead of blindly double-clicking on it. Find the IDLE window titled 'plgen_mdb.py - <path>' where <path> will be the path to wherever you put the file. Bring that window to the front and press F5. This will run the script. The 'Python Shell' window should come up with hopefully no red text, and then a command prompt window will appear saying 'Press any key to continue...' That pretty much means the script ran successfully. If you did get red text, hopefully this guide will address what to do in the future. In the meantime, copy it and email it to me and I might be able to fix it.
You can now run the script just by double clicking on it. The results of this run are a collection of MDB files in the \Libraries\MDB subdirectory. They should be present. You can delete them and double click the script again and see if they return. If so, that means it's working.

You can download the latest version of the parts_list.csv file from Google Docs here. Save it to \Libraries\CSV and replace the file there.

Appendix B - CSV Parts List Structure/Adding New Parts


The online version of the CSV spreadsheet is here:https://spreadsheets.google.com/ccc?key=0AlW3tzPu0DsLdDlrODc5QlNYeWR0WmRiNllLZUM0MGc&hl=en
It is open for public editing. You can add parts and libraries. New symbols have to be added into the symbols.TCLib file from Github before they can be used. If you have Git and know how to use it then you can fork the repository and make the changes. I'll review them and integrate them.

The file itself explains the structure a bit, but I'll elaborate.

Columns: Column 1 is reserved for markup, which I will get into later. Column 2-7 inclusive are required attribute columns: Name, PPP, Ref, Symbol, Package and Description. Name is just the part's name, PPP is Parts Per Package (TinyCAD allows multiple parts per physical package - dual opamps for instance). It should not be 0. Ref is reference designator - it follows the form of <letter(s)>? For example, a reference designator for a resistor may be R5 - the code to get this form of designator would be 'R?'. Symbol is the name of the symbol TinyCAD will use for this part - it must be a name from the symbols.mdb file! You can view the symbols and their names by opening the library up in TinyCAD and editing it. Package I usually reserve for the name of a FreePCB footprint that I know is compatible with the part. Description just describes the part.

Next there is a blank column that must be present, then after that each column can be a user-defined attribute that will show up in TinyCAD when the part is selected.

That brings me to rows. Each row is either a part or markup. Markup is heavier so I'll start with that. Markup rows always have either 'library', 'header', or 'end' in their first cell. 'library' denotes the start of a new library. The name of the library is in the second cell of that row. So if the word 'solar' was in the second column, the library file name would end up being 'solar.mdb'. All other cells in this row are blank. 'header' rename the attributes for the next set of parts. Parts always have the required attriubtes mentioned above and then a blank column/cell. After that, each cell holds the name of an attribute. The parts have their values for those attributes underneath in each column. 'end' tells the script to stop reading the CSV file and ignore everything beneath it. I often put unfinished work in that area.

Everything that isn't markup is a 'part'. 'parts' is found in the first cell in each parts row. The other cells are the parts values for the attributes listed in the header row above that part.

Blank cells in the first column or cells that don't fit any of the above patterns are ignored. Blank rows are ignored also, so you can add them to improve readability.
You'll need to know a bit about the library file naming conventions before you can add parts (they'll have to be in a library - they might as well be in the right one).

Each library has a prefix that denotes what type of parts are in there. Here are some examples:
  • th - through-hole parts
  • sm - surface mount parts
  • pm - panel mount parts
  • cm - cable mount parts
  • gen - generic parts (not necessarily a specific part, just a general one like a resistor)
  • sim - simulation parts

In addition, there are several already-existing libraries that you might use:

  • Passives - these are devices that react passively to stimuli applied to them. Think resistors and capacitors. They don't have power connections and their pins aren't really inputs or outputs.
  • Semiconductors - anything with an NP or PN junction. This includes diodes. LEDs and transistors
  • Power - anything used to deliver power or that which is primarily used with it. For instance batteries and fuses are here, but PTC resettable fuses aren't, nor are varistors. Consider putting your part elsewhere first.
  • Logic - anything that implements a logic function - AND, OR, NOT, latches, flip flops, etc.
  • Electromechanical - where electronics and mechanics meet. Buttons and relays are prime examples as well as motors. There are specific sub-libraries for switches and relays simply because there's so many.
  • Mechanical - Screws, nuts, bolts and anything else non-electronic that might go on your parts list.
  • ICs - Integrated circuits. There are many sub groups for voltage regulators, comparators, op-amps, transceivers, etc. Take your pick.
  • Connectors - Whatever has pins and something else that plugs into it.
  • Headers - a subset of connectors really, but they're used for so many other things that they get their own library.
  • Indicators - These are usually panel mount lights or displays

In general for each of your parts you should try to have the following information:
  • Part name
  • Manufacturer
  • Distributor (ie, where to buy it - I like Digikey)
  • Price per unit
  • Any relevant electrical characteristics

In addition, if you have to make a new symbol please try to set the pins input/output according to what they are (Hi-Z, input, output, not connected, etc).

Use Excel or an equivalent program to edit the CSV and insert rows underneath 'library' and 'header' rows to add parts in that library with those attributes.

Discussion Area


Subject Author Replies Views Last Message
Testing sfriederichs sfriederichs 0 595 Oct 9, 2008 by sfriederichs sfriederichs