Tải bản đầy đủ (.docx) (54 trang)

The barcode based product classification system using arduino

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (2.47 MB, 54 trang )

THE BARCODE-BASED PRODUCT CLASSIFICATION
SYSTEM

ABSTRACT

With this product classification system project based on barcode, classifying
products will become easier and more accurate, leading to a reduction in labor force
within the factory. The GM65 scanner is used to recognize barcode types, send data
to the ATmega328 microcontroller on the Arduino board to control the sensors and
servo motors accurately to set up the products. Finally, the output data is displayed
on the LCD screen for easy monitoring of the operation process.

TABLE OF CONTENTS

ACKNOWLEDGMENT..................................................................................................II

LIST OF FIGURE...........................................................................................................XI

LIST OF TABLES........................................................................................................XIII

CHAPTER 1: OVERVIEW OF THE TOPIC..............................................................1

1.1 INTRODUCTION OF THE TOPIC:...................................................................................1
1.2 RESEARCH PURPOSE:..................................................................................................1
1.3 RESEARCH OBJECT:....................................................................................................2
1.4 RESEARCH SCOPE:......................................................................................................2
1.5 EXPECTED RESULTS:...................................................................................................2

CHAPTER 2: THEORETICAL BASIS........................................................................3

2.1 OVERVIEW OF THE ARDUINO UNO - CONTROLLER BOARD:.......................................3


2.1.1 Introduction to Arduino Uno:.............................................................................3
2.1.2 Arduino Uno R3 - Structure and Hardware:......................................................4
2.1.3 Pinout diagram of Arduino Uno R3:..................................................................5
2.1.4 Power supply:.....................................................................................................5
2.1.5 I/O Pins:..............................................................................................................6

2.2 ARDUINO IDE SOFTWARE OVERVIEW:......................................................................8
2.3 GENERAL ABOUT BARCODES AND SCANNERS GM65:................................................8

2.3.1 Barcode concept:................................................................................................8
2.3.2 Common types of barcodes:................................................................................9
2.3.3 How Barcode works:........................................................................................13
2.3.4 Classification of barcode scanners and barcode recognition methods:...........13
2.4 SERVO DC MOTOR OVERVIEW:................................................................................16
2.4.1 What is a servo motor?.....................................................................................16
2.4.2 Working principle of servo motor:....................................................................16
2.5 OPERATING PRINCIPLE OF INFRARED SENSORS:.......................................................18

CHAPTER 3: DESIGN AND CONSTRUCTION.....................................................19

3.1 THE BLOCK DIAGRAM OF THE SYSTEM:...................................................................19

3.1.1 Power Block:.....................................................................................................19
3.1.2 Code Scan Block:..............................................................................................21
3.1.3 Processing block:..............................................................................................23
3.1.4 Sensor Block:....................................................................................................23
3.1.5 Motor Block:.....................................................................................................24
3.1.6 Display block:...................................................................................................26
3.2 GENERAL PRINCIPLE DIAGRAM:...............................................................................29


CHAPTER 4: PROCEED TO IMPLEMENT............................................................30

4.1 SYSTEM OPERATION:................................................................................................30
4.2 ALGORITHM FLOWCHART OF THE SYSTEM:..............................................................30

CHAPTER 5: EXPERIMENT.....................................................................................32

5.1 EXPERIMENTAL PROCESS:........................................................................................32
5.1.1 Designing printed circuit:.................................................................................32
5.1.2 Printed circuit construction:.............................................................................33
5.1.3 Load the program and run the printed circuit:.................................................35

5.2 EXPERIMENTAL RESULTS:........................................................................................37
5.3 EXPERIMENTAL CONCLUSIONS:................................................................................38

CHAPTER 6: CONCLUSION.....................................................................................39

6.1 ADVANTAGES:..........................................................................................................39
6.2 DISADVANTAGES:.....................................................................................................39
6.3 DIRECTION OF DEVELOPMENT:.................................................................................39

