Barcode Reader

This application was inspired by the idea of adding strips of tape to a line-following course (perpendicular to the course), in order to convey the 3pi's position/progress during navigation. Initially, we encoded numeric data by grouping together parallel lines of tape. A number could be read by counting the number of tape-markers encountered in a small time frame. We realized this idea could be used to read any type of data. Specifically, we were interested in decoding text embedded in the course.

First, we needed a way to generate some kind of line-based code that could be easily placed on a course. Thus, the barcode generator utility was born. We went through a number of different barcode formats before we finally settled on a design that was the easiest for the robot to detect with minimal error. Below are some of the test formats we tried.

Ultimately, our final format allowed us to encode 16 bits (4 characters) on one 8.5x11" sheet of paper, with two characters encoded on each side of the center line. Since barcode messages could conceivably span multiple sheets, the barcode generator adds dots to the start of each sheet, to indicate the sheet number and direction of the barcode. We taped the sheets to poster board and joined them together with electrical tape so the robot would be lead from one sheet to the next.

Aside from developing a barcode format that was easily readable by the robot, the hardest part of this project was determining what sensor values to respond to when reading the barcode. Printing values to the LCD only got us so far, and we realized we needed to graph the sensor data. This meant serial communication, and that meant soldering. We chose to add wired serial communication to the robot, combined with a software utility we wrote for classifying serial data in a spreadsheet. From there, we graphed the data with Excel. A sample of the middle sensor readings from a successful run is shown below.

The barcode reader expects a total of 16 characters, since this is all that will fit (without scrolling) on the 8x2 LCD screen. The reader terminates and prints out the message when either a) a total of 16 characters have been read, or b) a solid black region is encountered for a second or two.

Here are a few tips for building your own barcode courses.

  • Run the SDC program to figure out what sensor values to expect. Due to differences in lighting conditions, paper brightness (we used paper with brightness 92), and ink quality, you may have to tweak the barcode program slightly to get good results.
  • Leave enough space for the robot to turn around fully before reading the next barcode sheet. For best results, the 3pi should enter the barcode region travelling straight. At the same time, make sure the robot's wheels do not leave the cardboard course while turning around; it might get stuck.

Download Project Tabletop source code (which includes the barcode reader program) here.