24
DEVELOPMENT OF INTELLIGENT TECHNIQUES FOR DINAR AND DIRHAM COINS DETECTION AND PRICE PREDICTION BY MOHAMAD GHAZALI B. AMEER AMSA A dissertation submitted in fulfilment of the requirement for the degree of Master of Science in Mechatronics Engineering Kulliyyah of Engineering International Islamic University Malaysia APRIL 2013

DEVELOPMENT OF INTELLIGENT COINS DETECTION AND …

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

DEVELOPMENT OF INTELLIGENT

TECHNIQUES FOR DINAR AND DIRHAM

COINS DETECTION AND PRICE

PREDICTION

BY

MOHAMAD GHAZALI B. AMEER AMSA

A dissertation submitted in fulfilment of the

requirement for the degree of Master of

Science in Mechatronics Engineering

Kulliyyah of Engineering

International Islamic University

Malaysia

APRIL 2013

ii

ABSTRACT

Nowadays, there are several efforts to reintroduce the gold (Dinar) and silver

(Dirham) coins among Muslim countries and even worldwide. This phenomenon

directly increases the awareness among the people to buy gold for investment and

other usages (e.g. paying zakat, barter trading, dowry, etc). Unlike jewelry, Dinar and

Dirham coins have standard values such as standard weight, diameter, thickness and

material content. Consequently, the conventional material content testers normally

used for jewelry do not fulfill the Dinar and Dirham coins verification requirement

since the aforementioned standard values are not measured. In this research, a real

time system is developed to detect these bimetallic coins based on material content,

diameter and thickness analysis. The developed coins detection system is equipped

with three sensors comprising of eddy currents sensor, diameter measurement sensor

and infrared sensor. A Colpitts oscillator is used as an eddy current sensor to test

material content and physical properties of the coins. This oscillator circuit is designed

through a combination of Genetic Algorithm (GA), Artificial Neural Network (ANN)

and basic circuit analysis techniques, while the coil for this oscillator is designed base

on experimental approach. Diameter measurement sensor in this system is used to

measure the diameter of coin, whereas an infrared optical sensor is used to detect the

presence of the test coin inside the system. Furthermore, in order to assist Dinar and

Dirham investors know the most appropriate time to trade these bimetallic coins, a

price prediction modal is developed and incorporated with coin prediction system.

This price prediction model is developed through a combination of Autoregressive

(AR) model and ANN to predict the next day price of Dinar and Dirham. Unlike

existing techniques, in this study ANN is used to find the model coefficients for AR

prediction model. Coin detection system and price prediction system are integrated in

such a way that each time the Dirham coin is detected by the coin detection system,

the prediction system will predict the next day price of that Dirham. AtMega328

microcontroller is used as the data acquisition and controller unit for the developed

system.

iii

ملخص البحث

iv

APPROVAL PAGE

I certify that I have supervised and read this study and that in my opinion, it conforms

to acceptable standards of scholarly presentation and is fully adequate, in scope and

quality, as a thesis for the degree of Master of Science (Mechatronics Engineering).

……….........................................

Momoh Jimoh E. Salami

Supervisor

I certify that I have read this study and that in my opinion it conforms to acceptable

standards of scholarly presentation and is fully adequate, in scope and quality, as a

thesis for the degree of Master of Science (Mechatronics Engineering)

…….. .………………………………

Mahammad Mahbubur Rashid

Internal examiner

I certify that I have read this study and that in my opinion it conforms to acceptable

standards of scholarly presentation and is fully adequate, in scope and quality, as a

thesis for the degree of Master of Science (Mechatronics Engineering)

...……………………………………

Paulraj Murugesan

External examiner

This thesis was submitted to the Department of Mechatronics and is accepted as a

fulfilment of the requirement for the degree of Master of Science (Mechatronics

Engineering)

………………...……………………

Md. Raisuddin Khan

Head of Department of Mechatronics

This thesis was submitted to the Kuliyyah of Engineering and is accepted as a

fulfilment of the requirement for the degree of Master of Science (Mechatronics

Engineering)

….…………... ……………………

Md Noor Bin Salleh