REFERENCES.................................................................................................................41

APPENDIX ....................................................................................................................43

LIST OF FIGURE

Figure 2-1 Pinout diagram of Arduino Uno R3.........................................................5
Figure 2-2 Interface of Arduino IDE 2.0.4................................................................8
Figure 2-3 UPC barocde..........................................................................................10

Figure 2-4 EAN barcode..........................................................................................10
Figure 2-5 Code 39..................................................................................................10
Figure 2-6 Code 128................................................................................................11
Figure 2-7 QR code.................................................................................................12
Figure 2-8 Matrix code............................................................................................12
Figure 2-9 PDF417 barcode....................................................................................12
Figure 2-10 How barcodes work.............................................................................13
Figure 2-11 Structure of Laser Barcode Reader......................................................15
Figure 2-12 The principle of reading barcodes........................................................15
Figure 2-13 Working principle of servo motor........................................................17
Figure 2-14 Operating principle of infrared sensors................................................18
Figure 3-1 The block diagram of the system...........................................................19
Figure 3-2 Specifications of IC 7805.......................................................................20
Figure 3-3 Power Block diagram.............................................................................20
Figure 3-4 The GM65 barcode reader module.........................................................21
Figure 3-5 Processing Block....................................................................................23
Figure 3-6 Infrared sensor.......................................................................................23
Figure 3-7 Wiring diagram for sensors....................................................................24
Figure 3-8 Servo motor............................................................................................25
Figure 3-9 Wiring diagram of servo motors............................................................25
Figure 3-10 LCD Screeen........................................................................................26
Figure 3-11 Wiring diagram of LCD with arduino..................................................28
Figure 3-12 General principle diagram....................................................................29
Figure 4-1 Algorithm flowchart of the system.........................................................31

Figure 5-1 PCB circuit.............................................................................................32
Figure 5-2 PCB circuit.............................................................................................33
Figure 5-3 Printing circuit into paper.......................................................................33
Figure 5-4 Complete printed circuit.........................................................................34
Figure 5-5 Circuit after attaching component pins..................................................35

Figure 5-6 LCD displays.........................................................................................36
Figure 5-7 Completed system..................................................................................37

LIST OF TABLES

Table 2-1: Specifications of Arduino Uno R3...........................................................5
Table 3-1 specifications...........................................................................................20
Table 3-2 Specifications of GM65 barcode reader module.....................................21
Table 3-3 Specifications of LCD.............................................................................27

PROJECT OF EMBEDDED SYSTEM
PAGE 1

CHAPTER 1: OVERVIEW OF THE TOPIC

1.1 Introduction of the topic:
Nowadays, our country is entering the era of industrialization and

modernization, according to the trend of automation and rapid development.
Therefore, it requires us to focus on improving and building production systems in
order to reduce production costs, enhance labor productivity and produce high-value
products.

It can be seen that product classification is a simple but essential requirement in
factories, especially product classification based on various criteria to replace
human labor. Product classification brings many benefits, such as replacing and
reducing labor force, avoiding boredom at work, improving working conditions,
creating opportunities to access advances in science and technology and working in
a new and increasingly civilized environment.


In addition, product classification helps to improve labor productivity, create a
premise for reducing product costs, and quickly change product models. It also
simplifies management and monitoring, as it not only changes the working
conditions of workers but also minimizes the number of required workers.

There have been many automated systems applied and implemented, all of
which are relatively complex systems. With their knowledge and understanding of
reality, they have undertaken the project "The barcode-based product classification
system".

1.2 Research purpose:
The design consists of a product classification system tailored to the

requirements of the production line, which uses The GM65 barcode reader module
capable of scanning both 1D and 2D barcodes to input data into the central
processing unit, the Arduino Uno microcontroller, to control two servo motors to
properly sort the scanned product.

1.3 Research object:

THE BARCODE-BASED PRODUCT

CLASSIFICATION SYSTEM

PROJECT OF EMBEDDED SYSTEM
PAGE 2

