Home » Home With One Sidebar » How Does a Barcode Scanner Read the Bars and Catch a Misread?

How Does a Barcode Scanner Read the Bars and Catch a Misread?

by Bebup Editorial Team
0 comments

How does a barcode scanner read the bars and catch a misread? It times every stripe and turns the widths into digits. Then it tests those digits with a short sum that ends in the thirteenth digit, known as the check digit. A failed sum ends the scan on the spot. The whole job happens inside the scanner within a blink, and no database is consulted for it. Our worked example is an invented label, 4012345678901, a model for any label of the kind. Yours will carry other digits, yet the method is the same, and we trace it here from the first stripe to the verdict.

What Makes a Barcode Scanner Read the Bars Correctly

In short, a scanner times the stripes and then checks its answer with one sum. The label is 95 units wide, where one unit is the thinnest stripe the printer can draw. At the usual size a unit measures about 0.33 mm, which puts the whole pattern near 31 mm. Each digit occupies 7 units and holds two dark bars with two pale gaps between them. Every stripe is a whole number of units wide, from one to four, which keeps the timing simple. The scanner doesn’t need to know the unit beforehand. It measures the guard bars at the left edge and works the size out from them.

That summary leaves three matters open. Where does the first digit go? It isn’t drawn as bars of its own. It hides in the choice of styles used for the six digits beside it. Why does the label need an empty margin on each side? The scanner uses that quiet space to see where the pattern begins. And why can the same sum catch a mistake but never repair one? Later sections answer all three.

Following One Barcode as the Scanner Reads the Bars

Watch a barcode scanner read the bars of our invented label as the beam crosses it at a steady pace.

The beam passes the left margin and meets the start guard, a pair of bars with a gap between them, each one unit wide. The scanner times the three stripes, divides the total by three and now owns a ruler. A slow swipe and a quick swipe give different times yet identical ratios. The ruler adapts itself.

Six digits follow, and each lasts seven units while the scanner times the four stripes inside it. The first digit it meets, a 0, shows a gap of three units and a bar of two; then comes a gap of one and a bar of one. The scanner finds that pattern in its table and writes down a 0. It repeats the step for the five digits after it. A guard of five units in the middle marks the halfway point. The six digits beyond it use the inverse pattern. That tells the scanner whether the label passed right way up.

Once the end guard closes the label, the scanner holds twelve drawn digits. It recovers the missing first digit from the mix of styles on the left. Next it adds the digits in odd positions: 4 + 1 + 3 + 5 + 7 + 9 = 29. Then it triples the sum of the even positions: 3 × (0 + 2 + 4 + 6 + 8 + 0) = 60. The total of 89 needs 1 more to reach the next ten, and the printed check digit is 1. The scan passes.

Now smudge one digit so that a 6 reads as an 8. The even-position sum rises by 2 and the tripling makes that 6 extra; the total becomes 95. A total of 95 would call for a check digit of 5, yet the label shows 1. The scan fails without a sound. The scanner tries again on its next sweep.

A Tune in Any Key, and Where It Breaks

A barcode behaves like a melody played in any key. You recognise a tune from the steps between its notes, not from the exact pitch of each one. The scanner recognises a digit from the proportions of its widths, not from exact timing. A swipe at twice the speed changes nothing that matters.

Only the ratios between stripes carry meaning, which is the lesson worth taking from the tune.

The analogy stops working at two points. A tune survives a wrong note because memory fills the gap. A label has no memory, and one wrong digit changes the whole number. Music also repeats itself, which lets a later verse forgive an earlier slip. A label is read once per pass and has no later verse to lean on.

What a Check Digit Cannot Do

The check digit is a single digit with ten possible values, and that sets firm limits. A valid check digit proves only that the digits agree with each other, and it doesn’t say whether the number matches the item in your hand. A random garble matches by luck about once in ten attempts. That is why a poor print is rejected far more often than it is accepted.

One wrong digit is always caught, since each weight is 1 or 3 and neither shares a factor with 10. Swapping two neighbours is caught nearly every time. The exception is a pair differing by exactly 5 (a 2 beside a 7, say). Its weighted total stays put and the swap passes unseen. The scheme can’t repair anything either. It can only declare that something is wrong, whereas a QR code carries spare data to rebuild what was lost. When a barcode scanner read the bars wrongly and still accepted them, it was nearly always a luck-of-the-draw match or a swap of this kind.

Three Beliefs About Barcodes and Why They Stick

Many people hold that the bars carry the amount to pay, and the idea forms because a figure appears on the till right after the beep. The label holds only a product number. The till finds the amount by looking that number up in its own list. Edit the list and the figure changes while the stripes stay as they were.

Another belief says a scratch can be repaired the way a damaged QR code is. It spreads because QR codes really do recover from damage. A barcode holds no spare data. What helps is height. Tall bars give the beam many chances, and a sweep across a clean stretch can still read the whole number.

One more belief links the first digits to the place where an item was made. They record where the number was registered. The prefix belongs to the numbering body that issued the range, which can sit far from the factory.

A Rule for When a Barcode Won’t Scan

Wipe the label and flatten any crease, and keep your fingers off the empty margin. If the barcode scanner read the bars badly once, try two clean sweeps from slightly different angles. Tilt the label a little between them. Turn it so the stripes run across the beam rather than along it. Glare from a glossy wrapper is a common culprit, and a change of angle often cures it. If a scan fails twice, key in the digits by hand and let the check digit judge them, because a mistyped number fails the same sum. You’ll quickly learn which of the two caused the trouble.

When the keyed digits fail too, read them aloud against the printed ones, pair by pair. Look hardest for a swap of neighbours, since that’s the one slip the sum may miss. Nearly every failure comes from a crease or a thumb on the margin. A label that still refuses after all of that is faulty. A member of staff can enter its number from the packet, and it won’t take long.

Questions Readers Keep Asking

Can a barcode be misread without anyone noticing?

Rarely, but yes. A random garble passes the check by luck about once in ten attempts, and a swap of neighbours that differ by 5 slips through. Shops keep the odds low by rejecting doubtful scans and sweeping again, and most mistakes die quietly that way.

Do I need to understand any of this?

Only if you type digits by hand or print labels yourself. Then the check digit is useful, because a typing slip fails the sum. For everyday scanning the process stays invisible, and a failed scan is a cue to wipe the label and try again.

How does it compare with a QR code?

A QR code stores far more data and carries spare codes to repair damage. A barcode holds one short number and detects errors without mending them. Choose a barcode for a plain product number, and a QR code for a link or a repair margin.

You may also like

Leave a Comment

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?
-
00:00
00:00
Update Required Flash plugin
-
00:00
00:00