sources for e1e0 website
git clone https://git.e1e0.net/e1e0.net.git
Log | Files | Refs

partkeepr-barcodes-and-TME.md (2984B)

      1 Title: Barcodes, Partkeepr and parts providers(TME)
      2 Author: paco
      3 Date: 2018-03-08
      4 Type: article
      6 _Update 2021-05-29: I don't use Partkeepr anymore.  It's been a pain to
      7 maintain and update over time.  I wrote [this nasty thing][7] which is good
      8 enough for me._
     10 Electronic parts are small ... and they get smaller and smaller when you
     11 go down the rabbit hole of SMD components.  They are also really difficult
     12 to organize and catalogue. There are useful tools like [Partkeepr][1] to
     13 help you keep things tidy and, most importantly, don't buy things twice
     14 because you can't find them or you don't remember where the hell they
     15 are (or even don't remember that you have them).
     17 The only drawback to that is that you have to manually insert all the
     18 parts that you buy ... which is tedious.
     20 I basically get my parts for 4 places:
     22 * The _slow boat from China_, when piece is important and time is not.
     23 * Ebay, basically same thing, although sometimes there are sellers in
     24   Europe, which is nice !
     25 * [TME][2], a polish distributor with fairly good prices and good catalogue
     26   that I tend to use when I need to be sure what I'm buying.
     27 * And [Farnell/Element14][3], when I need something that I cannot find
     28   anywhere else ...
     30 It turns out that the last 2 have good APIs to query their catalogue. And
     31 specifically TME adds a little iQR code to all their packages with some
     32 info.
     34 With any old webcam you can find, and [zbar][4], you can extract the info
     35 on that iQR code easily, and dump it to `stdout`.  It looks something
     36 like this (this is a little 12V fan):
     38     QTY:1 PN:HA50151V4 MFR:SUNON MPN:HA50151V4-000U-999 PO:xxxxxx/x https://www.tme.eu/details/HA50151V4
     40   where:
     42       FIELD   NAME   Desc
     43       0       QTY    Quantity
     44       1       PN     Part Number
     45       2       MFR    Manufacturer
     46       3       MPN    Manufacturer part number
     47       4       PO     Order Number (at TME)
     48       5              Url of the product at vendor(TME)
     51 That's easy to parse, and contact TME's API for more info.
     53 I've put together a little python3 script that takes that from `stdin`
     54 and makes all the necessary calls (to TME and then to Partkeepr), so I
     55 don't have to enter my TME orders by hand anymore.  You can find it
     56 [here][5]
     58 You'll need a token and secret from the distributor. So go to their
     59 developer's [page][6] and sing in.
     61 It downloads the datasheets too (if they have any) and uploads them to
     62 Partkeepr. If the item is already in the db, it just increments the
     63 stock.
     65 On the git page you can find more info, but it's really easy to use,
     66 just pipe the output of zbar to the script like this:
     68     zbarcam --raw /dev/video0 | ./parteye.py
     70 If I order something from Farnell I'll check if they do something
     71 similar, so I can adapt the script.
     73 [1]: https://www.partkeepr.org/
     74 [2]: https://www.tme.eu/
     75 [3]: http://farnell.com
     76 [4]: http://zbar.sourceforge.net
     77 [5]: https://git.e1e0.net/parteye/log.html
     78 [6]: https://developers.tme.eu
     79 [7]: https://git.e1e0.net/partsdb/log.html