Understanding popular barcode standards: Understand popular barcode
standards such as UPC, EAN, Code 128, Code 39, etc. to understand how products
are identified and classified using these codes.


Barcode reading technology: Learn about modern barcode reading technologies
such as optical scanning, image sensing, RFID, etc. to increase reading speed and
accuracy.

Learn about capacitor components, voltage regulators, and ICs.
Learn about GM65 barcode scanner.
Learn about the Arduino Uno microcontroller, Atmega328 chip, and Arduino
software.
Learn about the sg90 servo motor and its operation.
Learn how to connect and operate the LCD 1602 display.

1.4 Research scope:
The device uses 12VDC power, used anywhere with small items that can be

sorted.

1.5 Expected results:
The system has the ability to read and process information stably when facing

different situations such as scanning multiple barcodes in a short period or scanning
different types of barcodes.

It can classify three different types of products.
The sensor and servo motor only operate when the correct product is detected.
The display shows the barcode and the number of products that have been
classified.

CHAPTER 2: THEORETICAL BASIS


1.6 Overview of the Arduino Uno - controller board:
1.1.1 Introduction to Arduino Uno:

THE BARCODE-BASED PRODUCT

CLASSIFICATION SYSTEM

PROJECT OF EMBEDDED SYSTEM
PAGE 3

Arduino is an open-source platform used for building electronic projects and a
microcontroller board used for programming to interact with hardware devices such
as sensors, motors, lights, and many other devices.

The highlight of Arduino is its extremely easy-to-use application development
environment with a programming language that can be quickly learned, even by
beginners in electronics and programming. Arduino is widely used globally and is
increasingly proving its power through countless applications, unique systems of
open-source community users.

Arduino is open-source from hardware to software, with a very low cost. With a
small amount of money, users can own an Arduino board with 20 I/O ports that can
interact and control about that many devices. Arduino has strengths over other
microcontroller platforms, including:

- Runs on multiple platforms (programming can be done on different operating
systems, including Windows, Mac OS, Linux on desktop, and Android on
mobile).

- Simple and easy-to-understand programming language; open platform, as it

is developed based on open-source, allowing software to run on Arduino to
be easily integrated on different platforms; hardware expansion is easy, as
Arduino is designed and used as a module; it is simple, quick to assemble,
program and use the device; easy to share, as people can easily share source
code without worrying about the programming language or operating system
they are using. Arduino has many eye -catching applications, including 3D
printers, robots, UAVS, interactive games, lighting controls and high -speed
photography triggers.

Arduino Uno R3 microcontroller board is one of the most popular committees in
the Arduino family. It was launched in 2011 and is the latest version of Arduino's
board. This kit circuit is based on the ATMEGA328P microcontroller to control and
operate the microcontroller. The United Nations Board is the first product in the
series of boards used by USB for communication.

THE BARCODE-BASED PRODUCT

CLASSIFICATION SYSTEM

PROJECT OF EMBEDDED SYSTEM
PAGE 4

Arduino has many notable applications, including 3D printers, robots, unmanned
aerial vehicles (UAVs), interactive games, light controls, and high-speed
photography triggers.

The Arduino UNO R3 microcontroller board is one of the most popular in the
Arduino family. It was introduced in 2011 and is the latest version 3 of the Arduino
board. This kit circuit is based on the ATmega328P microcontroller to control and
operate the microcontroller. The Uno board was the first product in the series of

boards that used USB for communication.

1.1.2 Arduino Uno R3 - Structure and Hardware:
About Arduino, Arduino Uno R3 is the most popular version of Arduino. The

United Nations version is a revised version 3 (R3), which is currently the latest
version. Compared with the old version of Arduino Uno, accuracy and durability
are much higher. Arduino Uno R3 is equipped with three types of 8 -bit AVR
microcontrollers, including Atmega8, Atmega168 and Atmega328.

Table 2-1 Specifications of Arduino Uno R3

