Build a Raspberry Pi Barcode Inventory Scanner for Shop Supplies and Small Parts
A shop with more than a handful of bins — screws, connectors, filament, laser lens spares, sandpaper grits, whatever fills your parts drawers — eventually hits the point where "I know where everything is" stops being true. This project turns a Raspberry Pi and a cheap USB barcode scanner into a standalone inventory station: scan a bin's label, see or update the quantity, and know what you're actually low on before a project stalls waiting on a part that's been out of stock for weeks. It's deliberately simple — no cloud service, no subscription, just a Pi, a local database, and a scanner — and it's a different tool for a different job than the RFID-based tool checkout system covered elsewhere on this site, which tracks who has which tool rather than how much stock remains of a consumable.
Why Barcode Instead of RFID or NFC
RFID and NFC (covered extensively in our Flipper Zero and general electronics content) are great for access control and unique-item tracking, but they need tags with an embedded chip, which gets expensive and fiddly at the scale of "every bin in a parts cabinet." Barcodes are free to generate, print on a standard label sheet or even a thermal receipt printer (see our ESC/POS thermal printer guide for a natural pairing project), and a USB barcode scanner that emulates a keyboard needs zero custom driver code — it just types the scanned number followed by an Enter keystroke, exactly like someone typing on a keyboard and hitting Return.
How the Hardware Works Together
- The USB barcode scanner plugs directly into the Pi and appears as a standard USB HID keyboard device — no special drivers, no GPIO wiring, no configuration beyond plugging it in.
- A simple Python/Flask web app runs locally on the Pi, listening for input the same way it would listen for someone typing into a form field.
- An optional 7-inch official touchscreen turns the Pi into a standalone kiosk sitting on the workbench, running the app full-screen in kiosk mode — the same browser-to-webpage kiosk technique covered in our Raspberry Pi kiosk mode guide, pointed at your local inventory app instead of an external site.
Setting Up the Software
- Start from a headless Raspberry Pi OS install (see our headless Pi setup guide if you're starting from scratch), then install Python 3, Flask, and SQLite — SQLite is more than sufficient for a shop inventory database and needs no separate database server to maintain.
- Build a simple schema: one table for items (barcode value, description, category, quantity, reorder threshold, location/bin) and one table for a transaction log (every scan, in or out, with a timestamp) so you can see usage history, not just a current snapshot.
- The core scan loop is almost embarrassingly simple: the Flask app's main page has a single focused text input field. A scan types the barcode value into it and sends Enter, which submits the form. The backend looks up that barcode, and depending on which mode the station is in (check-in, check-out, or lookup), increments or decrements the stored quantity and logs the transaction.
- Add a low-stock view — a simple query listing every item where quantity has dropped below its configured reorder threshold — and check it before ordering supplies instead of guessing from memory or a walk around the shop.
Labeling Your Bins
For items that already have a manufacturer barcode (most retail-packaged screws, electronics parts, and consumables do), scan the existing barcode directly — no new label needed, and the barcode value becomes your natural unique key. For bulk bins, homemade parts, or anything without packaging, generate your own barcodes with any free Code128 or QR generator, print them on adhesive label sheets sized for your bins, or drive a thermal receipt printer directly from the Pi to print labels on demand as you add new bins to the system.
Extending the Project
ExtensionWhat it adds Low-stock email/notificationA scheduled script that checks the reorder threshold table and sends an alert when something drops below it, instead of relying on someone checking the dashboard Multi-station setupPoint several Pis at one shared network database (swap SQLite for a small PostgreSQL instance) so a shared makerspace can scan from several benches at once QR-code generation for new binsAuto-generate and print a new barcode/QR label the moment a new item is added to the system, rather than manually creating one Home Assistant integrationExpose low-stock alerts as a sensor entity through MQTT, feeding the same dashboard used for the rest of a shop's monitoring, similar to the MQTT/Node-RED patterns covered elsewhere on this siteKeeping It Honest
The single biggest failure mode of any inventory system, digital or otherwise, isn't the software — it's people (including future you) forgetting to scan something out. Mount the station somewhere it's genuinely in the path of grabbing parts, not tucked in a corner that adds friction to using it, and consider a simple physical rule: nothing leaves a bin without a scan. A system that's 90% accurate because it's actually used beats a perfectly designed one that gets skipped half the time because it's inconvenient to reach.
This is a deliberately small project — a few hours of setup gets a working station — but it scales with the shop. Start with the bins you re-order most often, get the scan-in/scan-out habit established, and expand the database as you label more of the shop over time rather than trying to inventory everything in one marathon session.