Optimal inventory management with KiCad integration (Inventree, Ki-nTree, ...)

Hi everyone, I’d like to talk about a rather serious subject when integrating KiCad with inventory management tools like Inventree.

First, let me present the parts of the system.

One of such inventory tools is Inventree, there are other tools as well (Part-DB, PartKeepr). If you think some other tool works better, please suggest it. I’m not invested in Inventree, it just seeed like the most complete solution.

The point of such tools is to keep an inventory of components you’re stocking, allowing you to add components to your stock when you buy them from the suppliers, and remove them when you build and sell your boards.

One of the functionalities is obviously exporting you BOMs from KiCad and importing them into Inventree (GitHub - clj/kinventree-bom: A KiCad plugin to push BOMs to InvenTree) as parts (which can be organized into larger parts, like whole products), so you can track how many you can build with the current stock, order new stock to build x parts, etc.

The rest of the process is, of course, obtaining schematic symbols and footprints (drawing or generating them as last resort), putting them into your local lib along with all the pre-requisite data that allows Inventree to identify them on BOM import, and allows you to actually draw the schematics and lay out the PCBs. I’m guessing everybody likes building their little library of components and reusing them in their designs if possible, and it also makes sense from the inventory standpoint.

Ki-nTree (which I contributed to) handles a part of that process, but not in a very optimal way for non-trivial (non-R/C/L) components. To obtain symbols and footprints of non-trivial parts (non-R/C/L), you can use SnapEDA, UltraLibrarian, with impartGui doing the actual library import.

Now, the issues

Not all kinds of parts are treated the same: there are jellybean parts, semi-jellybean parts and proprietary parts, and I treat each group differently (as do many other users). When using Ki-nTree for import, it gives custom generated names for all of them, but that’s not optimal:

  • for proprietary parts (say STM32F405RG), you really want them to be named by name, in KiCAD and in Inventree
  • for jellybean semiconductors (say TL072 in SO8), you want some sort of common name that’s recognizable, in both KiCad and Inventree
  • for trivial components like R/C/L and such, you really don’t want to see anything proprietary in the naming, it should reflect the specs. I’m specifying a 100n 5% 10VDC X7R cap in 0603, I couldn’t care less if it’s Kyocera 0603ZC104JAT4A or Vishay VJ0603Y104JXQCW1BC or whatver. I’ll buy the cheapest one every time.

Now, Inventree does support the distinction: Part (100n 5% 10VDC X7R cap in 0603) can have multiple Manufacturer parts (Kyocera 0603ZC104JAT4A, Vishay VJ0603Y104JXQCW1BC, …), which can have multiple suppliers (LCSC, Mouser, …). It then makes sense to call that part something like CAP-CER-100n-T5-10VDC-X7R-SMD0603, and use it like that in both KiCad, and in Inventree. The TL072 can be called IC-TL072-SO8, and can also have multiple manufacturer parts. STM32F405RG can be IC-STM32F405RG-LQFP64. I could create all of these things by myself in Inventree, then add them to KiCad in my own library, but it’s so much work. Not to mention adding manufacturer parts from the suppliers, a nightmare. Something like Ki-nTree would work if it could support naming like this, but currently it really doesn’t.

What’s also important on the KiCad side is that the part needs some sort of Inventree-identification field (so that Inventree can import the BOM), and it needs its Datasheet field to be populated; a link to the Inventree part would be nice. It’d be awesome if Ki-nTree or Inventree could get the datasheet and save them into the parts as attachments, and then use that link instead of the online link for the KiCad part. Ki-nTree already gets images from the providers. I could start modifying Ki-nTree to do this all, or writing a from-scratch little CLI solution, but I’d love to know if someone else does this in some smarter and already existing way.

There’s this inventree_kicad Inventree plugin which allows you to use the HTTP lib interface in KiCAD, but I’m not sure how that fits in w/ this whole model.


Are my assumptions here wrong? Is there a more sensible workflow?

If this workflow does make sense, are there tools facilitating it that I don’t know of? How do you do it?

Another part that I didn’t mention is updating the supplier pricing in Inventree: how do you update prices?

1 Like

I developed this for use with PartKeepr and Octopart. However, PartKeepr has unfortunately largely been abandoned by its original author and Octopart has changed the API and also changed its charging model (and been bought out by Altium). So I have not updated this for a while & this is ‘abandonware’ but it might help with some ideas.

I followed pretty much what you noted - proprietary parts use manufactures numbers. Jellybean R/C/L were chosen by matching against stock in the PK database.

I use SQL ‘views’ into my PartKeepr database to generate libraries of jellybean components which I can use directly within KiCad. The authors of inventree seemed to really dislike that idea!

I used a BOM processor to use Octopart to identify best value supplies from my favourite dealers and directly summarise which components I held in stock and what I was going to order from where. I also generated pick lists for components and bag labels.