To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 9520
9519  |  9521
Subject: 
Re: how does a bar code reader work?
Newsgroups: 
lugnet.robotics, lugnet.trains
Date: 
Thu, 30 Dec 1999 13:58:33 GMT
Viewed: 
920 times
  
This is going to be tricky without real arrays.  LegOS may be the only option.

You'll be looking for a start symbol (maybe just one framing bit, sometimes a
legal character in the barcode set and sometimes just a pattern).  Once you
identify it you will know how to clock the rest of the bits.  Once you read the
string you can checksum it and make sure it is valid, if the barcode includes a
check digit.  Some barcode schemes require a check digit, some recommend a
method for computing it but don't require it.

I don't have a Code Pilot barcode to look at, but here are the two leading
candidates for the encoding:

If all of the WHITE SPACE is the SAME WIDTH between EVERY bar, and the thick
bars are 2-3x wider than the thin bars, you are looking at Code 2 of 5.  It
should start thick-thick-thin and end in thick-thin-thick.  From pictures I can
tell that there are no "bearer bars" on Code Pilot barcodes (think giant Roman
numeral) which would be a dead giveaway, but they are optional.

If there are thick and thin bars AND gaps and it begins and ends with
thinbar-thickspace-thinbar-thinspace-thickbar-thinspace-thickbar-thinspace-thinbar
(say THAT ten times fast) you are looking at Code 39 (aka Code 3 of 9).  I
think this is probably what the Code Pilot uses.

Maybe I'll print some Code 39 and see if I can write some NQC to scan it with a
light sensor.  You'd need a full time counter task to simulate a fast clock.
Then you wait for a quiet leading zone and the initial set of light->dark,
dark->light, light->dark transitions.  This gives you baselines for the pulse
widths.  Then you measure each set of transitions and decide if you saw a wide
or a narrow bar/gap and decode.  When you see the end symbol check the checksum
and then beep pleasantly at about 1600Hz.  :-)

--Ben



Message has 2 Replies:
  RE: how does a bar code reader work?
 
(...) Hmmm, this might be another practical pbForth application. I don't have time right now... <snipped excellent barcode type description> (...) I'm not sure about the clock thing. Any single sensor is sampled at about 333 Hz. If you write some (...) (24 years ago, 30-Dec-99, to lugnet.robotics, lugnet.trains)
  barcode reader for RCX (was: how does a bar code reader work?)
 
(...) Well, I tried this, and it's hopeless. The RCX can't poll the sensor nearly fast enough, and even if it could you'd need a lens to focus the sensor better. (...) Instead of using my idea, I took the suggestion of someone else and just used a (...) (24 years ago, 30-Dec-99, to lugnet.robotics, lugnet.trains, lugnet.robotics.rcx)

Message is in Reply To:
  how does a bar code reader work?
 
Hi, Can someone explain me how the bar code reader of the codepilot works. I figured out the basics, but I can not get to the clocking stuff. You can move either slow or fast over the bar codes to program the codepilot. I want to use the rcx to (...) (24 years ago, 30-Dec-99, to lugnet.robotics, lugnet.trains)

11 Messages in This Thread:






Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR