Create one library link for many components


#1

Hi Folks,
Nice forum. This layout is much better than the UK one! Good work.
Now…
I am creating picaxe IC’s in the library editor and would like to have one heading to select them all. That is, when you select to place a component (when building a schematic), you will see picaxe and then when you expand it all my picaxe IC’s will be under that heading, bit like when you see +74xx, click on it and see all the 74 series IC’s.

Thanks
Jamie


#2

Hi Jamie

You can do that by copying the definitions for the components you want into one library. Then, when you see the list the library name you’ve created will have a + next to it, which when you expand will show everything you’ve put in there.

If you’ve created custom components you probably already created a library of your own, which contains these. You can easy add other components into that file (or create another file like it) using a text editor. I use [Notepad++][1] to copy components I find online to my custom library, rather than adding a whole heap of new .lib files which only have 1 or two components each.

The format is pretty easy to follow - so if you open a library you know to have your picaxe ICs in it, you can search for them then copy the blocks into your new Picaxe.lib and they’ll all be in one place. If you want to start with a new library for this, copy an existing .lib file, and remove all but the first line. Anything starting with a # is a comment, and the name of each component is commented before the definition to make them easier to read. The first line of any component starts with DEF and the final line bookends that with a ENDDEF. Copying this block below would add this component to your custom library.

#
# Rotary_Encoder
#
DEF Rotary_Encoder ROT 0 40 Y Y 1 F N
F0 "ROT" 350 -450 60 H V C CNN
F1 "Rotary_Encoder" 0 -200 49 H V C CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
DRAW
C 0 0 141 0 1 0 N
S -350 -350 -350 250 0 1 0 N
S -350 250 -350 250 0 1 0 N
S -350 250 300 250 0 1 0 N
S -200 200 -100 200 0 1 0 N
S -200 250 -200 200 0 1 0 N
S 200 200 100 200 0 1 0 N
S 200 250 200 200 0 1 0 N
S 300 -350 -350 -350 0 1 0 N
S 300 250 350 250 0 1 0 N
S 350 -350 300 -350 0 1 0 N
S 350 250 350 -350 0 1 0 N
P 2 0 1 0  -100 100  100 100 N
P 2 0 1 0  -100 200  100 150 N
X A 1 -200 -550 200 U 50 50 1 1 P
X C 2 0 -550 200 U 50 50 1 1 P
X B 3 200 -550 200 U 50 50 1 1 P
X S1 4 -200 450 200 D 50 50 1 1 P
X S2 5 200 450 200 D 50 50 1 1 P
ENDDRAW
ENDDEF
#

The final step is to get KiCad to know to look there, in eeschema choose Preferences/Set Active Libraries and add it.

Cheers, Geoff
[1]: http://notepad-plus-plus.org/


#3

Wow!
Easy to do. Great explanation.

Thanks a lot for that Geoff, much appreciated.


#4

Hey Jaden,
Is there any chance you’d be able to make “public” the library for your picaxe parts? I’ve been hunting everywhere for them, and can’t find them. I’m using picaxe chips for a college project and a model railway project, and due to time constraints on the college project I don’t have the time remaining to learn how to create a component from scratch before I need the PCB made!

Cheers


#5

I will give you what assistance I can, but first your post compels me to speak like a parent - which I am. I’m somewhat out of practice, since my “baby” must be nearly a decade older than you. However, he IS in college - scheduled to defend a doctoral dissertation in a couple of weeks - so I’m not entirely unacquainted with the hardships faced by students. For that matter, I’m not personally as far removed from the college classroom as you might think: I was over 40 when I returned to school.

When do you need this board completed? Did you notice that you are responding to a thread that has been inactive for over two years? If you are truly so inexperienced with circuit board layout that creating a schematic symbol is a major task, then I doubt that you have enough time to create an effective layout. Perhaps your time is better spent giving your instructor’s car a good wash and wax.

Similar requests appear on this Forum a time or two each month. The general consensus was summarized by @Joan_Sparky about six months ago, in the thread at " Libraries very limited? ":

In fact, I suspect your situation is significantly easier that that. I invested 5 minutes into satisfying your request, and discovered that “Picaxe” is simply a family of Microchip’s PIC microcontrollers, with a pre-programmed bootloader pushed into a secure partition of the codespace. The Picaxe uC’s come in standard DIP packages, so the footprint part of the library work is already done!

(Did I get that right? I am unlikely to live long enough to discover and correct all my mistakes on my own, so please point out any errors I make.)

OK, so maybe I oversimplified the footprint situation. As @Joan_Sparky wrote, most of us are not totally pleased with the “stock” KiCAD footprints for various reasons. We almost always adjust or supplement them to satisfy local requirements or personal preferences; at the very least we carefully audit them against manufacturers’ data sheets. Even if you are the pickiest layout designer (or is that " PIC-Ki-est "?), the footprint creation task is 80% - 90% complete for you.

Now for schematic symbols. As I mentioned, PICaxe is a Microchip PIC microcontroller. KiCAD appears to have a fairly extensive collection of symbols for Microchip’s parts. If you installed local libraries, you’ll find them at {KiCAD_Installation_Directory}\share\kicad\library . Look for library titles that include “microchip”. Open KiCAD’s Symbol Editor, and find a standard PIC part that seems to be the basis for your PICAxe part. (At least get the number of pins correct.) Save the symbol with a new name - perhaps in a new library. Then you can change the pin names to whatever nomenclature PICAxe uses. I estimate this would take about 30 minutes, for a microcontroller with a pin-count you can handle in a college project.

