How to barcode scanners instantly detect what an item is, despite the barcode being at any angle and often on a crinkled surface, completeley changing the look of the code from the scanner’s perspective?

902 views

How to barcode scanners instantly detect what an item is, despite the barcode being at any angle and often on a crinkled surface, completeley changing the look of the code from the scanner’s perspective?

In: Technology

6 Answers

Anonymous 0 Comments

The barcodes is designed in such a way that they are easy to read in different conditions. For example the very common UPC-A barcode used to encode almost all retail products all have the same number of bars and only differentiaties in the width of the bars in relation to each other. The barcode is not valid in reverse but can easily be detected as being in reverse allowing the scanner to reverse its scan direction if you scan something upside down.

Anonymous 0 Comments

The lasers that read the barcode hit it from many angles and scan it very quickly. Also barcodes have something like a checksum, where it’s easy to recognize if the data that was read is garbage and needs to be read again. That’s why when using hand scanners, like at the grocery store, sometimes it scans a valid item very quickly, and somtimes it takes a while.

The built-in scanners in the checkout lanes have lasers that shot from the sides and from the bottom.

Anonymous 0 Comments

A barcode is a 1 dimensional code.

The fact that it’s drawn in a 2 dimensional shape simply allows for it to be accurately read from a number of angles and positions. A little bit of crinkle or if the reader is a little diagonal doesn’t really affect how the reader sees the lines in the code. The biggest threat to reading a barcode is if it’s underneath a reflective cellophane, or partially covered by a price tag.

In truth, all those lines in a barcode really look something like this:

https://puu.sh/EJfL9/9824e1e6c6.png

Each bars width, and the empty space between corresponds to a number, with an identifiable “start” and “end” character which is always present for certain barcode types. Really a barcode is nothing more than a 1 pixel tall font.

If we printed barcodes, however, just 1 pixel high it would be excruciating for the cashier to line up the little laser gun directly over the line, so we stretch them tall that way if the line is at the top of the code, or the bottom, or even diagonally across it, the ratios between each bar are maintained, and it can be read. The absolute width of each line is irrelevant in order to read it, just the relative width compared to the adjacent bars (much like changing the size of a font doesn’t change the meaning of the words).

EDIT: Reddit didn’t like how I showed the barcode example before

Anonymous 0 Comments

It depends on the scanner for many of those to be true. A very simple barcode scanner will simply read one direction (allowing some but not much tilt) while others will use various techniques to account for these challenges.

In most cases, a beam of light is fired at a thin foil that is extremely sensitive to current change, allowing a rapid low current to be pulsed in to control the angle of the beam. Some, such as grocery store checkout lanes, supply multiple beams and reflectors allowing any angle to be scanned.

The reflection of the beam is sent back to the scanner when a reflection is possible, toggling an internal state between 1 and 0. During this, either the duty cycle – the time between “reads” of that 0/1 state, is constantly slowed and sped up, or the pulse rate to the reflectors is variated, changing the sampling rate very rapidly. This allows for distance to be much less of an issue. Basically, there’s always a beam of light and the hardware is asking repeatedly “Do you see the emitted IR light?”

That data is pushed into a cyclical buffer, and each read triggers a checksum calculation. Since the length of the code(s) are known, it allows the assertion “If these are the numbers, their sum should calculate to the check digit.” – if the checksum for example is just a basic digital root, and the numbers read as 6,4,8,3,7, then 6+4+8+3+7=28, 2+8=10, 1+0=1, so the check digit must be a 1.

To detect the start and end of a barcode, a specific character is often used – since were dealing with binary, it’s often a non-numeral character such as * or a,b,c – this extra data not only serves the purpose of telling a scanner where a start of a barcode is so it knows it can use more processing power to actually read the code, but the kind of code it is so it knows what checksum formula to use and how long to expect the barcode. These little details allow them to be extremely fast as it’s quick to tell, “If my buffer doesn’t start with *, it’s not a barcode, keep reading”

You can act see the effects of that on much older scanners, they’ll start flickering at a certain rate, quickly ramp up and down, then shut off when it hits that known character, often pausing for 1-2 seconds before the register receives a barcode.

tl;dr, you can take a piece of paper and put a series of dots in a Braille fashion, 1 dot for one, 2 for off. Start a metronome and “read” whatever is under your finger, even if it’s the same dots or 3 dots apart, moving your finger at a constant rate, counting on/off, and grouping every 4 dots. Convert from binary to numbers. Repeat adjusting the metronome up or down until your finger hits each dot once per tick. That’s all it’s doing just using light.

(I don’t expect you to actually do that but if you do – props – it also illustrates how much faster computers are at “thinking” than we are.

Anonymous 0 Comments

The barcode is made of white and black bars. Every digit has a seven bar pattern. The code has also a divider in the middle, so we got left and right side.

On the left, every number have an odd number of black bars and an even number of white bars. On the right, the colors are reversed, so what was white is black and vice versa.

I don’t know the code, but let’s say zero is 3 black followed by 4 white on the left. When on right, it will be 3 white, 4 black.

That way, you could know when it’s upside down, or sideways, and read in the right direction.

Anonymous 0 Comments

A scanner uses a laser to shine at the code, and it just detects how bright the reflection is.

Because the laser beam is small and doesn’t spread out, it doesn’t matter how far away the product is. It is always being lit by a tiny spot moving across the code.

The numbers aren’t coded by the width of the stripes, as many people say. The information is coded by whether the pattern changes, dark-to-light or light-to-dark, at a certain point. If it changes, that’s a 1, if it doesn’t change, that’s a 0. So a thick black line and a thick white line are the same thing = 3 ‘places’ where it doesn’t change, a pattern of 1 0 0 0 1 – the front edge of the line, 3 places where it doesn’t change, and the rear edge of the line. So it doesn’t matter if the barcode is printed as black on white, or white on black. Or matt ink on shiny aluminium. Just as long as the light reflected off it changes.

Or at an angle. Or even backwards – the scanner can recognise if a code comes to it backwards, and can flip it around.

If you have noticed a supermarket scanner, you’ll see many lines at different angles. The mirrors inside the scanner – mirrors attached to a spinning wheel – are at all different angles, so they make the laser sweep at different angles, so it will always manage to sweep across the code, from one end to the other, at some point.

An important point that allows it to scan at different distances or angles is the codes themselves – they always start and end with two thin vertical lines. These vertical lines represent 5 changes – two changes for the edges of each line, and the change for the front edge of the first line of the first number – and this sequence of 5 1’s allows the scanner to determine how fast the laser is sweeping across the barcode, and so where to expect the changes, allowing it to compensate for the barcode being at an angle, or at a different distance. There are also 2 vertical lines in the middle, so the scanner can make sure that things haven’t changed, because of a crease in the code or the person moving the item too fast. (We call this process, ‘clock recovery’)