Bar Code Scanner

I've been thinking (on and off) for over a year of a way to improve how I store and more importantly, how I find my electronic components. Like a lot of people I have (plastic and metal) storage cabinets that comprise of rows of drawers (in which I place all the various items I have acquired and purchased over the years). At the moment I have thin cardboard labels that I place inside each drawer. For components I use regularly I can remember... "oh that's in the third drawer (from the left) on the second row" (unless of course the drawer gets put back in the wrong place).

When I saw this advert on AE I couldn't resist pressing the "Buy Now" button especially as I had some credit from refunds/returns and some tokens - that lowered the price even more.


The scanner arrived this week and after a few failed attempts at getting the Bluetooth to work I tried plugging the 2.4GHz Wireless Dongle into one of my Raspberry Pi 4Bs that act as my home server running Node-RED and Mosquitto.
The dongle appears as an HID Keyboard Device so I created a simple Python script to trap the "key presses" until an "KEY_ENTER" is detected - which causes the bar code to be sent via MQTT to Node-RED.

Next step was to create a simple NR flow to send a query to my MySQL dB.


Part of my simple dB...

This gives a result that indicates if the bar code is in the database or not. The 'switch' node (in the above flow) is used to trigger a message that is sent to a Telegram account on my phone and also to one of my Alexa devices.
As a quick test I cut a label off of a couple of packet of biscuits and inserted one code in the dB.


sat_bar_code_B

If anyone is interested, here's the Python file (rename it to... 'bar_code_scanner.py')
bar_code_scanner.txt (3.6 KB)

6 Likes

Excellent Dave! I have been thinking of something like this for kitchen ingredients.

That's a good idea.
Could probably extend it to label all those strange looking items one finds in the freezer.

2 Likes

Just had a brilliant thought - rather than spending time thinking up bar-codes and then printing them out - I'm going to cut them off of all the things I buy, then insert the code in my dB.

It will remind me of the "olde" days and the "I Spy Books" I had as a child and books of railway train numbers that I crossed-out when I spotted the engine.

Only the older generation on the Forum will remember these small booklets.

This is the modern equivalent... "I Spy Bar-Codes"

3 Likes

Then use an old phone attached to the freezer as a display to tell you what it is. :slight_smile:

Even better, scan when something goes in so you have the what and the when. :sunglasses:

1 Like

Well done Dave, yet another first world problem solved.