Fuzzy Logic Light Tracker.

FUZZY LOGIC LIGHT TRACKER

POOVENDRAN A/L VILIAM

UNIVERSITI TEKNIKAL MALAYSIA MELAKA

i

FUZZY LOGIC LIGHT TRACKER

POOVENDRAN A/L VILIAM

This report is submitted in partial fulfillment of the requirements for the award of
Bachelor of Electronic Engineering (Industrial Electronics) With Honours

Faculty of Electronic and Computer Engineering
Universiti Teknikal Malaysia Melaka

APRIL 2009

ii


UNIVERSTI TEKNIKAL MALAYSIA MELAKA
FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER
BORANG PENGESAHAN STATUS LAPORAN

PROJEK SARJANA MUDA II

Tajuk Projek

:

FUZZY LOGIC LIGHT TRACKER

Sesi
Pengajian

:

2008/2009


Saya
POOVENDRAN A/L VILIAM mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di
Perpustakaan dengan syarat-syarat kegunaan seperti berikut:
1.

Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka.

2.

Perpustakaan dibenarkan membuat salinan untuk tujuan pengajian sahaja.

3.

Perpustakaan dibenarkan membuat salinan laporan ini sebagai bahan pertukaran antara institusi
pengajian tinggi.

4.

Sila tandakan ( √ ) :


SULIT*

(Mengandungi maklumat yang berdarjah keselamatan atau
kepentingan Malaysia seperti yang termaktub di dalam AKTA
RAHSIA RASMI 1972)

TERHAD*

(Mengandungi maklumat terhad yang telah ditentukan oleh
organisasi/badan di mana penyelidikan dijalankan)

TIDAK TERHAD

Disahkan oleh:

__________________________
(TANDATANGAN PENULIS)

___________________________________
(COP DAN TANDATANGAN PENYELIA)


Alamat Tetap: No. 73, Dataran Rapat Baru 13,
Taman Seri Berjaya,
31350, Ipoh,Perak.

Tarikh: ……30 APRIL 2009…………………..

Tarikh: …30 APRIL 2009…………………..

iii

DECLARATION

“I hereby declare that this report is the result of my own except for quotes as cited in
this references.”

Signature
Author
Date


: ………………………….
: POOVENDRAN A/L VILIAM
: 30 APRIL 2009

iv

DECLARATION

“I hereby declare that I have read this report and in my opinion this report is sufficient
of the scope and quality for the award of Bachelor of Electronic Engineering (Industrial
Electronics Engineering) With Honours.”

Signature

: ……………………………………

Supervisor’s Name

: MR. KHAIRUDDIN BIN OSMAN


Date

: 30 APRIL 2009

v

Dedicated to:

My beloved parents and friends for giving me unconditional love and care……………

vi

ACKNOWLEDGEMENT

I would like to take this opportunity to express my most sincere gratitude to my
project supervisor, Mr. Khairuddin Bin Osman for accepting me as his project student
and providing me excellent guidance, concern and informative support and editorial
advice in preparation of this project. In fact, he gave me guidance when obstacles arise
throughout this period of time. Once again, thanks to him for his tolerance and
endeavors.


Also not forgetting, my grateful thanks to my beloved family members for
providing me love, support and patience and at last my friends who give me support
and opinion to make my studies possible. Finally to all the people who involve directly
or indirectly in my way along to accomplish this task.

vii

ABSTRACT

Nowadays, people are chasing for technology. Technology makes people life
perfect and simple. In control designing, the conventional system used is so
complicated. To design, a person has to derive the mathematical calculation, simplify
using control theorem, and derive the model. Another simpler method in designing is
fuzzy logic. Fuzzy logic is a powerful tool in problem solving methodology that can be
applied in embedded control and information processing. It is a simple way to draw the
definite conclusions from vague, ambiguous or imprecise information. In a sense, fuzzy
logic applies the human decision making with the ability to work from approximate
data and find the precise solutions.Light tracker meanwhile is a concept where a
movement of object is based on the light. Light will act as the main part in moving the

object or specifically the robot. When the object receives the light, it will move base on
the programming requirement. The light intensity is given account here based on the
distance of the robot and source.In this project, it is mainly to build a light tracker that
uses the concept of fuzzy logic. The sensor is used as the input to trigger the function of
the motor to make movement.

viii

ABSTRAK

Pada zaman kini, manusia mengejar teknologi. Teknologi menjadikan hidup
semakin sempurna dan menyenangkan. Dalam rekaan kawalan, sistem konvensional
yang digunakan adalah sangat rumit. Untuk merekacipta, seseorang mestilah
mendapatkan pengiraan matematiknya, memudahkan dengan teori kawalan, dan
mendapatkan model sempurnanya. Satu lagi cara alternatif yang boleh diaplikasi adalah
dengan merekacipta menggunakan logic kabur. Logik kabur adalah satu kaedah yang
berkesan dalam menyelesaikan masalah yang boleh di aplikasikan dalam kawalan dan
pemprosesan maklumat. Ianya adalah antara cara mudah untuk mendapatkan keluaran
daripada masukan yang tidak tepat. Dalam erti kata lain, logik kabur adalah aplikasi
dari cara manusia memikirkan penyelesaian dengan menggunakan data –data yang