Dean, Kuliyyah of Engineering

v

DECLARATION

I hereby declare that this dissertation is the result of my own investigations, except

where otherwise stated. I also declare that it has not been previously or concurrently

submitted as a whole for any other degrees at IIUM or other institutions.

Mohamad Ghazali B. Ameer Amsa

Signature……………………………. Date ……………………

vi

INTERNATIONAL ISLAMIC UNIVERSITY MALAYSIA

DECLARATION OF COPYRIGHT AND AFFIRMATION

OF FAIR USE OF UNPUBLISHED RESEARCH

Copyright © 2012 by International Islamic University Malaysia. All rights reserved.

DEVELOPMENT OF INTELLIGENT TECHNIQUES DINAR AND

DIRHAM COINS DETECTION AND PRICE PREDICTION

I hereby affirm that The International Islamic University Malaysia (IIUM) holds all

rights in the copyright of this Work and henceforth any reproduction or use in any

form or by means whatsoever is prohibited without the written consent of IIUM. No

parts of this unpublished research may be reproduced, stored in a retrieval system, or

transmitted, in any form or by any means, electronics, mechanical, photocopying,

recording or otherwise without prior written permission of the copying holder.

Affirmed by Mohamad Ghazali B. Ameer Amsa

………………….... ………………….

Signature Date

vii

To my beloved parents, wife

and

all my supportive friends

viii

ACKNOWLEDGEMENTS

Alhamdulillah towards Allah (S.W.T), the Most Beneficent and the Most Merciful for

His blessing, Who has given me good health throughout this research period which

made it possible for me to finish this research in the expected time. My gratitude to

my supervisor, Professor Dr. Momoh Jimoh Eyiomika Salami for his guidance and

assistance along this research period regardless the time and day even during

weekend. I would like to express my thanks to my co-supervisor, Dr. Abiodun Musa

Aibinu for his advice and support at all times.

I am also thankful to all academic and non academic staffs, especially brother

Shahlan for providing the necessary electronic components and fabrication material to

complete the prototype development in this research.

I would also like to acknowledge the contribution of all my friends in

Kulliyyah of Engineering for provide me assistant, support motivation and ideas

throughout the study period. Last but not least, unquantifiable thanks to my family for

their patient and moral support during the study.

ix

TABLE OF CONTENTS

Abstract ......................................................................................................................... ii

Abstract in Arabic ........................................................................................................ iii

Approval Page .............................................................................................................. iv

Declaration Page ........................................................................................................... v

Copyright Page ............................................................................................................. vi

Dedication ................................................................................................................... vii

Acknowledgement ..................................................................................................... viii

List of Tables ............................................................................................................... xi

List of Figures ............................................................................................................ xiii

List of Symbols ......................................................................................................... xvii

List of Abbreviations ................................................................................................. xxi

CHAPTER ONE: INTRODUCTION ....................................................................... 1

1.1 Background ................................................................................................. 1

1.2 Problem Statement and its Significance ...................................................... 4

1.3 Research Objectives..................................................................................... 5

1.4 Research Methodology ................................................................................ 6

1.5 Research Scope ............................................................................................ 9

1.6 Dissertation Outline ..................................................................................... 9

CHAPTER TWO: LITERATURE REVIEW ........................................................ 11

2.1 Introduction................................................................................................ 12

2.2 Characteristic of Existing Coins ................................................................ 16

2.3 Coin Discriminator System ....................................................................... 23

2.4 Eddy Current Theory ................................................................................. 29

2.5 Electromagnetic Sensor ............................................................................. 31

2.6 Oscillator Circuits ......................................................................... ……… 32

2.7 Application Genetic Algorithm and Artificial Neural Network in

circuits design ............................................................................................ 40

2.8 Forecasting Techniques ................................................................ ……… 43

2.8.1 Forecasting Models ......................................................................... 46

2.8.1.1 Linear Prediction ................................................................. 46

2.8.1.2 Autoregressive Integrated Moving Average ....................... 47

2.8.1.3 Artificial Intelligence Models .............................................. 48

2.8.2 Performance Metrics for Forecasting Techniques .......................... 51

