PBL3 Đồ Án Môn Học
PBL3 Đồ Án Môn Học
PBL3: DESIGN OF
MICROCONTROLLER AND SENSOR
APPLICATION DEVICES
TOPIC: SORTING AND COUNTING PRODUCTS
Da Nang, April/2022
INDEX
PREFACE ..................................................................................................... 3
CHAPTER 1: PRODUCT OVERVIEW ................................................... 4
1.1. PRODUCT INTRODUCTION ............................................................... 4
1.2. PRODUCT REQUIREMENTS............................................................... 5
CHAPTER 2: SYSTEM DESIGN .............................................................. 6
2.1. SYSTEM OVERVIEW .............................................................................. 6
2.2. COMPONENTS OF THE SYSTEM ........................................................ 6
2.2.1. Power block ......................................................................................... 6
2.2.2. Microcontroller block ........................................................................ 7
2.2.3. Sensor block ...................................................................................... 10
2.2.4. Servo Motor block ............................................................................ 14
2.2.5. Conveyor Motor Block ..................................................................... 15
2.2.6. Screen Block ...................................................................................... 15
2.2.7. Push button block:............................................................................ 16
2.3. Circuit design .......................................................................................... 17
2.3.1. Circuit design on Proteus 8.9 professional software ..................... 17
2.3.2. Practical external circuit design...................................................... 19
2.4. SOFTWARE DESIGN OF THE SYSTEM ............................................ 20
2.4.1. Algorithmic flowchart ...................................................................... 20
2.4.2. Program code on CCS software ...................................................... 23
CHAPTER 3: USER MANUALS AND SOFTWARE ........................... 31
3.1. INSTRUCTIONS FOR USE OF THE PRODUCT ............................... 31
BIBLIOGRAPHY....................................................................................... 32
Spending a semester with PBL3 under the enthusiastic guidance of Mr. Dang
Phuoc Vinh has helped us not only know more useful knowledge but also know how
to work, how to divide the best time to complete the product, know how to work in
a team, The way to support each other and above all is to take responsibility for
your tasks so as not to affect your companions.
Sincerely thanks Mr. Dang Phuoc Vinh for guiding and accompanying us during
the past semester so that we can complete PBL3 in the best way.
Servo motor
Motor block
block
Sensor block
+ The first block is an 8x8 matrix array consisting of photodiodes. These include
16 photodiodes that can filter blue, 16 photodiodes that can filter red, 16
photodiodes that can filter green and 16 photodiodes that do not filter white. All
photodiodes of the same color are connected parallel to each other, and are placed
interspersed for anti-interference purposes.
+ The nature of the above 4 types of photodiodes as light filters of different colors.
This means that it only receives light of the same color as the corresponding
photodiode and does not receive light of a different color.
• The 2nd block is a converter of current from the output of the first block into a
frequency :
➢ Operating principle:
– When there are no obstructions: light does not reflect to the collecting position or
the surface of the object does not reflect to the collecting position.
– When there are obstacles: the sensor emits light continuously from the emitter.
When encountering an obstruction, the light is reflected back to the receiver position
on the sensor. Characteristics: easily affected by surface, color and maximum
distance of 2m.
(Source: Internet)
c) 3D visualizer
The 3D visualizer of the main circuit and LCD circuit is shown as shown in Figure 2.19.
[1] Đặng Phước Vinh, Võ Như Thành, “Giáo trình kỹ thuật vi điều khiển PIC”, NXB Xây
dựng, 2022.
[2] Đặng Phước Vinh, Trần Quang Khải, Đoàn Lê Anh, Võ Như Thành, Phạm Anh Đức,
“Lập trình vi điều khiển PIC và thiết bị ngoại vi”, NXB Khoa học và kỹ thuật, 2022.
[3] Datasheet of PIC16F877A, truy cập gần nhất ngày 28/3/2023.
https://ww1.microchip.com/downloads/en/devicedoc/39582b.pdf