tidak berapa tepat tetapi mampu mencapai penyelesaian yang sempurna. Pengesan
cahaya pula adalah satu konsep dimana pergerakan objek adalah berdasarkan pada
lampu. Lampu akan bertindak sebagai bahan utama dalam pergerakan objek atau
spesifiknya robot. Apabila objek menerima cahaya, ianya akan bergerak berdasarkan
program yang telah diaturkan kepadanya. Kepekaan cahaya diberi tumpuan
berdasarkan jarak antara robot dan sumber lampu. Dalam projek ini, ia adalah bertujuan
untuk membina sebuah pengesan lampu, yang menggunakan konsep kabur. Pengesan
digunakan sebagai masukan untuk menggerakkan motor supaya model prototaip dapat
bergerak.

ix

TABLE OF CONTENTS

CHAPTER

I

CONTENT


PAGE NUMBER

PROJECT TITLE

i

REPORT STATUS

ii

DECLARATION

iii

SUPERVISOR’S DECLARATION

iv

DEDICATION


v

ACKNOWLEDGEMENT

vi

ABSTRACT

vii

ABSTRAK

viii

TABLE OF CONTENTS

ix

LIST OF TABLE

ix

LIST OF FIGURE

ix

LIST OF ABBREVATION

ix

LISTS OF APPENDIX

ix

INTRODUCTION

1.1 Introduction

1

1.2 Objectives

2

1.3 Problem Statement

3

1.4 Scope

4

1.5 Expected Outcome

4

x

II

III

LITERATURE REVIEW

2.1 Introduction to Fuzzy Logic

5

2.2 PIC Microcontroller

16

2.3 Photocell

24

2.4

Relay

31

2.5

Transistor

32

2.6

DC motor

38

2.7

Crystal Oscillator

39

METHODOLOGY

3.1

Introduction

40

3.2

Project Implementation

41

3.2.1

Software

Development

and

42

and

45

Implementation
3.2.2

Hardware

Development

Implementation

IV

3.3

Flow Chart of Methodology

48

3.4

Gannt Chart

49

RESULT AND DISCUSSION

4.1 Preliminary Result

50

4.2 Expected Result

51

xi

V

4.3 Programming Coding

52

4.4 Circuit Construction

59

4.5 Hardware Construction

63

4.6 Discussion

65

CONCLUSION AND RECOMMENDATION

5.1 Conclusion

70

5.2 Recommendation

71

REFERENCES

72

xii

LIST OF TABLE

NO

DESCRIPTION

PAGE NUMBER

2.1

Difference between Crisp Logic and Fuzzy Logic

9

2.2

PIC pin description

20

2.3

Cell Characteristic

28

2.5

Semiconductor Material Characteristic

35

3.4

Gantt Chart

49

xiii

LIST OF FIGURE

NO

DESCRIPTION

2.1.1

Conventional and Fuzzy design

7

2.1.2

Fuzzy Controller Block Diagram

10

2.1.3

Increasing and Decreasing

12

2.1.4

Growth and Decline of S-curve

12

2.1.5

The Inflection

13

2.1.6

Triangular Representation

14

2.1.7

Shoulder Fuzzy Sets

14

2.2.1

Harvard vs von Neuman block architecture

18

2.2.2

PIC 16F84

20

2.2.3

PIC 16F84 Microcontroller Outline

22

2.3.1

Photocells sensors characteristic

26

2.3.2

Voltage divider

26

2.3.3

Cadmium Sulfide Photocell

29

Relay

31

2.5.1

Bipolar Transistor

33

2.5.2

Operational Graph of Transistor

34

Crystal Oscillator

39

Sample of ISIS simulation layout.

43

2.4

2.7
3.2.1

PAGE NUMBER

3.2.2.1 Robot when light evenly illuminated.

46

3.2.2.2 Robot when move to left

46

3.2.2.3 Robot when move to right.

47

3.3
4.4.1

Flow Chart

48

H-Bridge circuit output

59

xiv
4.4.2

Motor Direction Switching Circuit

60

4.4.3

Voltage Regulator Circuit

61

4.4.4

Voltage Regulator (7805)

62

4.5.1

Unattached Model Of tracker

63

4.5.2

Tracker’s Circuit

63

4.5.3

Tracker’s PIC 16F877A

64

4.6.1

Circuit Simulation using Proteus

68

4.6.2

Model of Fuzzy Logic Light Tracker

69

4.6.3

Interior Part of Fuzzy Logic Light Tracker

69

xv

LIST OF ABBREVIATION

DC

-

Direct Current

DOS

-

Disk Operating System

FBD

-

Function Block Diagram

IL

-

Instruction List

PIC

-

Programmable Integrated Circuit

PSM

-

Projek Sarjana Muda

SFC

-

Sequential Function Charts

ST

-

Structured Text

xvi

LIST OF APPENDIX

APPENDIX A

-

Why use Fuzzy Logic

