Skip to content
Learnearn.uk » IGCSE Computer Science Course » Barcode Scanners

Barcode Scanners

Introduction

Barcode Readers

With the rapid growth of a consumer society in post-war America there grew a demand for technologies that would improve the efficiency of stock control and sales of goods. The first patent for barcodes was issued in 1951, for a circular barcode. Adapted from Morse code and using variable thickness rings it was a revolution waiting to happen. Unfortunately, due to a number of reasons it was another 20 years before the technology took off with a linear barcode version developed by IBM. barcode scanner

This technology originally consisted of :

  • A barcode scanner
  • A printed barcode, located on a product.

Barcode Scanningbarcode

When the product is scanned, the vertical black and white bars were converted in a decimal number, and this number was used as the product code. Because data is only encoded in 1 direction (across the bars) they are known as 1 dimensional barcodes, as opposed to newer QR codes, which are 2 dimensional barcodes.

This meant that shops could accurately input the:

  • Price of the product, meaning the sale price was correct
  • The product ID, meaning that the sale could be automatically passed to the stock control database and stock levels could be updated automatically

The human readable form of the barcode is printed below, in case the barcode scanner fails and the code needs to be entered manually.

 

Barcodes

How 1 dimensional barcodes work

Barcodes are a machine readable form of data. They consist of a number of vertical black and white bars, into which the number is encoded. Below the barcode is the same number written in a human readable format, in case the data needs to be entered manually due to equipment failure.

The most common form of 1 dimensional barcode is the Universal Product Code(UPC), this is the type of barcode found on most products in shops and online.

The data is encoded in the following format:

Guard Bars

These bars serve as a reference point for barcodes and are used by the scanner to determine the boundary of the barcode and the width of an individual line.

Number System Bars

These are normally used to represent the product type

Manufacturer ID 5 digits (0-9)

This represents the manufacturer ID. Because each manufacturer is issued a unique ID by the issuing authority, no two barcodes by different manufacturers should be the same.

Middle Bars

The middle bars are used as a reference point for scanners to determine if the barcode is upside down or the right way up.

Product ID 5 digits (0-9)

This represents the ID of the individual product from the manufacturer.

Modulo check bars

This contains the check digit, used to check for automatic read errors. The human readable form below is also added to check for manual human input errors.

Barcode Digits

How are the digits encoded?

UPC barcodes contain a total of 10 encoded digits, 5 on the left, 5 on the right.

 

Each digits is made up of 7 segments and the number of bars is always 2 black and 2 white, or varying thickness.

Notice how it is split into 7 segments?

On the left hand digits the total number of segments used for black lines (out of the 7 max) is always an even number.

The right hand digits are the exact opposite in color, therefore they have odd parity,

 

 

 

 

 

 

 

The right and left hand side digits are encoded exactly opposite.

Note that the right hand digits are the exact opposite to the left hand digits

 

 

 

 

 

 

 

 

Barcode Scanners

How barcode scanners work

Barcode scanners work by emitting a wide beam of infrared, visible or laser light.

Step 1 – Light is emitted from the barcode scanner

In the first step a beam of light is emitted from the scanner. Depending on the scanner used it can be infrared light, laser light or visible light. Most modern supermarket scanners use laser light, as it is highly effective.

Step 2 – The light is reflected back from the barcode

The light bounces back from the barcode. The dark sections of the barcode absorb more light and so less light is reflected back from the dark bar areas.

Step 3 – Mirrors direct the returned light onto the face of a Charge Couple Device.

Mirrors inside the scanner direct and focus the returning light onto the surface of a charge coupled device. The CCD contains an array of photosensitive cells, varying the electrical signal being passed by the CCD.

Step 4 – The analogue signal is converted to digital form.

An analogue to digital convertor (ADC) inside the reader converts the data from analogue electrical signals to digital form and checks that the barcode has been scanned correctly, through the use of the modulo bar data.

Step 5 – The scanner sends the barcode data to the computer.

Once the data has been converted and checked, the data is passed on to the computer. In a supermarket the computer is usually an Electronic Point Of Sale(EPOS) device, tailored to the needs of the supermarket.

Pros & Cons

Advantages & Disadvantages of Barcode Readers

Advantages

  • Stock levels can be updated automatically, making stock control easier
  • Very cheap for each label, as it was just printed on the side of the product label

Disadvantages

  • Limitations on 2D barcodes mean that individual items can’t be tracked, only product types.
  • Doesn’t help track the product for security purposes

Quiz

Topic Review Quiz

Resources

Resources

Python Programming Challenge

Write a python program that takes an 11 digit code and converts it to the correct sequence of black and white to be encoded on the barcode.

Bonus challenge – Adapt your algorithm to calculate the MOD 10 check digit at the end of the barcode

 

 

0478/12 Paper 1 Theory May/June 2015 – Qn3

0478/12 – Paper 1 Theory May/June 2016 Qn 9

0478/11 – Paper 1 Theory May/June 2017 Qn 9

0478/12 Paper 1 Theory February/March 2018 Qn11

0478/11 – Paper 1 Theory May/June 2018  Qn8