Barcodes, Partkeepr and parts providers(TME)
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:
- The slow boat from China, when piece is important and time is not.
- Ebay, basically same thing, although sometimes there are sellers in Europe, which is nice !
- TME, a polish distributor with fairly good prices and good catalogue that I tend to use when I need to be sure what I’m buying.
- And Farnell/Element14, when I need something that I cannot find anywhere else …
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
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
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
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.