Operating voltage 5V (USB)
Recommended operating voltage 6 to 9V
Number of digital I/O pins 14 pins ( 6 pins PWM)
Number of analog I/O pins 6 pins

Maximum output current per pin I/O 30 mA

Maximum output current (5V) 500 mA
Maximum output current (3.3V) 50 mA
32KB (ATmega328) with
Flash memory
0.5KB used by bootloader
SRAM 2 KB
EEPROM 1 KB
Operating frequency 16 MHz

THE BARCODE-BASED PRODUCT


CLASSIFICATION SYSTEM

PROJECT OF EMBEDDED SYSTEM
PAGE 5

1.1.3 Pinout diagram of Arduino Uno R3:

Figure 2-1 Pinout diagram of Arduino Uno R3

An Arduino Uno R3 board consists of 20 input and output pins, of which 6
function pins are PWM inputs and 6 function pins are PWM inputs.

1.1.4 Power supply:
Arduino Uno is powered with 5V through USB connection or external power

supply. The external power source (not from USB) can be obtained from AC-DC
converter module or battery pack.

To connect with converter module, we can plug a 2.1mm center-positive plug
into the power jack on the board. When using battery pack, the pack is connected
between Vin and GND pins to supply power.

Arduino Uno can operate with external power source from 6 to 20V. If using
lower voltage, typically 7V, the 5V pin may supply less than 5V, but it may cause
unstable operation.

When using power source above 12V, the voltage regulator will become hot and
may get damaged, therefore it is recommended to use power source from 7 to 12V.

The energy pins are as follows:


THE BARCODE-BASED PRODUCT

CLASSIFICATION SYSTEM

PROJECT OF EMBEDDED SYSTEM
PAGE 6

 Vin (Voltage Input): is where external power source is supplied to
Arduino UNO (from 7V-12V), we can supply power through Vin pin
or via a power jack which is connected to this pin and the negative
pole of the supply is connected to the GND pin.

 GND (Ground): is the negative pole of the power supplied to Arduino
UNO. When we use devices with separate power sources, their
negative pins must be joined together.

 5V: is the output voltage supplied by Arduino UNO. The maximum
current allowed on this pin is 500mA.

 3.3V: is the output voltage of 3.3V. The maximum current allowed on
this pin is 50mA.

 IOREF (Input Output Reference): is the operating voltage of the
microcontroller on the Arduino UNO. It can be measured at this pin
and is 5V. However, it is not used to supply power from this pin.

 RESET: Pressing the Reset button on the board resets the
microcontroller. It corresponds to connecting the RESET pin to GND
via a resistor (10KΩ).).


1.1.5 I/O Pins:
The Arduino UNO R3 kit has 14 digital pins that can be used as input or output

pins by using functions such as pinMode(), digitalRead(), and digitalWrite(). They
have only 2 voltage levels which are 0V and 5V, with a maximum input/output
current of 40mA on each pin. Each pin has pull-up resistors built into the
ATmega328 microcontroller (these resistors are not connected by default).
Some digital pins have special functions as follows:

 2 Serial pins: 0 (RX) and 1 (TX): used to send (TX) and receive (RX) TTL
Serial data. Arduino Uno can communicate with other devices via these pins.
Wireless serial connection, such as Bluetooth connection, is often referred to
as wireless Serial. If serial communication is not needed, it is not necessary
to use these pins.

THE BARCODE-BASED PRODUCT

CLASSIFICATION SYSTEM

PROJECT OF EMBEDDED SYSTEM
PAGE 7

 PWM (Pulse Width Modulation) pins (~): 3, 5, 6, 9, 10, and 11: these pins
allow you to output PWM with 8-bit resolution (values from 0 to 255
corresponding to the voltage range of the pin from 0V to 5V) using
analogWrite() function. In other words, you can adjust the output voltage of
this pin from 0V to 5V, instead of just fixing it at 0V and 5V like other pins.

 SPI (Serial Peripheral Interface) pins: 10 (SS), 11 (MOSI), 12 (MISO), 13

