Close

Costing assembly service for my PCB

ken-yapKen Yap wrote 03/07/2022 at 07:49 • 4 min read • Like

Today I decided to dip my toes into getting a PCB design of mine assembled to avoid a lot of hand soldering. JLCPCB gives out monthly coupons to offset the setup charge so that reduces the total price.

Here's what I found out, in no particular order:

It's quite straightforward to generate the two files required: the Bill Of Materials (BOM) and the Component Placement List (CPL) files, also called POS files, from KiCad. Both are CSV format files. There are many ways to do that. Here's what I did.

The BOM can be generated by the XSLT converter recommended by JLCPCB. This has to be first installed in your scripts directory then registered as a generator for eeschema. But you should also add an extra field to each symbol called LCSC. This is where you put the part number, more further down.

The CPL files (top and bottom) are generated from pcbnew (yes, BOM from eeschema and CPLs from pcbnew, reason is because not all symbol fields are passed on from eeschema, maybe in some future version). After that the header line needs to be changed to JLCPCB's headers, This sed script will do it:

#!/bin/sh
exec sed -i '1s/Ref,Val,Package,PosX,PosY,Rot,Side/Designator,Val,Package,Mid X,
Mid Y,Rotation,Layer/' "$@"

But before you generate the BOM, you need to add the LCSC (a JLCPCB sister company) part numbers. Go to the parts search and find the part numbers you need. For example C23162 is a 0603 profile 4.7k resistor.

JLCPCB has basic parts and extended parts. Basic parts are already in the PCB factory, extended parts have to be ordered from LCSC so an extra fee is levied. Vanilla parts like resistors and capacitors are definitely basic parts. Probably jelly bean transistors, diodes, and common ICs too but see next point.

There is a minimum charge of quantity 20 for each part with headroom of 5 for wastage. They won't credit you for any leftovers. Hence the recommendation to reduce the number of different parts. For example if your circuit has lots of 4.7k resistors already and a particular resistor calls for 3.9k, can you change that to 4.7k?

You upload the Gerber files as usual for PCB fabrication. At the bottom you then select SMT assembly. NB: If you only order 5, you can have 2 assembled and you have to do the rest yourself. So you have to order a minimum of 10 boards if you wish to avoid doing 3 by hand. Only one side of the PCB will be assembled. So put all the SMT components you don't want to do yourself on one side, usually the top. Thus only one CPL file is needed.

You then upload the BOM and the CPL files and a quote will be generated, a sample is in the screenshot. But before you do that you may wish to cull the components in the BOM and CPL files that are not to be assembled. But the web page will filter out those components without a part number anyway.

You can see that the setup fee and stencil cost the most. The components and SMT assembly are really cheap, even for the hundreds that I used in my sample order.

The preview window also shows if your CPL file is correct. The black chips are the components which will be placed by machine and soldered. At some point in your adventures you may encounter this issue:

The transistors are rotated 180° from the correct orientation, and although the IC can barely be seen (due to stock shortage at the time I did this quote), it's 90° wrong too. It all comes down to a mismatch between what is regarded as the normal orientation between KiCad and their database. To fix this you have to edit the orientation column in the CPL file and try again. Unfortunately you have restart from the Gerber file upload. (May not be necessary.) If you haven't corrected the orientations before the job is started, their engineers will fix the issues and send you a preview for confirmation, so it is strongly encouraged that you provide a mark, such as the filled circle you see near pin 1 of U1 to help them get it right.

The coupon is $8 so that brings the cost down to $14. Shipping is on top, say another $8-$10 by cheap but slow channels. So 10 boards for about A$2+ each, which is worthwhile not to solder 330 resistors and 40 capacitors. The ICs are relatively easy to solder compared to the tiny components.

Like

Discussions

Ken Yap wrote 09/08/2023 at 01:50 point

Here's a tip for finding Basic Parts from JLCPCB. Try other combinations on the model number of your component.

For example I was looking to use the TL431 adjustable shunt regulator in my circuit. All of the TL431 models were Extended Parts, thus incurring extra cost. However when I used 431 for the search, then narrowed down to Voltage Reference devices, then ticked the Basic Parts box, the remaining result was the CJ431, which is a workalike made by a Chinese manufacturer for just over 3¢ each.

A similar story with looking for the 2N3904, first search using 3904, then narrow down to Bipolar Transistors, then Basic Parts leading to the single result MMBT3904 for just under 1¢ each.

However I've discovered that the only signal or rectifier diodes that are Basic Parts are the 1N4007 workalikes like the SM4007. Fortunately I need a diode only for the forward voltage drop, and the overspecs and slightly larger body (SOD-123) aren't issues.

  Are you sure? yes | no

Dennis wrote 04/30/2022 at 15:22 point

If you use JLCPCB's assembly service, you may find a script that I wrote useful: PnPPP - Pick and Place Pre-Processor. It processes BOM files and can auto-rotate components into the right orientation, help with panelization, delete unwanted lines, rename or remove columns etc. It can be configured directly from within your CAD tool.

I developed this for use with Altium CircuitStudio and JLCPCB's PCBA service, to minimize the need for patching BOM files, especially due to components with wrong orientation. The script allows to set a rotation offset per component once and for all as a parameter in your schematic component and then it automatically rotates the components in all future projects. This is a much better solution than either modifying the CAD data or having to edit pick-and-place files by hand.

https://hackaday.io/project/178530-pnppp-pick-place-pre-processor

  Are you sure? yes | no

Ken Yap wrote 04/30/2022 at 16:16 point

Thanks, looks impressive. I doubt I'll do enough boards and distinct components for it to be worth the setup effort. I expect only one PCBA design in the next few months. Also, I use KiCad.

  Are you sure? yes | no

Dennis wrote 05/02/2022 at 16:24 point

PnPPP should also work with KiCAD or any other CAD program as long as they export BOM and Pick-and-place files in CSV format. It only hasn't been done yet since nobody knows PnPPP :) I guess it would also be of great help for anyone running their own Pick-and-place machine. Hopefully that will include myself one day.

  Are you sure? yes | no

Tim wrote 03/07/2022 at 10:30 point

I usually import any PCB I want to have populated into EasyEDA. Allows to do final DRC, assign correct components and export the files in the way that JLCPCB needs them.

  Are you sure? yes | no

Ken Yap wrote 03/07/2022 at 11:12 point

I prefer not to depend on a cloud service for designing my PCBs. In any case the procedure for JLC is pretty straightforward, and probably equally easy for the other houses, just a matter of finding bargains. There are even plugins for KiCad to automate it further, but I won't be doing lots of PCBs. There aren't enough hours in the day to do all the things in life.

But since you mentioned import, do you know if they support v6 files now?

  Are you sure? yes | no

Tim wrote 03/08/2022 at 11:53 point

I don't use it for design, only for verification and final clean up to make sure that the files are in the way JLCPCB needs them. Typically I design in Eagle and then import into easyeda

  Are you sure? yes | no

Ken Yap wrote 03/08/2022 at 12:21 point

Ah well, given that they sometimes have issues with files generated by KiCad, I wouldn't trust their conversion from KiCad files, especially as v6 hasn't been out long. Anyway, I was more interested in the pricing structure than the BOM and CPL generation.

At the moment I'm playing with KiKit which is a add-on package which among other things claims to automate generation of fabrication outputs for various manufacturers.

  Are you sure? yes | no