2.9 Summary .................................................................................................... 54

CHAPTER THREE: METHODOLOGY ............................................................... 56

3.1 Introduction................................................................................................ 56

3.2 Proposed System Description .................................................................... 57

3.3 Eddy Current Sensor ................................................................................. 58

3.3.1 Colpitts Oscillator Modelling .......................................................... 59

3.3.2 Resistors Selection and Optimization ............................................. 63

3.3.3 Capacitor Selection ......................................................................... 68

x

3.4 Eddy Current Test Parameters Selection ................................................... 70

3.4.1 Coil Design ..................................................................................... 71

3.4.2 Test Frequency Experimental Analysis .......................................... 72

3.5 Diameter Measurement Sensor .................................................................. 74

3.6 Coin Detection Sensor ............................................................................... 76

3.7 Coin Analysis Prototype Development ..................................................... 77

3.8 Data Acquisition and Controller Device.................................................... 79

3.9 Prediction System Development................................................................ 80

3.10 Summary .................................................................................................. 84

CHAPTER FOUR: DEVELOPMENT OF DINAR AND DIRHAM COINS

DETECTION AND PREDICTION SYSTEM ...................................................... 86

4.1 Introduction................................................................................................ 86

4.2 Coin Detection System Development and Performance Evaluation ......... 86

4.2.1 Colpitts Oscillator Development ..................................................... 87

4.2.1.1 Colpitts Oscillator Parameters Selection .............................. 87

4.2.1.2 Coil Design ........................................................................... 90

4.2.1.3 Test Frequency Optimization ............................................. 95

4.2.1.4 Signal Conditioning Circuit Development ........................... 96

4.2.1.5 Eddy Current Sensor Performance Evaluation ..................... 99

4.2.2 Diameter Measurement Sensor Performance Analysis ................. 100

4.2.3 Infrared Optical Sensor Adjustment and Performance

Evaluation ...................................................................................... 102

4.3 Price Prediction model Development and Performance Evaluation........ 106

4.4 System Integration and Evaluation .......................................................... 110

4.5 Summary .................................................................................................. 115

CHAPTER FIVE: CONCLUSION AND RECOMMENDATION .................... 117

5.1 Conclusion ............................................................................................... 117

5.2 Recommendation ..................................................................................... 118

BIBLIOGRAPHY ................................................................................................... 120

PUBLICATIONS .................................................................................................... 128

APPENDIX A: OSCILLATOR RESPONSE SIMULATION RESULT ................. 129

APPENDIX B: COLPITTS OSCILLATOR OPTIMIZATE RESISTORS DATA . 139

APPENDIX C: PROGRAMMING CODE FOR MICROCONTROLLER ............. 148

APPENDIX D: DINAR AND DIRHAM DAILY PRICE DATA ........................... 153

APPENDIX E: COIL SPECIFICATION ................................................................. 161

xi

LIST OF TABLES

Table No. Page No.

1.1 Physical characteristic and material content of Kelantan

Dinar and Dirham

3

2.1 Characteristic of various coins

14

2.2 List of merits and demerits of existing material content

detection techniques

22

2.3 Advantages and disadvantages among sine wave of

oscillators

35

2.4 Comparison between various Artificial Intelligence

Techniques

50

2.5 Comparison study between different forecasting techniques

53

4.1 Transient Response Time for various combinations of R1

and R2 resistors

88

4.2 Formatted data for ANN input

89

4.3 Properties of coils used for diameter effects analysis

experiment

91

4.4 Various coil diameters analysis experiments

92

4.5 Frequency analysis experiment results

95

4.6 Analysis of oscillation frequency shift for various coins 100

4.7 Travel time of sound wave echo for various diameters of

coin

102

4.8 IR sensor detection sensitivity evaluation

104

4.9 Coefficients obtained for ANN based AR Dinar price

prediction model

107

4.10 Coefficients obtained for ANN based AR Dirham price

prediction model

107

xii

Table No. Page No.

4.11 AR using Yule Walker model coefficients for Dinar price

prediction model

108

4.12 AR using Yule Walker model coefficients for Dirham

prediction model

108

