Giter Site home page Giter Site logo

getparts's Introduction

What is getparts?

Getparts is a Python3 tool takes a supplier barcode value as an input and returns component information. Currently works for most Digi-Key, Mouser, and some LCSC bags.

Barcode Status

2D 1D
Digi-Key
Mouser
LCSC

Why?

Nearly every electrical component ordered online will be packaged and marked with a barcode containing relevant part information. Supplier-specific API are starting to emerge, but I needed a single tool that would retrieve part info from a variety of suppliers with and without search API.

How?

An example script is included that lets you use a webcam (laptop or usb webcam) to scan barcodes on component bags (Digikey, Mouser, and LCSC). This barcode value is fed into getparts which then tries a variety of techinques to retrieve the part information. Uses Python3. Works for 2D DataMatrix, QR, and 1D barcodes.

  • getparts.py handles all the API calls and refresh tokens (when necessary).
  • webcam_example.py is an example using a webcam. There are lots of debug messages to help others troubleshoot their own scripts.

Some setup required. See 👇 for a guide setting up a Digikey/Mouser API and running the python script.

📃 Step-by-step Tutorial

In Action

Detailed Barcode Status

  • Digikey: DK provides a fully functional barcode API for product and invoice info. 👍 good job DK!
    • ✔ 2D: specific API exists for invoice and product info queries. QR code is data matrix format.
      Always starts with [)>
    • ✔ 1D: specific API exists for invoice and product info queries. QR code is data matrix format.
  • Mouser: There's a part number query API, but no native barcode searching.
    • ✔ 2D: PN is extracted from DataMatrix (always starts with >[)>) and searched using Mouser's API
    • ➖ 1D: Script can read the barcodes, but currently has no way of telling which barcode value correlates to which property because there are seperate 1D barcodes for Cust PO, Line Items, Mouser P/N, MFG P/N, QTY, COO, and Invoice No.
  • LCSC: No API. So we have to scrape.
    • ✔ 2D: Some of my LCSC bags have QR barcodes (1 in 10 I'd guess). The QR code contains: productCode, orderNo, pickerNo,pickTime, and checkCode. So far all the tool can do is search LCSC for the PN but the user needs to navigate the page and extract the info. Need to write a javascript web scraper.
    • ❌ 1D: String ~10 characters in length. Can't extract anything useful from these.

      Since the majority of LCSC bags don't (currently) have QR codes, I'm curious how feasible OCR on the LCSC PN will be. Using tesseract:
      it seems doable, but this will heavily depend on user environment. More to come.

This tool was developed to aid inventory management via InvenTree

getparts's People

Contributors

cmonr avatar maholli avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.