Newsgroups: sci.electronics.misc
Subject: Re: barcode decoder
References: <[email protected]>
"The Eye"  writes:

> Hello,
> 
> I'm doing a little research on barcode decoders, for "barcode 128". The goal
> is to understand all this, and building my own hardware for this. And I'm
> wondering how this type of decoder works (just the principles). Light is
> emmitted, is/isn't reflected by the barcode.
> 
> 1) how is the signal transformed to a digital signal again?

Genrally in barcodes the information is coded to the width of
the bars and their distance from each other.

> 2) how is the digital signal inputted to the processor?

There is generally one optosensor which gives 1 or 0 signal
depending of sensor is over the black bar or white background.
(for example 1 on background and 0  on black bar or other way).

> 3) how does the processor determine the beginning of the barcode?

When the senro detect the first bar.

> 4) how does the processor handle variable scanning speeds?

The first bar has a known width. When you have passed over it,
you know how long it took. This means that using this information
you know how long is this particular bar in time.
For example if the first bar is wide one, and it took X milliseconds
to take, then you can set a threshold that is for example 2/3 * X
(or other suitable ratio, depends somewhat on the code I think).
Anythign longer than threshod is wide bar, anythign shorter is thin bar.

So after first bar the system has synced...The variation of speed
during code read can be made by adjusting the threshold value
during the read (compare the read time of bar to expected value
and do the correction).

This is pretty much how those things work.

> 5) how does the processor handle noise?

Noise is not much of the problem on most barcode reader types...
There is not much to do for this... Maybe filter out the
shortest transistions (spike noise).

> 6) when scanned, how does the processor know where the checkdigit is located

The barcode standards say where the checkdigits are placed
in the code... It is in standard fixed place or there are
well established rules to figure out this.

> 7) what with a barcode which was scanner from ending to beginning?

Most barcodes are designed so that they have a known start
and ending codes, so that when somebody scans you know
if you have the right start code.... If no right start
code try to go through the scan data in other direction is
one way.


Here is links to some useful barcode information:

Barcode links:
http://www.epanorama.net/links/smartcards.html#barcode

Linux Reads Bar Codes
http://embedded.linuxjournal.com/magazine/issue02/4545/?sid=6d30887f60b9b0bc5d43568d26f3d8c2


-- 
Tomi Engdahl (http://www.iki.fi/then/)
Take a look at my electronics web links and documents at 
http://www.epanorama.net/