4.13 Performance analysis of AR based ANN model and AR

using Yule Walker model

110

4.14 Performance evaluation results for overall system

113

xiii

LIST OF FIGURES

Figure No. Page No.

1.1 Kelantan Dinar coins 2

1.2 Kelantan Dirham coins

2

1.3 Research methodology flow chart

6

2.1 Indian coins

12

2.2 Induction balance metal discriminator configuration

19

2.3 Inductive Images for composition material tests

20

2.4 Acoustic Analysis Equipment 25

2.5 Discriminator base on four coils configuration

26

2.6 Eddy current illustration

28

2.7 Effect of impurity content on copper material

31

2.8 Electromagnetic induction circuit 31

2.9 Basic feedback system block diagram 32

2.10 Generalized version of LC oscillator

35

2.11 Colpitts Oscillator circuit

36

2.12 Hartley Oscillator circuit 37

2.13 Clapp oscillator 37

2.14 Wien Bridge oscillator 38

2.15 Phase shift oscillator 39

2.16 Colpitts crystal oscillator 39

2.17 Clapp crystal oscillator 40

2.18 Multi Layer Network (MLN) structure 40

xiv

2.19 Nine bits binary string of chromosome 42

2.20 Flow chart of GA process 42

2.21 Block diagram of a forecasting system 45

2.22 „Best fit line‟ across historical data of gold price data 47

3.1 Coin analysis system 58

3.2 Coin prediction system

58

3.3 Common base Colpitts oscillator

59

3.4 Small signal model for BJT

60

3.5 Equivalent circuit of Colpitts oscillator

60

3.6 Small-signal model of proposed Colpitts oscillator 61

3.7 Operation principle of Colpitts oscillator 62

3.8 Thevenin equivalent of oscillator

63

3.9 BJT Large signal analysis

64

3.10 Large-signal model of oscillator

64

3.11 Chromosome combination of R1 and R2 bits length

67

3.12 Block diagram of forward phase of backpropagation

algorithm

68

3.13 Thermal characteristic for various classes of capacitors

70

3.14 Test coins used for eddy current test parameters selection

experiment

71

3.15 Methodology used for coil design and test frequency

selection

74

3.16 Ultrasonic sensor

74

3.17 L- shaped‟ slider

75

3.18 Diameter measurement methodology

76

3.19 Infrared sensor switch 77

xv

3.20 Coin analysis platform 78

3.21 Base block design 78

3.22 Coin analysis system prototype 79

3.23 Flow chart of coin detection algorithm 80

3.24 AR model representation 81

3.25 Time series of normalized data 82

3.26 Inputs price for prediction model

82

3.27 ANN-based AR model block diagram 83

4.1 Simulation of Colpitts oscillator waveform

96

4.2 Coil used for experiment 1 91

4.3 Coil used for experiment 2 91

4.4 Coil used for experiment 3 92

4.5 Former for winding the coil

94

4.6 Colpitts oscillator design 97

4.7 Output signal simulation

97

4.8 Oscillator and signal conditioning circuit

98

4.9 The oscillator output (green line) and conditioned output

(red line)

98

4.10 Output signal obtained from eddy current sensor

99

4.11 The procedures to insert the test coin for diameter analysis 101

4.12 Adjustable Screw for varying the detection range

103

4.13 Coin analysis platform without coin 104

4.14 One Dirham coin inside coin analysis platform 104

4.15 20 Dirham coin inserted inside coin analysis platform 105

4.16 Slider located under IR sensor 105

4.17 DnD coin price 106

4.18 Actual and predicted Dinar price (in normalized form) for

31 days

108

xvi

4.19 Predicted Dirham price for July 2012 109

4.20 Flow chart of coin detection and prediction system 111

4.21 Coins detection and price prediction system setup 111

4.22 Coin detection and price prediction system architecture 112

4.23 Output for one Dirham test coin

113

4.24 Output for two Dirham test coin

113

4.25 Output for five Dirham test coin

113

4.26 Output for ten Dirham test coin

114

4.27 Output for 20 Dirham test coin

114

4.28 Output for one Rupee test coin

114

4.29 Output for 10 Yen test coin

