Skip to content
nemiah edited this page Aug 10, 2013 · 1 revision

Use Raspberry Pi and a barcode reader to add items to your shopping list

The Raspberry Pi is a minimal computer with all the necessary interfaces to remotely add elements to the fheME shopping list using a barcode reader.

This is what you need:

  • working fheME
  • Raspberry Pi
  • Power supply
  • Barcode reader with USB connector that acts as a keyboard (all that I've seen so far do this)
  • Network connectivity (WiFi, ethernet)
  • My readKeyd-application and init script
  • Raspbian on a SDCard

Get started

Get your Raspbian to work and make sure you can connect via SSH. Download and edit the readKeyd.c file with a text editor and change the url parameter in line 21 to match your fheME setup. This mainly means that you have to alter the part with 192.168.7.77/fheME.

Now login to your Pi via SSH and make sure the libcurl developer files are installed: sudo aptitude install libcurl4-gnutls-dev libconfig-dev. Copy the readKeyd.c file to your Raspberry and compile it with gcc -std=c99 -o readKeyd readKeyd.c -lcurl -lconfig. Do not try to compile the file on your own machine and copy the compiled file, it most certainly won't work due to different CPU architectures (x86/x86_64 != ARM).

Disconnect any keyboards/mice, connect your barcode reader and start the application sudo ./readKeyd /dev/input/event0. If you entered the fheME url correctly before compiling, you now should be able to scan an EAN code and a new entry will appear in your fheME shopping list. Although the barcode scanner emulates a keyboard, the scanned numbers will not be displayed in the console while the application is running.

Daemonize

To automatically start the application after system boot copy the readKeyd-script to /etc/init.d and activate it with sudo update-rc.d readKeyd.sh defaults