Autogenerated kicad libraries for jlcpcb assembly

I’ve hacked up a shell/python arrangement to pull the assembly parts database from JLCPCB and generate some kicad libraries.

I’ve only done basic parts (for which you don’t pay a per reel fee) and I’ve only done resistors, mlcc capacitors and leds in 0402/0603/0805/1206 (being 90% of the work by volume).

There are two kinds of libraries, one with all the components of one type (eg. all the resistors) and another with the components of one type and one package (eg. all the 0402 resistors). The advantage of the latter is that you can pick by value.

The packages are deliberately not qualified by their footprint library so you can use your own footprint of the same name and let eeschema resolve to the footprint library (old style).

I’ve been finding the jpcpcb assembly service a game changer, for little cost it takes the repetitive part out of electronics and leaves most of the fun. I’m not affiliated or sponsored by jlcpcb, just another customer.

The libraries are at https://github.com/TomKeddie/prj-kicad-jlcpcb/tree/main/libraries, the scripts at https://github.com/TomKeddie/prj-kicad-jlcpcb/tree/main/scripts. Ideally I’d use circleci to update the libraries regularly but I’m not there yet. This was hacked up without looking at the spec for the .lib and .dcm files (yes, I know…). It seems to work, please log an issue if you find anything wrong.

1 Like

I don’t understand why I would need this for resistors, capacitors and diodes of all things.

These libraries supposedly contain additional parts data needed if you want to use the assembly services at JLCPCB. You get this data by export from KiCad instead of having to enter it manually at the JLCPCB website.
(This is my understanding, though there might be some details I have missed as I haven’t yet used the JLCPCB assembly myself.)

Because they only stock certain parts even for jellybean parts (resistors, capacitors, etc).

To make up an example out of thin air, if you design your board with a Vishay resistor in location R3 and send them the assembly files they may choke on it because they only stock AVX resistors. There might be a direct spec-compliant replacement between the manufacturers. But it shouldn’t be up to them to find a replacement AVX resistor for the Vishay resistor you specified, especially if they provide information telling us, the end users, that they only carry AVX resistors. It’s called working with your suppliers instead of against them.

Putting extra symbols in doesn’t help that though. I dont need a different symbol for a 10k resistor from manufacturer A Vs manufacturer B. Or even between different values. Just change the value.

1 Like

When you use an assembly service you need to supply their part number not a component value. So if your circuit has 15 different resistors in it and say 3 different caps, you have to look up that part number for each component by hand. This is a lot of work and error prone.

There are also significant cost savings to be had from altering the schematic to place resistors in parallel to form the value you want rather than paying a reel loading fee for a non-standard part. It helps a lot to have the values you have available to you close at hand during schematic design.

Clearly you’re in the wrong thread, I find this very useful and think it’s worth sharing.

I have used the JLC assembly service. And you do not need to supply their own part number (though you can do, but still, even in that case… You don’t need a library of special resistor symbols)

The problem with this approach is that you have no control and limited visibility of the Jlc database. It is a moving target that may change daily.

A more useful tool would take a Bom and associate Jlc part numbers, adding them to the Bom .csv

3 Likes

Thanks for sharing. I think everybody who shares his/her (I suppose nowadays I should add “its” ? :slight_smile: ) work for free deserves thanks even though you do not find it useful for you or your workflow…
I do understand how this can be helpful with JLCPCB workflow, when combined with JLCPCB BOM plugin. It takes out one tedious (and thus error prone) step - assigning the part numbers on the website to the components.
There are people that are not designing stuff for space ships and just need to design simple board and they know from start that they will use JLCPCB for PCB manufacturing and assembly and will make the design to fit JLCPCB’s libraries and processes…
Just yesterday I was ordering a simple arduino nano breakout board with cca 20 pullups and few LEDs. The assembly cost was 8USD including components…

This is interesting topic for me. You do not need to supply their part number, however if you do, then the system will recognize it “with confidence”. That means that you do not need to confirm the part-library match on the BOM page…

And having library of components for JLCPCB could be one way how to achieve it. I am doing it a little differently, I have my own libraries (usually containing only one or two similar components) and that are the libraries of “components I use”… Every library is separate project in git and I include it as submodule to the main git project. It is a little tedious but it keeps everything well organized.

Then I have created bunch of scripts running a lot of KiCad automation tools from git. So basically I commit the work on my workstation, then run a script on the server and it will create one big zip file with schematics, gerbers, pcb renders, BOMs, CPLs, etc… and it will automatically create a JLCPCB directory with files (gerbers, BOM, CPL in correct format) that I can use on JLCPCB site without any modifications…

I have started to use Inventree and I have all components I use entered into it so I am thinking about creating some sort of script to create the libraries automatically.

Thanks @DavidR and @Kedarius didn’t realise this was even possible. Personally I’m interested in keeping JLC’s costs low so I work hard to get everything right first time and avoid ending up in the customer service queue (you get your order faster this way too). Things go wrong from time to time, especially with rotation, but I still keep this as a personal goal.

1 Like

Look at the JLC guide here: https://support.jlcpcb.com/article/84-how-to-generate-the-bom-and-centroid-file-from-kicad

No need for custom symbols or footprints.

You are right. You do not need any custom symbols. You can lookup and enter the LCSC number every time you add a component. Or to make it even more difficult you do not need to enter the LCSC number at all and just look it up every time during ordering process…

1 Like

You are right. You do not need any custom symbols. You can lookup and enter the LCSC number every time you add a component. Or to make it even more difficult you do not need to enter the LCSC number at all and just look it up every time during ordering process…

Or you can have a table with all values, sizes and types and a script that assigns the correct type in the BOM. It is simpler to create a schematic, easy to change a value, doesn’t violate the DRY rule and does not need a large library which has the same component multiple times.

1 Like

You are right. That is also a viable option. There are many ways how to skin a PCB and everybody is free to choose the right one for him/her…
I see two disadvantages in your approach. First is that you do not have all the information in your schematic (i.e. datasheet). But that may not be important for you and it is perfectly fine… The other disadvantage is that if your are aiming for JLCPCB assembly, you can not just change the value - you need to check if the needed value is available and what kind of JLCPCB’s library it is.