jonasbegood
Posts: 2
Joined: Sun Jan 26, 2014 1:05 am

Read from barcode scanner, generate shopping list?

Sun Jan 26, 2014 1:43 am

I am working om an idea to use the RaspPi as a mealplanner/shopping list generator.

Basically the idea is to have a barcode scanner set up at the kitchen (either wireless or directly to USB). We would use this to read barcodes from grocery when they are empty.

The Pi would have to have a active script to listen for HID inputs. When the Pi receives a input it would post this to a file or database.

Once a week (on the shopping day) the Pi would then use this file to look up a database and post a quantity (+1) for each of the barcodes scanned into the same database.

This database would contain all your barcodes and connected products (which you would have set up manually and be able to edit/add items, either through web, phpadmin etc).

Then a script should count all values (greater than 1) and generate a shopping list with the connected products, and use this to send an email to your inbox or to Evernote. The clear all the values, the file on Pi and prepare for next weeks shopping.

To use this as a meal planner you could generate and print your own barcodes, make a shopping list for a specific meal and connect each ingredient to the barcode in the database. Then you make a fancy book with your favorite meals and barcodes, scan them and have your whole weeks shopping list sent to mail.

I have done some smaller projects with the Pi before, but this goes out of my knowledge so I would really love some input.

User avatar
scruss
Posts: 5617
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON

Re: Read from barcode scanner, generate shopping list?

Sun Jan 26, 2014 2:59 am

If you can still find a USB CueCat scanner — and a couple of surplus stores near me still have them — they work as USB keyboards. You will have to “declaw” it, or it outputs encrypted data.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: Read from barcode scanner, generate shopping list?

Sun Jan 26, 2014 3:03 am

Cue-Cat. Yikes. What a disaster that was. It is best described as a dot-bomb.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

ame
Posts: 8224
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Read from barcode scanner, generate shopping list?

Sun Jan 26, 2014 3:13 am

jonasbegood wrote: I have done some smaller projects with the Pi before, but this goes out of my knowledge so I would really love some input.
It sounds like a very interesting project, and very do-able on the Pi.

Your message is like reading a design document. You have already identified what you want to do, and how you want to do it, and some potential problems to overcome. If you have already done some small projects on the Pi, then you should be able to do this. Treat it as several small projects.

If you are worried about HID input from the barcode reader, then don't be. The barcode readers look like keyboards to the OS. When you scan a barcode it appears as if it was being typed on a keyboard. So, you can test this part with a regular keyboard- just type in the barcode and see if the rest of the software does as it is supposed to.
Oh no, not again.

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: Read from barcode scanner, generate shopping list?

Sun Jan 26, 2014 4:40 am

The biggest hurtle is the barcode to product database. It is pretty hard to find a bottle of 017892137
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

ame
Posts: 8224
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: Read from barcode scanner, generate shopping list?

Sun Jan 26, 2014 4:58 am

Richard-TX wrote:The biggest hurtle is the barcode to product database. It is pretty hard to find a bottle of 017892137
Not really. You probably buy the same things regularly, so you can make your own database of barcodes.

Or you could try this:
http://www.product-open-data.com/

Or this:
http://www.upcdatabase.com/

Or this:
http://eandata.com/
Oh no, not again.

jonasbegood
Posts: 2
Joined: Sun Jan 26, 2014 1:05 am

Re: Read from barcode scanner, generate shopping list?

Sun Jan 26, 2014 12:25 pm

Thank you guys for the answers. My earlier project has been a rasppi media center, and a raspi torrent seedbox conncted to a NAS. On both of this project I had great resources. I am very confident that this project is doable, but I still need some tips for specific tasks. I've listed the workflow of this project, with specific questions to each and hope some of you can point me in the right direction.

Scanner to PI - decode the HID:
I've already checked that most barcode scanners will sendt it directly to the pi as keyboard.
The HID input can then be changed to the correct number by doing something like this.

http://www.raspberrypi.org/forums/viewt ... 45&t=55100

Database
I've been reading about SQLite, do you guys think this database is suitable for this project? SQLite can be runned locally on the rasppi. I am open to other suggestions so please feel free.

Save the inputs to the end of a specific textfile or directly to the database
The input received should always be saved to a specific local text file or directly to the database. I think the best thing would have a script that runs in the background at all times, and when it receives input it would search the database to match the input, then post a +1 in the right table. How would you go forward to create a listen-script like this?

Generate shopping list
I think this task is rather easy in theory. We would have to create a script which runs on a specific time on a specific day of the week. The script would search the database for all quantity changes and post the connected product to a file/or generate a email with all changes. Again, scripts are my biggest problem for this tasks.

E-mail the list to Evernote
To send the lists to a specific notebook, It can be done very easy with the subject. If the subject is in example: @Shopping-list.
Then the list from the database would be posted in the right notebook each time.

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: Read from barcode scanner, generate shopping list?

