Grocery list 2.0

Grocery list 2.0

How many times did you just get back from grocery shopping when you noticed that you forgot to buy an essential item, such as coffee or worse... sugar? Obviously, a pencil and a paper should theoretically protect you against this kind of mishap. But you must still not lose or forget the shopping list before you go shopping. This week, we propose a solution based on Yoctopuce modules to solve this annoying issue.


The idea is to scan the barcode of each product when you notice that you must buy some more and to print the list right before you go shopping. Obviously, for the system to work, it must be user-friendly: forget the idea of turning a computer on each time you must scan a product or print the shopping list. We have a few ideas.

Barcode scanner

The basic idea is therefore to use the barcode printed on the package of all standard products. To do so, we had to build a barcode scanner. We found a cheap module commercialized by DFROBOT. It is designed to work in RS232, so logically we had to use a Yocto-RS232 to interface it. We tried this and it works. The issue is that not only we found ourselves with a voluminous and cumbersome system, but on top of this the Yocto-RS232 isolation induces a non-negligible additional power consumption.

The DFROBOT barcode scanner, as delivered
The DFROBOT barcode scanner, as delivered

Having a closer look at the scanner, we noticed that it is in fact made of two parts, the scanner itself which is a generic scanner and a board with a buzzer, a push button, and a level converter. The scanner itself has a 5V TTL serial output, so we can interface it and power it directly with a Yocto-Serial. The reader pinout is described in the product documentation, keep in mind that contact # 1 is the most outside one.

The scanner, interfaced with a Yocto-Serial
The scanner, interfaced with a Yocto-Serial


However, the scanner connector follows the zif 0.5mm standard, which makes the connection somewhat tricky. We found at Adafruit a small PCB enabling us to solder a connector and the required wires. We configured the scanner so that it scans continuously. Beware, you configure the module by scanning configuration barcodes, so you must configure it before you disassemble it. When you remove the DFROBOT board, you loose the push button which normally serves as a trigger. Note that in the default configuration, the scanner emulates a keyboard. If you scan the barcode restoring factory settings, you must re-scan the code that enables the interface to use the serial mode. Don't forget to scan the code that saves the configuration.

The Yocto-Serial is coupled to a YoctoHub-Ethernet. To have an appropriate user interface, we added a Yocto-MaxiDisplay-G and a Yocto-Buzzer. We even wondered if we should add a cash register as well. The main advantage of the YoctoHub-Ethernet is that it enables you to power the scanner by PoE: so we need only one cable to connect the scanner.

The distinct components of the scanner
The distinct components of the scanner


The YoctoHub-Ethernet is configured to perform a callback on a server each time you scan a barcode. The server finds the correspondence between the barcode and the name of the product, displays it, and makes the Yocto-Serial beep while updating the shopping list. You can even signal errors by using a different beep and the red led of the Yocto-Buzzer.


The scanner electronics  The enclosure can stick on a fridge door thanks to powerful magnets

The full scanner
The full scanner




The barcode/product correspondence

At one time or another, you'll have to convert the barcode read by the scanner into a piece of information readily understandable by the grocery shopper. The first idea that comes to mind is to use Internet for this. There are indeed databases aplenty referencing the barcodes of many products. But, when using them, you soon notice two issues with these databases:

  • All of these databases, even those boasting to refer millions of items, are far from exhaustive. Most European products that we tried don't belong to them.
  • The products which are referenced have a tendency to be referenced by brand rather than by their kind, which doesn't help us much. Thus, if you scan a bottle of sparkling water, you'd like to obtain "Sparkling water" rather than "Valser Classic".


Therefore, we found it simpler to manually enter the correspondences when needed. So we wrote a small web interface allowing us to update the correspondences and, if need be, to modify the shopping list.

A small and very simple interface to update the grocery list
A small and very simple interface to update the grocery list



Printing

We print the shopping list with the printer we built last week. It is based on a YoctoHub-Wireless-SR, which means that it can wake up at specific dates and times, so we can configure it to wake up when we usually go shopping and the server can make it flash if there is something to be printed. Thus, if you place it conspicuously, not too far from the front door for example, you can hope to remember to print the list before you go shopping.

You only need to push the button to print the grocery list
You only need to push the button to print the grocery list



Software

The software part is not very complex. It's basically three scripts: two PHP callbacks for the scanner and the printer and a short web page to edit the list.

The scanner

The script driving the scanner retrieves the last line of the Yocto-Serial buffer, containing the barcode which was read last. It checks a simple ini file and looks for a correspondence with products we would have already scanned. Here, there are two options:

  • There is a correspondence, the name of the product is displayed on the scanner screen, accompanied by a high pitch beep, the green led of the Yocto-Buzzer is on, and the entry in the ini file is updated.
  • No correspondence is found, an error message is displayed on the screen accompanied by a low pitch beep, the red led of the Yocto-Buzzer is on, and an entry with an empty description is added into the ini file.

The structure of the file is dead simple, each section corresponds to a barcode and contains a field for the product description as well as a flag indicating if it must be bought or not.

[7610335000069] desc="Sparkling water" mustbuy=0 [8002470006317] desc="Olive oil" mustbuy=0 [8714789750514] desc="Window cleaner" mustbuy=1


Editing

The editing part enables you to modify by hand the content of the shopping list. It's a simple PHP page displaying the content of the ini file in a more intuitive format. It doesn't interact with the Yoctopuce modules, it simply updates the ini file.

Printing

The script which drives the printer is a variant of the one we used to print Chuck Norris facts last week. Instead of downloading a fact, it reads the ini file, extracts the list of products which need to be bought, and sends it to the printer Yocto-Serial. Note that a printer is not really required, a smart phone could easily display the list while you browse in the shop aisles.

And it works?

It works rather well. You can scan a product in less time than required to write its name on a piece of paper. You can obtain the grocery list in a few seconds by pushing a single button. Locating the printer judiciously, near your keys for example, reduces the risk of forgetting the grocery list. And all of this without having to keep a computer powered permanently at home. Obviously, there remains the issue of entering the product names manually the first time, but you'll soon see that there aren't that many. The basic product list is entered before you are tired to play with the system. To conclude, here is a small video of the working system.

  

Add a comment No comment yet Back to blog












Yoctopuce, get your stuff connected.