Barcodes, Partkeepr and parts providers(TME)

2018-03-08

Update 2021-05-29: I don't use Partkeepr anymore. It's been a pain to maintain and update over time. I wrote this nasty thing which is good enough for me.

Electronic parts are small ... and they get smaller and smaller when you go down the rabbit hole of SMD components. They are also really difficult to organize and catalogue. There are useful tools like Partkeepr to help you keep things tidy and, most importantly, don't buy things twice because you can't find them or you don't remember where the hell they are (or even don't remember that you have them).

The only drawback to that is that you have to manually insert all the parts that you buy ... which is tedious.

I basically get my parts for 4 places:

It turns out that the last 2 have good APIs to query their catalogue. And specifically TME adds a little iQR code to all their packages with some info.

With any old webcam you can find, and zbar, you can extract the info on that iQR code easily, and dump it to stdout. It looks something like this (this is a little 12V fan):

QTY:1 PN:HA50151V4 MFR:SUNON MPN:HA50151V4-000U-999 PO:xxxxxx/x https://www.tme.eu/details/HA50151V4

where:

  FIELD   NAME   Desc
  0       QTY    Quantity
  1       PN     Part Number
  2       MFR    Manufacturer
  3       MPN    Manufacturer part number
  4       PO     Order Number (at TME)
  5              Url of the product at vendor(TME)

That's easy to parse, and contact TME's API for more info.

I've put together a little python3 script that takes that from stdin and makes all the necessary calls (to TME and then to Partkeepr), so I don't have to enter my TME orders by hand anymore. You can find it here

You'll need a token and secret from the distributor. So go to their developer's page and sing in.

It downloads the datasheets too (if they have any) and uploads them to Partkeepr. If the item is already in the db, it just increments the stock.

On the git page you can find more info, but it's really easy to use, just pipe the output of zbar to the script like this:

zbarcam --raw /dev/video0 | ./parteye.py

If I order something from Farnell I'll check if they do something similar, so I can adapt the script.

Have any comments ? Send an email to the comments address.