(SCK): In addition to their normal functions, these 4 pins are also used to
transmit data using the SPI protocol with other devices.

 LED 13: there is a orange LED (with "L" label) on the Arduino UNO board.
When you press the Reset button, you will see this LED flash as a signal. It
is connected to pin 13. When this pin is used by the user, the LED will be
turned on.

 Arduino UNO has 6 analog pins (A0 to A5) that provide 10-bit signal
resolution (0 to 210-1) to read voltage values ranging from 0V to 5V. With
the AREF pin on the board, you can provide a reference voltage when using
analog pins. That is, if you supply 2.5V to this pin, you can use the analog
pins to measure voltage values from 0V to 2.5V with a resolution of 10-bits.

Particularly, Arduino UNO has 2 A4 (SDA) and A5 (SCL) pins that support
I2C/TWI communication with other devices.

1.7 Arduino IDE Software Overview:
Arduino IDE stands for 'Arduino Integrated Development Environment', which

is an open-source software environment primarily used to write code on a compiler
similar to C/C++ and load them into microcontroller boards.

The programming environment is simple and easy to use, the programming
language is easy to understand and based on the familiar C/C++ platform for
technical people. And importantly, the number of pre-written and shared code
libraries by the open community is incredibly large.

THE BARCODE-BASED PRODUCT


CLASSIFICATION SYSTEM

PROJECT OF EMBEDDED SYSTEM
PAGE 8

Figure 2-2 Interface of Arduino IDE 2.0.4

1.8 General about barcodes and scanners GM65:
1.1.6 Barcode concept:

THE BARCODE-BASED PRODUCT

CLASSIFICATION SYSTEM

PROJECT OF EMBEDDED SYSTEM
PAGE 9

Barcode (or also known as a barcode) is a method of storing and transmitting
information using a symbol called a barcode symbology. A barcode symbology or
simply barcode, is a symbol composed of a combination of straight bars and spaces
that represent patterns of characters, symbols, and numeric digits. Variations in the
widths of the bars and spaces represent data in the form of digits or characters that
can be read by a machine.

As an automatic identification technology, barcode allows for quick and
accurate data collection.

1.1.7 Common types of barcodes:
Around us there are many types of barcodes, the most commonly seen are 2


types of 1D and 2D codes.
1.1.1.1 1D barcode:

1D barcode (one-dimensional barcode) is a common linear barcode type,
consisting of alternating black and white parallel bars where data is encoded based
on the width (horizontal) of the bars. Each 1D barcode usually contains 20-25
characters of data. They are commonly used in retail and printed on packaging,
bags, boxes, etc. The commonly used types of 1D barcodes include:

- Universal Product Code (UPC): with parallel black bars encoded from an 11-
digit string (valid from 0 to 9) and a check digit at the end to create a
complete 12-digit barcode. It is used for labeling and checking consumer
goods at fixed points of sale worldwide. This barcode type is managed by the
US-based Uniform Code Council (UCC). Applications include retail,
supermarkets, consumer goods, etc.

THE BARCODE-BASED PRODUCT

CLASSIFICATION SYSTEM

PROJECT OF EMBEDDED SYSTEM
PAGE 10

-

Figure 2-3 UPC barocde

- EAN (European Article Number): is an improvement of UPC-A barcode,
with the main difference being geographic application. Applications include
retail, supermarkets, consumer goods,....


Figure 2-4 EAN barcode

- Code 39: overcomes the biggest drawback of the above two barcodes, which
is the ability to encode an unlimited amount of data and a wider range of
characters, including uppercase letters, natural numbers, and some special
characters. Applications include Defense Department, healthcare,
administrative agencies, book publishing...

Figure 2-5 Code 39

THE BARCODE-BASED PRODUCT

CLASSIFICATION SYSTEM

PROJECT OF EMBEDDED SYSTEM
PAGE 11