114

4.30 Output for 500 Yen test coin

115

4.31 Output for 50 Sen test coin

115

xvii

LIST OF SYMBOLS

𝛼 Adaptive coefficient of output layer activation function

𝑎𝑘 kth

coefficient of Autoregressive model

𝐴𝑃 Actual price

𝛽j adaptive coefficient of jth

hidden neuron activation

function

𝐶 Capacitance

𝑐 Speed of sound

𝐷1 Diameter of test specimen

𝐷2 Diameter of the coil

𝐸 Prediction error

𝑓𝑒 Instantaneous frequency

𝑓𝑡 Initial test frequency

𝑕𝐹𝐸 Current gain of transistor

𝐼𝐵 Bias current

𝐼𝑐 Collector current

𝐿 Inductance

𝜂 Fill factor ratio

𝑃𝑃 Predicted price

𝑅𝐸 Emitter resistance

𝑅𝐸 Relative error

𝑆 Relative distance

𝑉𝐵𝐸 Base emitter voltage drop

xviii

𝑉𝑘 kth

of chromosome

𝑉𝑇𝐻 Thevenin equivalent voltage

𝒘 Synaptic weight

𝑥 Input data

𝑋𝑛𝑒𝑤 Normalized data

𝑦(𝑛)

Next day price

𝑍 Impedance

xix

ABBREVIATIONS

AC Alternating Current

AI Artificial Intelligence

ANFIS Adaptive Neuro-Fuzzy Inference System

ANN Artificial Neural Network

ANN-Q Artificial Neural Networks- Quantitative

AR Autoregressive

ARIMA Auto- Regressive Integrated Moving Average

ARMA Auto- Regressive Moving Average

BP Back Propagation

CIC Complex Induced Current

DC Direct Current

DnD Dinar and Dirham

ELM Extreme Learning Machine

EMI Electromagnetic Induction

ERN Elman neural network

GA Genetic Algorithm

IACS International Annealed Copper Standard

LIHaS Linearly Integrated Hall sensor array

LM Levenberg-Marquardt

LP Linear Prediction

MA Moving Average

MAE Mean Absolute Error

xx

MAPE Mean Absolute Percentage Error

MCP Market Clearing Price

MCP Market Clearing Price

MFL Magnetic Flux Leakage

MLN Multi Layer Network

MSE Mean Square Error

NDT Non Destructive Techniques

NPO Negative Positive Zero

PCB Printed Circuit Board

PSO Particle Swarm Optimization

RBF Radial Basis Function

RBN Radial Basis Network

RMS Root Mean Square

RMSE Root Mean Square Error

SARIMA Seasonal Autoregressive Integrated Moving Average

SCG Scaled Conjugate Gradient

SQUID Sensors Based on Quantum Effect

SVM Support Vector Machine

SWG Standard Wire Gauge

XRF X-ray fluorescent

1

CHAPTER ONE

INTRODUCTION

1.1 BACKGROUND

Money plays an important role in the economy of any country since it serves as a

medium of exchange in daily business and human transaction. Traditionally, coins

have been used as money for trading purposes. A great number of materials such as

gold, silver and other materials have been used practically and experimentally in the

production of coins for circulation (Clayton, n. d.). During earlier civilizations, even

before the arrival of Islam and Christianity, gold and silver were used for trade and

exchange of commodities. After the advent of Islam, Prophet Muhammad S.A.W and

companions maintained the usage of gold and silver as medium of exchange. The first

standardized Islamic Dirham was introduced during the Khalifate of Uthman era. The

Islamic Dinar content of 22k gold (917) is equivalent to 4.25 grams. Meanwhile,

standardized Islamic Dirham content of pure silver is equivalent to 3.0 grams

(“Islamic Dinar”, n. d.). Relatively, Dirham has a lower value compared to Dinar.

Dinar and Dirham (DnD) have been used throughout the Islamic caliphate ruling time

as an Islamic official currency among the Muslims.

In 2003, the former Malaysian Prime Minister, Tun Dr Muhammad Mahathir

expressed the idea to re-introduce the Gold and Silver Coins system (Vadillo, 2002).