Sun Jan 26, 2014 2:25 pm

When it comes to databases there are a few choices.

For simple key-data pairs like a lookup table (UPC -> description), there is nothing faster than gdbm. A single record retrieval in a billion block database takes at most 3 file system accesses. Usually it gets done in two. Originally written at AT&T for a chess program, I have found nothing faster. The downside is that it is a c library and all of your routines like "load database", "dump database", "retrieve record", and "add record" have to be written. A good programmer can bang that out in a hour. I can usually do that in an evening.

If you want a relational database with a plurality of fields per record, then my choice would be mysql.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

User avatar
DougieLawson
Posts: 42772
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Read from barcode scanner, generate shopping list?

Sun Jan 26, 2014 2:38 pm

SQLite3 is less of a monster than MySQL.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

User avatar
scruss
Posts: 5617
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON

Re: Read from barcode scanner, generate shopping list?

Sun Jan 26, 2014 5:41 pm

DougieLawson wrote:SQLite3 is less of a monster than MySQL.
Yes, seconding SQLite. It's robust, fast, easy to use. I can't think of a project you could host on a Raspberry Pi that would overwhelm it. It's supported by every language you will ever use. The whole database lives in a single file: no server, no messing about with sockets. It's used as the data store by iOS, Android and Mozilla. I've been using it (well, SQLite) for more than 10 years. Purists will decry its lack of data types, but they get in the way of getting stuff done.
Richard-TX wrote:Cue-Cat. Yikes. What a disaster that was. It is best described as a dot-bomb.
Maybe for the company and its vulture venture capitalists, but the surplus CueCats have brought cheap bar-code handling to community libraries and individuals worldwide. So, yay failure!

Note to the OP: if you use a CueCat, I think they draw a fairly high current. You may need to use a USB hub.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

marked
Posts: 218
Joined: Fri Jul 29, 2011 4:25 pm

Re: Read from barcode scanner, generate shopping list?

Tue Jan 28, 2014 1:56 pm

how about using a webcam and zxing to obtain the barcode, lookup the price, then re-shoot to get a pic of the product. Take a walk down the supermarket and match aisle to products, then print the walking order. If you include previous prices and some products have separate price codes (such as fresh meats by weight).

Bonus points for matching instore positioning to product :-)

Mega bonus for creating meal recipes on the fly using your phone, ie. as you wander the aisles it can suggest meals if you get friends dropping by, redo a meal plan because there is a better cut of meat is 1/2 price but would take an extra half-hour to cook, they have completely run out of a particular fresh veg, etc.

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: Read from barcode scanner, generate shopping list?

Tue Jan 28, 2014 2:59 pm

scruss wrote: Maybe for the company and its vulture venture capitalists, but the surplus CueCats have brought cheap bar-code handling to community libraries and individuals worldwide. So, yay failure!

Note to the OP: if you use a CueCat, I think they draw a fairly high current. You may need to use a USB hub.
I have not seen a cuecat in years. I haven't even heard of anyone seeing one. Not in a library or anywhere else for that matter.

Have you tried to use one? The error rates compared to a real barcode scanner are horrible. The output is lamely encrypted too but what do you want for free?

I threw all of the ones I had in the trash long before the company went belly-up because of the error rate. I suspect that many others did the same thing.

I have worked with many different types of barcode scanners but the Cuecat was the worst.

I would not waste any time locating one. Find a cordless scanner that has memory. That would be far better than any cuecat.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: Read from barcode scanner, generate shopping list?

Tue Jan 28, 2014 3:10 pm

One more thing.

If you are out of chicken soup, what are you going to use to scan the bar code? All of the empty cans/packets are in the trash. So that leaves sheets of paper with the barcodes all printed out as a solution. By the time the item is found on the multiple sheets of paper and scanned, I could have written down "Chick. soup" as well as the next 3+ items.

What is needed is an automatic touchless scanner. Remove the item from the pantry shelf and the computer knows it.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

User avatar
scruss
Posts: 5617
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON

Re: Read from barcode scanner, generate shopping list?

Wed Jan 29, 2014 12:45 am

Richard-TX wrote:Have you tried to use one? The error rates compared to a real barcode scanner are horrible.
Yup. I've had a couple; the old PS/2 one, and the slightly later USB one. Both weren't as fast or as accurate as a commercial scanning laser, but they worked, say 8 times out of 10. Many surplus stores have them; Active Surplus, for one.
The output is lamely encrypted too but what do you want for free?
That's what the “declawing” bit I mentioned was about. It removes the encryption, turning them into an HID keyboard.
Find a cordless scanner that has memory. That would be far better than any cuecat.
Yes, but that's $$$, probably too much for a home project.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia

Re: Read from barcode scanner, generate shopping list?