Of course, you can take a little time to impress your instructor and make your future tasks a little easier by re-arranging the pins and customizing the symbol. Most uC pins have three or four (or five or six or seven . . . ) possible functions, configurable in the firmware. It’s not necessary to list ALL of them on the schematic symbol - only the ones that actually apply to your application. For example, it’s not necessary to show that a pin COULD BE a PWM output, or an A/D input, if you will only use it as a General I/O. I believe that leaving off those unused function designators makes the schematic more readable, and makes your design intent more obvious to those who see the diagram in the future (including yourself). I have not yet done a microcontroller project in KiCAD, but in prior incarnations I always created custom symbols when my projects used uC’s.

In this Forum (and others serving similar communities), “initiative” is an admirable trait. Posts that sound like, “Gimme what I need because I can’t be bothered with learning it myself.” get ignored if the poster is fortunate. Posts that say, “I tried to do {something}. Here’s the {file/screenshot/squawk} that resulted. I can tell I’m not even dressed for the game, much less in the right ballpark. What’s the first step I should take to get on the right road?” will sometimes get more assistance - useful, detailed assistance - than you can handle!

Dale


#6

Cheers, mate,
I see where you’re coming from. The problem I had was that we aren’t getting taught anything close to PCB design, or even electronics. there isn’t anyone in the college that has that expertise!!! I knew that the picaxe chips were based off a PICMicro; my major concern was that I couldn’t find even them in the product library, and the DIL parts that were in the library didn’t necessarily list the pin pitches. I take it from this that I can assume the pin pitches are correct?

And aye, I knew the dates on the posts, but I genuinely couldn’t find any other information regarding picaxe chips on the forum… That, and I posted it after spending a couple of hours hunting for info myself, and was very ready for bed… (student life…)

Finally, I’m not really concerned with the design of the board as such, it’s going inside a 2x1.5m model of a ship’s aft end, so all it needs to do is work - And the people I need to impress are my manager, the head of Detail Design and potentially one of the heads on Engineering at the company I work for (We’re a group of apprentices)

Thanks though, in all seriousness, point taken on board. That, and the note that I perhaps shouldn’t be posting at 11:30PM when I’m half asleep… :slight_smile:


#7

As a first approximation, assume that integrated circuit (IC) package dimensions are standardized enough to be interchangeable, until you have information that shows otherwise - especially when dealing with through-hole parts. There ARE minor variations and nuances from one manufacturer to another, and even a few variations specific to one manufacturer, but when it comes to the locations and sizes of electrical connections you may assume that things which appear to be interchangeable, are in fact interchangeable. You can confirm this with a cursory check of a few basic dimensions on the footprint.

I presume you intend to use the through-hole version of the PICAxe parts, in the “dual in-line packages” (DIP). These have been widely used since the early 1960’s; I don’t recall whether Fairchild, or Texas Instruments, are credited with the original invention. The connection pins are spaced on 0.1" (2.54mm) centers, sometimes called “0.1” pitch". When the pins are straightened to be perpendicular to the package’s seating plane, they are 0.3" (7.62mm) apart for devices with about 20 pins or less. For devices with more pins, wider row-to-row spacings are used.

To illustrate what I said in my previous post I created a custom schematic symbol for a PICAxe-20M2. I opened the KiCAD symbol editor, loaded the symbol for a PIC microcontroller (the 16F1829, as I recall), and created a new library. I gave the symbol a new name and changed some of the other administrivial stuff (datasheet, description, etc). I then re-named and regrouped the pins to suit a fictional project. Here’s how it came out:

As you can see, my imaginary project uses five A/D inputs and creates three PWM outputs plus three other logic outputs. There’s an I2C port - possibly connected to a serial EEPROM - plus a classic asynchronous RS232-like serial port. The PICAxe pin “C.6” might be a logic input or may get flagged with KiCAD’s “unconnected” symbol. (I never liked to use the PIC’s MCLR pin if I could avoid it - being part of Microchip’s ICSP scheme imposed some constraints on what I could connect to it, and I just felt squeamish about using a pin for general-purpose input, when it’s original primary function was to receive a hard RESET signal.)

The PICAxe power and programming pins round out the symbol. This fictitious project must use the uC’s internal clock oscillator, since the symbol doesn’t label any pins as “XTAL” or “CLK”.

Are you starting to see how much information you can convey about your design, simply by how you drafted the microcontroller’s schematic symbol? I have attached the KiCAD file containing this symbol, for you to study, dissect, or alter as you wish. You may want to compare it to the symbol I started with.

PICAxe.dcm (256 Bytes)
PICAxe.lib (1.2 KB)

If you have more questions (I’m sure you will, if you see your project to completion) or get stuck someplace, start a thread with your question. Give some indication of what you’ve already done to find an answer and you should see a reply within a couple of hours. The majority of Forum members seem to be in North America, but others are in Europe, Singapore, India and China so time zones aren’t the impediment you may think they are.

Well, it’s after midnite here in St Louis (roughly the center of North America) and my wife has indicated she is in bed, waiting for me to perform certain Husbandly Duties. :grinning: Keep us informed of your progress.

Dale