Papilio Barcode Genie Kit
Barcodes, Barcodes Everywhere. \Everywhere we turn we are surrounded by barcodes, but without the right tools to capture them they are just wasted information. There are countless times in our day to day life where a portable and hackable barcode scanner can save loads of time.
The first time I wished I had a portable barcode scanner was several years ago when I was working as a system administrator. We were tasked with doing a physical inventory of every server in our data center. This daunting task was a perfect example of what drives me crazy about computers; they are supposed to save us from brain dead and repetitive tasks! But too often they actually end up forcing us into brain dead and repetitive tasks… In this case we were surrounded by enough processing power to send a man to the moon but we had to resort to writing down serial numbers on pads of paper. Every rack and server had barcodes that were just crying to be quickly scanned, but instead we had hours upon hours of practicing our penmanship. I mean come on, this is 2010 we are supposed to have HAL and flying cars! The least we can do is make a hackable barcode scanner to help keep simple tasks easy, right?
The Papilio Barcode Genie kit is a flexible, expandable, and portable barcode scanning kit. It is based on an FPGA for maximum hardware flexibility and written in the Arduino IDE for maximum ease of use. It is a platform that encourages hacking and remixing to adapt it to exactly what you want it to do. Anything you’ve ever wanted to do with barcodes is possible; save them to an excel spreadsheet on a SD card, send them out wirelessly over Zigbee, or add a TFT LCD with a touchscreen. Open Source code and modular building blocks help bring your ideas to life!
The Papilio Barcode Genie kit provides the base system needed to capture barcodes using an off the shelf PS/2 barcode scanner. Captured barcodes are saved to a microSD card in a spreadsheet format (csv) that can be opened directly by Microsoft Excel. A high speed USB channel allows barcodes to be saved directly to a computer if desired. But most importantly, three 8-bit Wing slots and FPGA fabric provide the unconstrained potential to make it your own.
The Papilio Barcode Genie kit is comprised of the Papilio One 250K, which provides the core, and Wings that provide the peripheral functionality. The Papilio One 250K provides the flexible FPGA core that ties everything together. A PS/2 Wing provides two PS/2 connectors that any PS/2 compatible barcode scanner can plug into. The microSD Wing provides the socket that a large capacity microSD card connects to. Finally, a Button/LED Wing provides visual feedback through the LED’s and input to control the application using buttons.
Papilio One FPGA Board
The Papilio One 250K FPGA board provides the empty canvas that the Barcode Genie is built on. The Xilinx Spartan 3E FPGA chip that is used on the Papilio One is like a blank, rewritable CD. The Barcode Genie ships with an AVR8 soft processor already ‘burned’ onto it. It is compatible with the ATMega103 microcontroller and provides a high degree of compatibility with the Arduino IDE and existing sketches. The beauty of a soft processor is that new features can be hacked in. If you want to add a SPI Ethernet Wing but are worried about the SPI pins already being used by the microSD card Wing then worry no more. The soft processor can move the SPI pins on command or another SPI core can be added and ‘re-burned’ to the Papilio One. And that is the key element that the FPGA buys you, no longer do you have to think about whether the SPI pins are connected or if the chip has such and such ability. You just know you can add whatever you need.
With the Papilio Platform the name of the game is flexibility, so once you are done scanning barcodes you can use the Papilio One as a Logic Analyzer, another Papilio kit, or even a full blown FPGA development kit. The very popular “Sump” Logic Analyzer is fully ported and supported by all Papilio One boards. Just download the project and enjoy using a 32 channel 100Mhz Logic Analyzer. Or, just swap out the Wings to play with any future Papilio kits we develop such as a Magnetic Strip Genie. Finally, and maybe most importantly, the Papilio One is a full FPGA development kit that you can start learning VHDL/Verilog with by simply downloading the free Xilinx ISE software.
The PS/2 Wing provides two PS/2 sockets that enable the use of commodity barcode scanners. PS/2 barcode scanners are inexpensive, plentiful, and reliable. Instead of re-inventing the wheel with a homebrew barcode scanner, PS/2 barcode scanners were targeted instead. While the Barcode Genie does not include a barcode scanner it is easy and affordable to get one. At the time of writing there were barcode scanners on Ebay for as little as $10. In fact, we won an Ebay auction that included two used barcode scanners for $12.
The PS/2 Wing design is Open Source under the Creative Commons license. It is designed in EAGLE and can be downloaded from the development page at GadgetForge. The design provides a 5V source to pin 4 of the PS/2 connector and ground to pin 3. Data (PS/2 pin 1) and CLK (PS/2 pin 5) are connected to the I/O pins of the Wing header. Each data pin is protected by a 270 ohm current limiting series resistor that protects the pins from too much current that can be generated by the 5V PS/2 pins.
The microSD Wing provides a convenient means of storing large amounts of data on removable media. The Barcode Genie kit does not include a SD card in order to allow the most flexibility in choosing the appropriate sized microSD card. All development and testing was done with a 2GB Kingston microSD card.
The microSD Wing design is also Open Source under the Creative Commons license. The EAGLE design files can be found at the GadgetForge development page. At the core of the design is a spring loaded microSD socket. The Barcode Genie uses SPI mode which only uses four pins but all six of the microSD card signals are routed to the Wing header. This will allow for faster communications if a full speed SD card core is added to the soft processor in the future. All I/O pins, except SCK, are routed to the Wing header through a 47K pull up resistor array.
The Button/LED Wing provides all of the resources needed to communicate with the program running on the Barcode Genie kit. Four LED’s provide visual feedback for when the Barcode Genie is ready to scan the next barcode, when it has scanned the last barcode, and the state of the SD card.
Four buttons allow user input for things such as starting a new row of barcodes in the Excel csv file. It can also form the basis for a navigation system with the addition of a character LCD Wing.
The software for the Barcode Genie is written as a sketch in a specially modified version of the Arduino IDE. The sketch is compiled to run on the AVR8 soft processor and is loaded to the Papilio One by the Arduino IDE. The Barcode Genie kit is shipped with the latest version of the sketch loaded into the SPI Flash so that the Papilio One will automatically run the sketch when powered on. Making changes to the sketch is as easy as making changes to the Arduino. Just hack/remix the code in the easy to use IDE and press the Upload icon. The Arduino IDE takes care of everything else and hides the nitty gritty technical details of the C++ libraries and FPGA hardware so you can focus on hacking!
The Barcode Genie sketch is kept simple in order to make it easy to make it your own. Out of the box it can scan barcodes and save them to an Excel compatible csv file on an SD card. But where the kit really excels is making it easy to adapt it to anything you want to do with barcodes. Need to make it wireless? Just add a Zigbee Wing, include the Zigbee libraries, and start using the high level methods from the library. That is the secret sauce of the Arduino IDE, it encourages “client” object oriented programming. Experienced programmers create C++ libraries that provide objects that are used by less experienced “client” programmers. The experienced programmers boil down the complexity of the library to just a few methods that client programmers need to learn and use. The end result is that relatively new programmers can accomplish amazing things by just including a library, studying some examples, and remixing a sketch to suit their needs. It’s very exciting, powerful, and inviting to new programmers. The Papilio Platform continues this tradition by providing libraries that are coupled with hardware Wings to simplify things even further!
The Barcode Genie finally makes it easy to capture barcodes without the huge overhead of carrying a laptop around. This simple device can be mounted next to a refrigerator to make grocery lists or carried around in a pocket for taking inventory. Being built from the ground up with the express purpose of easy hacking makes it simple to bring new ideas and uses to life.
- Mount the Barcode Genie next to a refrigerator and scan empty containers as food is consumed. Pull the SD card before shopping for an instant shopping list that can be printed out or accessed on a smart phone. Access the list on a computer and do a Google search to find the best price on shippable goods like canned foods.
- Plug a battery into the Barcode Genie and make short work of inventory tasks. Do a physical inventory of every server in a data center. Scan the barcode of every book at a thrift store to find books with value. Keep an inventory of electronics parts as they arrive.
Here are some proposed ideas for how the Barcode Genie can be hacked/remixed for new applications:
- Add a character LCD module for the display of more meaningful information such as the barcode scanned or scan count.
- Add a Zigbee Wireless Wing to allow the Barcode scanner to communicate back to the Internet or a central database.
- Add a touchscreen display (a Wing is in the works) to display more complicated data such as price comparisons from the Internet.
- Add a scale over a RS232 port that allows instant inventory of a bag or bin of parts. The barcode genie can store a database of what each part weighs and subtract the weight of the container to come up with an accurate count of parts. Couple this information with an advanced display or a wireless connection for an advanced inventory system.
- Develop software that takes a shopping list generated by scanning barcodes and then uses the Internet to find coupons and the best price for the automatically generated shopping list.
- William Greiman – Wrote the SdFat library that plays such a central role in the Barcode Genie kit.
- Benjamin Maus – Wrote the barcode scanning code that is equally critical to the operation of the Barcode Genie kit.
- Arduino Team – Made a great IDE that makes it easy to modify the functionality of the Barcode Genie with sketches.
- Wiring Team – Came up with the idea of porting Processing to microcontrollers.
- Processing Team – And finally, the Processing team who got everything started and provided the framework for Wiring.
Please visit the Papilio Barcode Genie wiki page for more informations about this projects