In addition, there are many people such as Vadillo (Vadillo, n. d.), Hossein (Hossein,

n. d), Meera (Meera, 2002), Sanusi (Sanusi, 2002) and Hamid (Hamid and Nordin,

2002) actively rising this shariah Islamic monetary system based on DnD coinage

idea. In Malaysia, the state of Kelantan re-introduced the DnD coins in ten

2

denominations on August 12th

2010 (Malaysia‟s Kelantan state, n. d.). Kelantan‟s

Gold coins consist of half, one, two, five and eight Dinar and Kelantan‟s Dirham

comprising of one, two, five, ten and twenty Dirhams denominations. Figure 1.1 and

Figure 1.2 show series of Kelantan state Dinar and Dirham coins minted by World

Islamic Mint (WIM). As they are still in the introductory phase, these bimetallic coins

are mainly used for payment of zakat, barter trading, dowry and other similar usage

before they can be used in a full fledge monetary system sometime in the future.

Figure 1.1: Kelantan Dirham coins (“Kelantan Golden”, n. d.)

Figure 1.2: Kelantan Dirham coins (Sulong, n. d.)

3

The physical characteristic and material content of all these coins are listed in the

Table 1.1

Table 1.1

Physical characteristic and material content of Kelantan Dinar and Dirham (“World

Islamic”, n. d.)

Denominations Weight(g) Diameter(mm) Material contents

Kelantan Dinar

0.5 Dinar 2.125 16

917 Gold 1 Dinar 4.25 21

2 Dinar 8.5 22

5 Dinar 21.25 25

8 Dinar 34 32

Kelantan Dirham

1Dirham 2.975 22

999 silver 2 Dirham 5.98 25

10 Dirham 29.83 41

20 Dirham 59.5 50

Instability of fiat money, inflection and increasing trend of a gold and silver

price has increased the awareness among people to invest in gold and silver in order to

store their money against non abating inflation (Billah, n. d.). One of the major

challenges to use Dinar and Dirham is that counterfeit coins can be made easily by

using modern technologies which may lead to suspicion in the transaction of Dinar

and Dirham. Even though human eyes can easily recognize the pattern and size of the

coin, the major challenge is to know the content of materials inside the counterfeit

coin. There are two basic techniques for coin testing comprising of destructive and

non destructive techniques. Destructive technique is a method to test or examine the

coin by disturbing it physical property such as scratch the coin to test the purity of

gold inside the coin. On the other hand, nondestructive testing (NDT) is an

examination or test performed on coin without changing or altering that object in

4

anyway. On the other aspect, even though gold and silver prices are more stable than

fiat money, gold prices also fluctuate based on current situations of demand and

supply which subsequently causes changes of its daily price. Thus, investors need to

have general prediction knowledge to know the suitable time to trade their gold and

silver coins. Generally, forecasting activity can be divided into three relevant classes,

namely short term, medium term and long term forecasting. Short term forecast

activity concentrates on predicting unknown values of price for a short period of time.

These periods include few minutes, hours, or days. Monthly forecast activity falls into

medium term while long term forecast activity may cover period of one to a few years.

Short term forecasting is informative for profit maximization, while medium term

price forecasting is useful for negotiations of bilateral contract between suppliers and

consumers. Long term forecasting is a valuable tool to make future investment

decision (Shafiee and Topal, 2002) Various prediction methods have been suggested

comprising of traditional method such as ARIMA and linear regressive technique and

modern methods such as the application of Artificial Neural Network and Genetic

Algorithm.

1.2 PROBLEM STATEMENT AND ITS SIGNIFICANCE

Many contemporary Islamic economists believe that dinar and dirham are a desirable

alternative of money viewed from social, economic, politic and religious perspectives

(Billah, n. d). However, despite various efforts for re-introducing Dinar and Dirham

into practical application, critical and fatal blow have already been noticed in terms of

coin counterfeiting. For example, one of the local banks that provide Islamic pawn-

broking (Ar-Rahnu) service lost RM 75 million due to unconsciously purchasing fake

gold from several customers (Lim and Camoens, 2012). Consequently, the transaction