The Cyber-Spy.Com Usenet Archive Feeds Directly
From The Open And Publicly Available Newsgroup
This Group And Thousands Of Others Are Available
On Most IS NNTP News Servers On Port 119.
Cyber-Spy.Com Is NOT Responsible For Any Topic,
Opinions Or Content Posted To This Or Any Other
Newsgroup. This Web Archive Of The Newsgroup And
Posts Are For Informational Purposes Only.
From: Rich Webb
Subject: Re: Designing a barcode reader
Organization: Line Eater Memorial Fund
X-Newsreader: Forte Agent 1.92/32.570
Date: Sat, 28 Sep 2002 13:29:25 GMT
NNTP-Posting-Date: Sat, 28 Sep 2002 09:29:25 EDT
On Sat, 28 Sep 2002 10:47:45 +0100, "Philip Pemberton"
> I'm currently thinking about building a simple (Code39 only) barcode
>reader. Has anyone got some information on suitable methods for detecting
>and decoding said barcode? I was thinking about using a high-brightness red
>LED to illuminate the barcode. A lens will focus the resulting barcode onto
>a phototransistor with a metal sheet wrapped around it with a small pinhole
>in the middle. Is this how most barcode wands work, or do they use
>fiberoptics to route the light around?
> I've pulled a Cuecat to pieces before and I've seen some of
>Digitalconvergence's patents (thank you EspaceNet) but I'm still thinking
>about how I could decode the data. Would a PIC16F84 RISC MCU running 10MHz
>with 64 bytes of RAM be able to do it or will I need some more RAM?
Well, let's think about this. Off the top of my head there are two
principal ways to "read" the bars: either sample the detector at a fixed
interval or run a clock and note the counts when a transition occurs.
You'll need to deal with variable read-head speed, some amount of random
noise (cat hairs, etc.), and with rough edges at the transitions.
Classical digital signal processing pretty much depends on sampling at a
fixed interval. With a narrow bar of 20 mil (0.02 in) and a read speed
of, say, 2 in/sec you'd end up with a 100 Hz signal. A minimum sample
rate would then be 200 Hz, but probably better to aim for about 5x or a
500 Hz rate. Say the bar code is an inch long, then you'd be looking at
250 samples. How many you'll need to store before and during processing
depends on how you filter them.
You could try your luck and read it raw but you'd probably be better off
with at least some digital filtering. Note that your low freq is for the
wide bar at, say, 2.5 the width of the narrow bar or 200 Hz. Then all
you have to do is correlate on the start pattern and then extract and
decode each element. All of which assumes that the read speed is
constant or nearly so. An adaptive algorithm would be needed to handle
variable read speeds.
You could probably forgo some digital conditioning by using an out of
focus "low pass" detector (to ignore the cat hairs) and a hysteresis
circuit to add some snap to the transitions. Sampling at a 2x or 3x rate
with a constant read velocity and then decoding each character on the
fly could probably be done with 64 bytes. Wouldn't be terribly robust,
though, but it seems do-able.
Rich Webb Norfolk, VA
Go Back To The Cyber-Spy.Com
Usenet Web Archive Index Of
The sci.electronics.design Newsgroup