- Code 128: is a highly rated and widely used barcode type due to its many
outstanding advantages: Compact barcode, stores a wide range of
information, and can encode more characters including uppercase letters,
lowercase letters, digits, standard ASCII characters, and control codes.
Applications include supply chain and logistics, retail supply chain,
manufacturing industry

Figure 2-6 Code 128

1.1.1.2 2D barcode:
2D barcode (also known as QR code) is a form of barcode that represents data


encoded in a matrix of small and large squares alternatively. The data in the 2D
barcode can be arranged horizontally or vertically, allowing it to store more
information than the 1D barcode. The 2D barcode can contain at least 2000
characters, and it's commonly used to link to websites or track products, identify
products, online payment, etc. The most common type of 2D barcode is QR Code
(Quick Response Code), which is widely used in advertising and branding, product/
service introduction, promotional campaigns, information retrieval, even for
scanning payment and money transfer at some banks.

- QR Code has many advantages, such as diverse sizes, fast data reading,
supporting 4 different data encoding modes (numeric, alphanumeric, byte,
Kanji), less error-prone, and especially, it's free to use.

THE BARCODE-BASED PRODUCT

CLASSIFICATION SYSTEM

PROJECT OF EMBEDDED SYSTEM
PAGE 12

Figure 2-7 QR code

- Matrix code: This type of barcode is used for naming goods and documents.
Similar to QR Code, this barcode is rarely error-prone during use and has
fast reading capabilities..

Figure 2-8 Matrix code

- PDF417 barcode: PDF417 is a 2D barcode that is used in applications that
require storing massive amounts of data, such as digital images, fingerprints,

numbers, graphics, signatures, etc. This barcode is commonly used overseas.

Figure 2-9 PDF417 barcode

1.1.8 How Barcode works:

THE BARCODE-BASED PRODUCT

CLASSIFICATION SYSTEM

PROJECT OF EMBEDDED SYSTEM
PAGE 13

While you encounter barcodes on a daily basis, have you ever pondered how
they work? The following is how barcodes work:

- First, barcode scanners will beam light through the barcode and then into a
super-sensitive light detector using an incandescent light bulb or laser.

- The barcode's black lines absorb light, while the white elements of the
barcode show through and are reflected.

- The scanner measures the amount of light and converts it into computer-
readable data. For example, the light scanner records the black sections that
do not reflect well as 1 and the white parts as 0.

- On the system, inventory management software will receive and interpret
this information.

Figure 2-10 How barcodes work


1.1.9 Classification of barcode scanners and barcode recognition methods:
To read barcode symbols, people use a type of device called a barcode scanner,

which is essentially an optical reader that uses a beam of light or laser. Sometimes
when looking at a barcode symbol, we may see a series of numbers directly below
the barcode, while other times there may be nothing there.

THE BARCODE-BASED PRODUCT

CLASSIFICATION SYSTEM

PROJECT OF EMBEDDED SYSTEM
PAGE 14

This series of numbers is the encoded code that the barcode symbol represents.
The presence or absence of this number is due to the barcode printing software that
creates the barcode that can be recognized by human eyes. It is important only for
humans, not for machines since the machine cannot understand this number, but
only read the barcode symbols themselves - the black and white spaces.

There are two types of barcode readers classified according to the manufacturing
technology:

- Laser Barcode Reader.
- CCD Barcode Reader.
Since my system uses Laser Barcode Reader, I will focus on Laser Barcode
Reader.
1.1.1.3 Structure of Laser Barcode Reader:
Laser light is shone on the label surface and its reflection is captured by a sensor

(laser photo detector) to read a bar code.
A laser beam is reflected off a mirror and swept left and right to read a bar code
Using laser allows reading of distant and wide bar code labels.

Figure 2-11 Structure of Laser Barcode Reader

The Laser Barcode Reader type consists of the following components: a laser
diode, a polygon mirror, a motor, and a light-receiving element (photodiode).

THE BARCODE-BASED PRODUCT

CLASSIFICATION SYSTEM


×