Wed Jan 29, 2014 12:55 am

Hi,
scruss wrote:
Richard-TX wrote:Find a cordless scanner that has memory. That would be far better than any cuecat.
Yes, but that's $$$, probably too much for a home project.
Use your smart phone as a barcode reader & data storage device.


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

cindy313
Posts: 6
Joined: Thu Dec 05, 2013 2:12 am

Re: Read from barcode scanner, generate shopping list?

Mon Feb 24, 2014 4:07 am

but where to find the barcode scanning app for the smartphones ? i found some but never used , how do you think ?
http://dottech.org/131684/android-review-neoreader-app/

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia

Re: Read from barcode scanner, generate shopping list?

Mon Feb 24, 2014 10:38 am

Hi,
cindy313 wrote:but where to find the barcode scanning app for the smartphones?
Google: "zxing android" or "zxing iOS app"


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

PiGraham
Posts: 5369
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Read from barcode scanner, generate shopping list?

Mon Feb 24, 2014 12:37 pm

marked wrote:how about using a webcam and zxing to obtain the barcode, lookup the price, then re-shoot to get a pic of the product. Take a walk down the supermarket and match aisle to products, then print the walking order. If you include previous prices and some products have separate price codes (such as fresh meats by weight).

Bonus points for matching instore positioning to product :-)

Mega bonus for creating meal recipes on the fly using your phone, ie. as you wander the aisles it can suggest meals if you get friends dropping by, redo a meal plan because there is a better cut of meat is 1/2 price but would take an extra half-hour to cook, they have completely run out of a particular fresh veg, etc.
A camera-based barcode reader is a good option.

There is also http://zbar.sourceforge.net/ and others.
Why not use the PiCam?


Sandman7
Posts: 2
Joined: Thu May 15, 2014 8:06 am

Re: Read from barcode scanner, generate shopping list?

Thu May 15, 2014 8:10 am

Another good upc database site is http://upcchecker.com. It says it has over 29 million numbers so far.

Bissio
Posts: 1
Joined: Fri Aug 08, 2014 1:31 pm

Re: Read from barcode scanner, generate shopping list?

Fri Aug 08, 2014 2:05 pm

Wow!
I'm working to the same idea !
My opinion is that the system has to be very simple to use (it has to work with my wife! :) ), so i decided to exclude every kind of smartphone application (reading a barcode from a camera phone is not so easy as with a barcode gun).
- Regarding the barcode scanner: i'm waiting for this ($33.88!) http://www.aliexpress.com/snapshot/6165659936.html . I will test it and let you know.
- For the barcode database i think to use a preloaded mysql with the products that we usually use. I'm thinking how to realize a system to easily insert new one (http://www.product-open-data.com is a good repository, but doesn't have a lot of italian products). The challenge is to think a method to warn that the barcode scanned hasn't any match (a beep on the barcode gun?.......) and then insert a description in a easy way
- I have connected to the raspberry a thermal printer ($49.95) (http://www.adafruit.com/products/597) that have to print the shopping list (pressing a button or simply scan a barcode coded to do this action)
- The place where the barcode scanner should be placed is near the trash. Before you trash you can shoot the barcode. If the product is finished i have to buy it! :)

Let me know your opinions!

Bissio

imdebo96
Posts: 1
Joined: Thu Nov 13, 2014 2:26 am

Re: Read from barcode scanner, generate shopping list?

Thu Nov 13, 2014 2:31 am

I have absolutely zero help to add to this topic, but this project is one of the main reasons I want to get a RPI (that, and also setting up a temperature sensor for a deep freezer).

One feature I would suggest, if you want to create an all-inclusive product, include a way to add items to the list that you have in stock. Although tedious, my vision for this topic is to create a way to scan in all the items you currently have in your fridge/shelves, and also scan items as you throw them away. This way, if you are at the store you could pull up a list and confirm that you have enough eggs, or enough butter for the recipe you are thinking about.

ncook421
Posts: 1
Joined: Sun Apr 23, 2017 8:55 pm

Re: Read from barcode scanner, generate shopping list?

Sun Apr 23, 2017 9:01 pm

You will likely need to implement use of some API to generate the shopping list. Amazon has an API available, but you need to sign up as a product affiliate. I'm not sure what the legal requirements are of that agreement. A site called upccodesearch.com has an open API and apparently the largest database of product on the web right now (besides Amazon). You can checkout individual products by entering the UPC in the url such as https://www.upccodesearch.com/upc/784331830740, however passing JSON through their API is programmatically the best option.

User avatar
GuptaGubbins
Posts: 30
Joined: Fri Jun 22, 2012 9:10 am

Re: Read from barcode scanner, generate shopping list?

Wed Jul 19, 2017 11:39 am

Hi Jon

Did you finish this project in the end?
I would love to know.

Ollie

Return to “Other projects”