APPENDIX B

-

Microcontroller PIC16F84

CHAPTER 1

INTRODUCTION TO PROJECT

1.1 Introduction
Fuzzy logic is a powerful tool in problem solving methodology that can be
applied in embedded control and information processing. It is a simple way to draw the
definite conclusion from vague, ambiguous or imprecise information. In a sense, fuzzy
logic applies the human decision making with the ability to work from approximate data
and find the precise solutions.
Fuzzy logic is gaining increasing acceptance for this past few years. Starting from
1965, when Lofti Zadah, a professor at University of California-Berkeley, published a
paper on fuzzy logic, it has been both hyped and criticized. Now, there are over
thousands commercially available products using fuzzy logic, ranging from

washing machine to high speed train. Among the benefits gained from fuzzy logic
applications are simplicity, performance, cost and productivity.
Fuzzy logic method is much easier than the classical logic which requires a deep
understanding of the system, exact equation and precise numerical values. Fuzzy logic
attempts to mimic the way people applied logics in grouping and featured determination.
In this light tracker, the fuzzy logic will be used to move the motor based on the intensity
of the light received by the sensor. This project can be used for the movement of robotic.
It also can be applied in mechanical system in the form of conveyer.

1.2

Objectives

Following are the objectives set in this project:


To learn how fuzzy logic functions in robotic application



To learn how dc motor functions when programmed using fuzzy logic



To learn the function of PIC microcontroller in robotic application



To learn the function of sensor especially photodiode that controlled based on
the light intensity.



To develop a motor tracker based on the application of fuzzy logic.

1.3 Problem Statement

At the moment, there is no fuzzy logic application in robotics. The robotic
movements that already exist use conventional system which the model will have the
feedback that acts as the closed loop system. The problem that always arises is the system
must have the accurate and precise value to achieve the required output. It differs from
the fuzzy logic that it still can achieve a precise output although the input is fuzzy.
Besides that, the existing conveyer system uses mechanical system to make the
movement. This light tracker using fuzzy logic gives better control movement of the
conveyer system and the possibility for the system to breakdown is much less compared
to the conventional system.
The normal light tracker uses programming language such as C++ and visual
basic. By using fuzzy logic, the programming language is easier and has the character of
artificial intelligence. Light tracker is much more convenient to be applied in industries.
The easy movement to the light source makes it available to move around with the
condition of having light source at the destination. It is also applicable in heavy industries
where there is more mechanical movement. This mechanical movement such as conveyer
and robotic arm are hard to set once there is error. By using this tracker, the error can be
minimized as the tracker needs to follow the light source.

1.3

Scope

The scopes of the project are as follow:


The tracker is designed based on the fuzzy logic. The fuzzy logic will control the
motor rotation by using the light sensor. The sensor that receives more light will
trigger the motor circuit towards the light until both photo cell sensors have equal
light source.



This project will use the PIC microcontroller and DC motor.



Use of PIC Basic compiler to interface the programmed data with the photocell
sensor and DC motor

1.5 Expected Outcome

The expected outcome of this project is the tracker should be able to follow the
light source based on the intensity of the light that falls on the surface of the photocell
sensor. The gearbox of the light tracker will rotate the sensor array towards the light
source. In complete darkness or when there are two even light sources, the motor will
stop functioning. The motor should be applicable in robotics and industries.

CHAPTER 2

LITERATURE REVIEW

2.1 Introduction to Fuzzy Logic

Most of the time, when confronted with a control problem for a complicated
physical process, an engineer generally will follow a relatively systematic design
procedure. For example, lets take a control problem in an automobile “cruise control”
that provides automobile with the capability of regulating its own speed at a driverspecified set-point (e.g., 100 kmh). Among the solution that can be considered is by
adding an electronic controller that can sense the speed of the vehicle via the speedometer
and actuate the throttle position to regulate the vehicle speed as close as

possible to the driver-specified value. The speed must be accurate even there are
obstacles like head winds or variation in number of passengers. Based on the
understanding, an engineer will solve the problem by doing the following:


Developing a model of the automobile dynamics (which may model vehicle and
power train dynamics, tire and suspension dynamics, the effect of road grade
variations, etc.).



Using the mathematical model, or a simplified version of it, to design a controller
(e.g., via a linear model, develop a linear controller with techniques from classical
control).



Using the mathematical model of the closed-loop system and mathematical or
simulation-based analysis to study its performance (possibly leading to redesign).



Implementing the controller via, for example, a microprocessor, and evaluating
the performance of the closed-loop system (again, possibly leading to redesign).

Based on the example shown of this conventional system design, it’s a very
accurate system. But to achieve the solution, it involves a very good understanding of the
problem .The computational of the system is very complex and it’s hard to maintain the
system.
Another approach on solving this kind of problem is by using the concept of
fuzzy. From the Oxford dictionary, fuzzy is defined as blurred. Fuzziness is a
deterministic uncertainty where it is connected with the degree to which events occurred
rather than the probability of their occurrence. For example, the degree to which a person
is young is a fuzzy event rather than a random event: classification of young.