• Tiada Hasil Ditemukan

REFURBISHMENT AND UPGRADING THE DIFFERENT TYPES OF MOTOR USING RASPBERRY PI

N/A
N/A
Protected

Academic year: 2022

Share "REFURBISHMENT AND UPGRADING THE DIFFERENT TYPES OF MOTOR USING RASPBERRY PI "

Copied!
81
0
0

Tekspenuh

(1)

REFURBISHMENT AND UPGRADING THE DIFFERENT TYPES OF MOTOR USING RASPBERRY PI

By:

SALMIYAH BINTI SAGEMAN (Matrix No: 120814)

Supervisor:

Prof. Dr. Zahurin Samad

May 2017

This dissertation is submitted to Universiti Sains Malaysia

As partial fulfilment of the requirement to graduate with honors degree in BACHELOR OF ENGINEERING

(MANUFACTURING ENGINEERING WITH MANAGEMENT)

School of Mechanical Engineering Engineering Campus Universiti Sains Malaysia

(2)

i DECLARATION

This work has not previously been accepted in substance for any degree and is not being concurrently submitted in candidature for any degree.

Signed ……… (Salmiyah Binti Sageman) Date ………

STATEMENT 1

This thesis is the result of my own investigations, except where otherwise stated.

Other sources are acknowledged by giving explicit references.

Bibliography/references are appended.

Signed ……… (Salmiyah Binti Sageman) Date ………

STATEMENT 2

I hereby give consent for my thesis, if accepted, to be available for photocopying and for interlibrary loan, and for the title and summary to be made available outside organizations.

Signed ……… (Salmiyah Binti Sageman) Date ………

(3)

i ACKNOWLEDGEMENT

In the name of Allah, the Most Gracious and the Most Merciful.

Alhamdulillah, all praises to Allah for the strengths and His blessing in completing this thesis. Special appreciation goes to my supervisor, Prof. Dr. Zahurin Samad for his supervision and constant support. His invaluable help of constructive comments and suggestions throughout the experimental and thesis works have contributed to the success of this research.

I would like to express my appreciation to the Dean, School of Mechanical Engineering USM, Prof. Dr. Zainal Alimuddin Zainal Alaudin and also to the Academic Deputy Dean, School of Mechanical Engineering USM, Dr. Jamaluddin Abdullah for their support and help towards completing this thesis. My acknowledgement also goes to all the technicians and office staffs of School of Mechanical Engineering USM for their kind co-operations along my research journey.

Furthermore, my deepest gratitude goes to my beloved parents and also to my brothers and sisters for their endless love, prayers and encouragement. Last but not least, sincere thanks to all my friends especially to Noor Alwani Binti Muhamat and others for their kindness, moral support and ideas during my study. Thanks for the friendship and memories. Finally, to those who indirectly contributed in this research, your kindness means a lot to me. Thank you very much.

(4)

ii TABLE OF CONTENTS

DECLARATION...i

ACKNOWLEDGEMENT...ii

TABLE OF CONTENTS...iii

LIST OF TABLES...1

LIST OF FIGURES...2

LIST OF ABBREVIATIONS...5

ABSTRAK...6

ABSTRACT...7

CHAPTER 1 INTRODUCTION...8

1.1 Introduction...8

1.2 Problem Statement...10

1.3 Research Objectives...10

1.4 Project Scope...10

1.5 Thesis Outline...10

CHAPTER 2 LITERATURE REVIEW...12

2.1 Introduction...12

2.2 Mitsubishi EDM Machine Model M35J...12

2.3 Die Sinking EDM Machine...13

2.4 Denso Robot Arm...14

2.5 RC3-V6A Controller...14

2.6 OTIS-LG AC Servo Motor Drive...15

2.7 Brushless DC Motor...16

2.8 Raspberry Pi Microcontroller...17

2.9 Raspberry Pi Pin...18

(5)

iii

2.10 Existing Work...19

CHAPTER 3 METHODOLOGY...24

3.1 Introduction...24

3.2 Project Methodology Flow...24

3.3 Mitsubishi M35J CNC Sinker Type EDM Electrical Discharge Machine...25

3.4 Denso Robot Arm System Configuration...27

3.5 OTIS-LG AC Servo Drive...29

3.6 Brushless DC Motor System Configuration ...39

CHAPTER 4 RESULT AND DISCUSSION...46

4.1 Controlling DC Motor Without using Raspberry Pi Microcontroller…………46

4.2 Raspberry Pi Coding To Control Direction…....………46

4.3 Controlling The Speed of DC Motor using Internal Potentiometer…………...47

4.4 Raspberry Pi Coding To Control Speed……….48

4.5 Speed Output………..51

CHAPTER 5 CONCLUSION...59

5.1 Conclusion...59

5.2 Limitations...59

5.3 Future Work...60

REFERENCES...61 APPENDICES...63-76

(6)

1 LIST OF TABLES

Chapter 2

Table 2.1 Raspberry Pi Pin………...…18

Chapter 3 Table 3.1 The Recommended Parts Installed on Electric Panel………..….30

Table 3.2 CN1 Wiring and Signal……….…...35

Table 3.3 Input Contact Signal……….……....35

Table 3.4 Raspberry Pi Pin and CN1 Driver Connection……….…....36

Table 3.5 External Power Supply and Driver Connection………...38

Table 3.6 Raspberry Pi and Driver Connection………...42

Table 3.7 Raspberry Pi and Driver Connection………...44

Chapter 4 Table 4.1 Speed State Count for Data Collection 1……….51

Table 4.2 Speed State Count for Data Collection 2……….53

Table 4.3 Speed State Count for Data Collection 3……….54

Table 4.4 Speed State Count for Data Collection 4……….56

(7)

2 LIST OF FIGURES

Chapter 1

Figure 1.1 Types of Motors………8

Chapter 2 Figure 2.1 Mitsubishi EDM Machine Model M35J……….12

Figure 2.2 Basic Element in EDM Die Sinker……….14

Figure 2.3 The 4-axis Denso Robot Arm……….14

Figure 2.4 Hardware Overview of Controller………..15

Figure 2.5 The OTIS-LG Driver………..16

Figure 2.6 The OTIS-LG Servo Motor………16

Figure 2.7 Brushless DC Motor………...17

Figure 2.8 Basic Element of Raspberry Pi………...18

Figure 2.9 Raspberry Pi Pin Arrangement………...19

Chapter 3 Figure 3.1 Basic Element of Mitsubishi EDM Machine Model M35J ……….25

Figure 3.2 Block Diagram of EDM System with Raspberry Pi………...26

Figure 3.3 Robot System Configuration………..27

Figure 3.4 Block Diagram of Controller...28

Figure 3.5 OTIS-LG Servo Drive………..……….29

Figure 3.6 OTIS-LG Servo Motor………..29

Figure 3.7 Main Circuit Terminal Board………30

Figure 3.8 Signal and Wiring Connection of Driver………..31

Figure 3.9 Pin Array of CN1………..32

Figure 3.10 Input Signal………...36

(8)

3

Figure 3.11 The Raspberry Pi Pin and CN1 Driver Circuit Connection……….37

Figure 3.12 External Power Supply and CN1 Driver Circuit Connection………..38

Figure 3.13 Overall Circuit Connection………..38

Figure 3.14 The Setup of Experiment……….39

Figure 3.15 The System Configuration of Driver and Motor……….40

Figure 3.16 The Driver Connection Diagram……….40

Figure 3.17 The Input Signal Circuit………..41

Figure 3.18 The Input Circuit Connection………..41

Figure 3.19 The Circuit Connection of Raspberry Pi and Motor Driver………42

Figure 3.20 Setup of Experiment………43

Figure 3.21 The Output Signal Connection ………...43

Figure 3.22 The Circuit Connection of Raspberry Pi and Motor Driver………45

Figure 3.23 Setup of Experiment………45

Chapter 4 Figure 4.1 Raspberry Pi Coding To Control Direction………...46

Figure 4.2 Speed Control by Internal Potentiometer………..47

Figure 4.3 Raspberry Pi Coding To Control Speed………49

Figure 4.4 motor.csv File………50

Figure 4.5 File of The Coordinate in Excel………50

Figure 4.6 Data Collection 1………..51

Figure 4.7 Pulse Output for Motor=1, Direction=0, Speed=0………...…52

Figure 4.8 Data Collection 2………..52

Figure 4.9 Pulse Output for Motor=1, Direction=0, Speed=1………...53

(9)

4

Figure 4.10 Data Collection 3………..54

Figure 4.11 Pulse Output for Motor=1, Direction=1, Speed=0………...……55

Figure 4.12 Data Collection 4………..55

Figure 4.13 Pulse Output for Motor=1, Direction=1, Speed=1………...56

Figure 4.14 Data Collection 5………..58

(10)

5 ABBREVIATION

AC Alternating Current DC Direct Current

EDM Electrical Discharge Machine

SCARA Selective Compliance Assembly Robot Arm UK United Kingdom

IDLE Integrated Development and Learning Environment REPL Real, Eval, Print, Loop

GUI Graphical User Interface 2D Two Dimension

UART Universal Asynchronous Receiver/Transmitter SPI Serial Peripheral Interface

I2C Inter-Integrated Circuit GPIO General Purpose Input/Output PC Personal Computer

OS Operating System

RAM Random Access Memory BLDC Brushless Direct Current LED Light Emitting Diode IC Integrated Circuit CPU Central Processing Unit PWM Pulse Width Modulation CW Clockwise

CCW Counter-clockwise

(11)

6 ABSTRAK

Projek ini adalah untuk menaiktaraf beberapa jenis motor menggunakan Raspberry Pi. Motor yang digunakan terdiri daripada DC servo motor EDM mesin, AC servo Denso robot, AC servo motor OTIS-LG dan DC motor. Jenis arus yang digunakan oleh kesemua motor ini adalah arus terus (DC) dan arus ulang-alik (AC). Di Pusat Pengajian Kejuruteraan Mekanikal USM, terdapat satu EDM mesin (Mitsubishi EDM model M35J 1993) yang telah rosak dan masalah yang dikenalpasti adalah Z-axis tidak boleh berfungsi dengan baik. Walaupun mesin telah rosak tetapi bahagian-bahagian mekanikal sistem mesin boleh digunakan untuk menaik taraf keadaan sistem motor tersebut. Tetapi, setelah kajian dibuat mesin ini tidak boleh dinaik taraf sama sekali kerana kesemua bahagian litarnya telah terputus dan mesin ini tidak mempunyai manual yang lengkap. Seterusnya, kajian diteruskan menggunakan Denso robot arm tetapi tidak dapat diteruskan kerana mempunyai masalah yang sama iaitu tidak mempunyai manual penggunaan sistem motor yang lengkap. Kemudian, kajian diteruskan menggunakan OTIS-LG servo drive FDA 5000C Series dengan menggunakan bahagian motor dan pemandu. Terdapat beberapa modifikasi dilakukan pada bahagian pemandu mengikut kesesuaian eksperimen yang dijalankan untuk menggerakkan motor. Modifikasi pada litar juga dilakukan untuk menggerakkan motor dengan mengawal arah dan kelajuan putaran. Satu program Raspberry Pi digunakan dalam kajian ini. Setelah eksperimen dilakukan, pemandu yang diubahsuai tidak dapat menggerakkan motor mengikut arah dan kelajuan yang ditetapkan. Seterusnya, kajian digantikan dengan menggunakan DC motor. Satu program Raspberry Pi juga digunakan dalam kajian ini untuk mengawal arah dan kelajuan putaran. DC motor akan mengeluarkan nadi pada setiap putaran dan setiap nadi yang dikeluarkan akan dikira.

(12)

7 ABSTRACT

This project is to upgrade some type of motor to use Raspberry Pi. Some motors used are EDM machine DC servo motor, AC servo Denso robot, AC servo drive OTIS- LG and DC motor. Type of current used by the motor is a direct current (DC) and alternating current (AC). At School of Mechanical Engineering USM, there is an EDM machine (EDM Mitsubishi model M35J 1993) that have been damaged and the problem identified is the Z-axis cannot function properly. Although the machine was damaged but some of the mechanical parts of the machine can be used to upgrade the situation.

But, after an observation is made, this machine cannot be upgraded because all the circuit has been disconnected and the machine does not have a complete manual. Next, the study continued using Denso robot arm but could not proceed because it has the same problem that does not have full use of the manual. Then, the study continued using OTIS-LG FDA 5000C Series servo drive with the main part are motor and driver. There are some modifications carried out on the driver's that suit the experiment conducted to drive the motor. Modifications were also made to the circuit to drive the motor by controlling the direction and speed of rotation. The Raspberry Pi program used in this study. After the experiments carried out, a modified driver cannot move to the intended direction and the speed of the motor cannot be controlled. Next, the research was replaced by a DC motor. The Raspberry Pi program is used in this study to control the direction and speed of rotation. DC motor will produce a pulse on each round and each pulse issued will be calculated.

(13)

8 CHAPTER 1

INTRODUCTION 1.1 Introduction

The motor or an electrical motor is a device that has brought about one of the biggest advancements in the fields of engineering and technology ever since the invention of electricity. A motor is nothing without an electro-mechanical device that converts electrical energy to mechanical energy. There are different types of motor have been developed for different specific purposes that produces rotational force. The very basic principal of functioning of an electrical motor lies on the fact that force is experienced in the direction perpendicular to magnetic field and the current, when field and current are made to interact with each other (Billd, 2016). The primary classification of motor or types of motor can be figured as shown below,

Figure 1.1 Types of Motors

AC motor is an electric motor driven by an alternating current and highly flexible in many features including speed control. Some of the key advantages are low power demand on start, controlled acceleration, adjustable operational speed, controlled starting current, adjustable torque limit and reduced power line disturbances. Types of AC motor include synchronous that the rotation of the rotor is synchronized with the frequency of the supply current and the speed remains constant under varying loads, so is ideal for driving equipment at a constant speed and are used in high precision positioning devices like robots, instrumentation, machines and process control.

Induction (asynchronous)uses electromagnetic induction from the magnetic field of the

(14)

9 stator winding to produce an electric current in the rotor and hence torque. These are the most common type of AC motor and important in industry due to their load capacity with single-phase induction motors being used mainly for smaller loads, like used in household appliances whereas three-phase induction motors are used more in industrial applications including compressors, pumps, conveyor systems and lifting gear.

DC motors were the first type of motor widely used and the systems (motors and drive) initial costs tend to be typically less than AC systems for low power units, but with higher power the overall maintenance costs increase and would need to be taken into consideration. The DC motors speed can be controlled by varying the supply voltage and are available in a wide range of voltages, however the most popular type are 12 and 24V, with some of the advantages being easy installation, speed control over a wide range, high starting torque and linear speed-torque curve. Brushed motor are typically used in cost-sensitive applications, where the control system is relatively simple, such as in consumer applications and more basic industrial equipment, these type of motors can be broken down as series motor, shunt motor, compound motor and permanent magnet. Brushless motors alleviate some of the issues associated with the more common brushed motors that has short life span for high use applications (Kenneth Sleigh, 2011).

A servomotor is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity and acceleration. It is typically paired with some type of encoder to provide positioning and speed feedback and some error correcting device which actuates the supply signal. A servo drive is a special electronic amplifier used to power electric servomechanisms. A servo drive monitors the feedback signal from the servomechanism and continually adjusts for deviation from expected behaviour. There are mainly two types of servomotors that are AC servomotor and DC servomotor. AC servomotors are generally preferred for low-power use and for high- power use DC servomotors are preferred because they operate more efficiently than comparable to AC servomotors (Lin Yao and Zhong Chong Quan, 2015).

(15)

10 1.2 Problem Statement

Industrial application used motors because the speed-torque relationship can be varied with the direction of rotation. The motors must be operate in perfect condition to avoid non-smoothly movement. Some motor also need to use any addition controller to control the performance of rotation. By using Raspberry Pi, the condition of motors such as rotation and speed can be control. So, the motors can operate in stable condition and the motion of motors can run very smoothly.

1.3 Research Objectives

The objectives of this project are as follows:

 To design a circuit to control the direction and speed of the motor.

 To build programming coding in Python in order to drive the circuit using Raspberry Pi.

1.4 Project Scope

The scopes of work for this project are as follows. First, identify the requirement and significance of the research. Second, study the manual operation of the motors that involved. Then, study about the Raspberry Pi microcontroller and Python language.

Next, design a circuit to control the direction and speed of the motor. Lastly, build programming coding in Python in order to drive the circuit using Raspberry Pi.

1.5 Thesis Outline

This thesis consist of five chapters. The first chapter is the introduction to the project. All the introductory part such as problem statement (Section 1.2), research objectives (Section 1.3) and project scope (Section 1.4) are explained.

In the second chapter, the literature review, term that related to the topic in this project are explained. The term such as types of motor used, operation of the motors and Raspberry Pi microcontroller is mentioned in Section 2.2 until Section 2.9. Some of existing works by researchers and students are addressed in Section 2.10.

Methodology is in third chapter. In this chapter, the introduction and project methodology flow explained in Section 3.1 and Section 3.2. The required hardware and software component for this project is explained in Section 3.3 until Section 3.6.

(16)

11 The result and discussion are explained in the fourth chapter. The final chapter of this thesis is the conclusion where a brief summary of this project on the objective and successfulness of this project is discussed. The limitations of the system made in this project are mentioned in Section 5.2. Some ideas of future work that may help to improve this project are described in Section 5.3.

(17)

12 CHAPTER 2

LITERATURE REVIEW 2.1 Introduction

In this chapter, terms that related to the topic in this project are explained. The term such as types of the motor used, operation of the motors and Raspberry Pi micro- controller is mentioned in Section 2.2 until Section 2.9. Some of existing works by researchers and students are addressed in Section 2.10.

2.2 Mitsubishi EDM Machine Model M35J

Mitsubishi EDM's represent the ultimate in their field and provide a full range of functions and capabilities for the next generation of machining facilities. Mitsubishi power-supply waveform slope-control (patented worldwide) offers machining with ultra-low electrode wear and high-precision, high-rigidity mechanisms to make operation easy. A wide range of functions respond in full measure to the need for automation and unattended operation (Henry G. Dash, 2000).

Figure 2.1 Mitsubishi EDM Machine Model M35J 2.3 Die-sinking EDM machine

Die-sinking or sinker EDM have of an electrode and workpiece submerged in an insulating liquid or dielectric fluids. The electrode and workpiece are connected to a suitable power generator. The power generator generates an electrical potential

(18)

13 between the two parts. When the electrode near the workpiece, dielectric breakdown occurs in the fluid produced a plasma channel and a small spark jumps.

When the current is switched on, an electric tension is produced between the two metal parts. If the two parts are carried together to within a fraction of an inch, the electrical tension is discharged and a spark jumps across. Where it attacks, the metal is heated up so that it melts. These sparks usually strike one at a time because different locations in the inter-electrode space have the different electrical characteristics which would enable a spark to occur simultaneously in all such places. These sparks happen in huge numbers at seemingly random places between the electrode and the workpiece.

As the base metal is eroded and the spark gap subsequently increased, the electrode is lowered automatically by the machine so that the process can continue without any disturbances (F. Scalari & Vignale, 1982).

The EDM consists of following major parts that are dielectric fluid, power supply, movable electrode, working tank with work holding device, x-y table accommodating the working table, the tool holder and the servo system to feed the tool.

Dielectric reservoirs and pump are used to circulate the EDM oil for every run of the system and also used to filter the EDM oil. The power supply control the amount of energy consumed. First, it has a time control function which controls the length of time that current flows during each pulse called “on time.” Then it is control the amount of current allowed to flow during each pulse. These pulses are of very short duration and are measured in microseconds. There is a handy rule of thumb to determine the amount of current a particular size of electrode should use for an efficient removal rate.

Conversely, too heavy a current load can damage the workpiece of electrode. The control unit is control the all function of the machining for duty cycle, putting the values and maintain the workpiece of the tool gap.

All the EDM oil kept in the working tank is used to the supply the fluid during the process of machining. x-y table accommodating the working table are used to the move of the workpiece from X and Y direction. The tool holder hold the tool with the process of machining. The servo control unit is provided to maintain the pre-determined gap. It senses the gap voltage and compares it with the present value and the different in voltage is then used to control the movement of servo motor to adjust the gap (Koji Akamatsu & Atsushi Taneda, 1997).

(19)

14 Figure 2.2 Basic Element in EDM Die Sinker

2.4 Denso Robot Arm

The most common manufacturing robot is the robotic arm. A typical robotic arm is made up of seven metal segments, joined by six joints. The computer controls the robot by rotating individual step motors connected to each joint (some larger arms use hydraulics or pneumatics). An industrial robot with six joints closely resembles a human arm. It has the equivalent of a shoulder, an elbow and a wrist. Typically, the shoulder is mounted to a stationary base structure rather than to a movable body. This type of robot has six degrees of freedom, meaning it can pivot in six different ways.

The robotic arm's job is to move an end effector from place to place. For Denso Robot Arm, there have four-axis robot arms, SCARA and 4-axis articulated arm robots.

Figure 2.3 The 4-axis Denso Robot Arm 2.5 RC3-V6A Controller

This controller is used as the driver to move the axis of the Denso robot arm.

The controller is the "brain" of the industrial robotic arm and allows the parts of the

(20)

15 robot to operate together. It works as a computer and allows the robot to also be connected to other systems. The robotic arm controller runs a set of instructions written in code called a program. The program is inputted with a teach pendant. Many of today's industrial robot arms use an interface that resembles or is built on the Windows operating system.

Figure 2.4 Hardware Overview of Controller 2.6 OTIS-LG Ac Servo Motor Drive

A servo drive is a special electronic amplifier used to power electric servomechanisms. A servo drive monitors the feedback signal from the servomechanism and continually adjusts for deviation from expected behaviour. A servo drive receives a command signal from a control system, amplifies the signal and transmits electric current to a servo motor in order to produce motion proportional to the command signal. Typically, the command signal represents a desired velocity, but can also represent a desired torque or position. The servo drive then compares the actual motor status with the commanded motor status. It then alters the

(21)

16 voltage frequency or pulse width to the motor so as to correct for any deviation from the commanded status (Rana M Shakeel, 2004).

Figure 2.5 The OTIS-LG Driver Figure 2.6 The OTIS-LG Servo Motor 2.7 Brushless DC Motor

The brushless DC motor is the ideal choice for applications that require high reliability, high efficiency and high power-to-volume ratio. The motor is considered to be a high performance motor that is capable of providing large amounts of torque over a vast speed range. The motors are a derivative of the most commonly used DC motor, the brushed DC motor, and they share the same torque and speed performance curve characteristics.

Commutation is the act of changing the motor phase currents at the appropriate times to produce rotational torque. In a brush DC motor, the motor assembly contains a physical commutator which is moved by means of actual brushes in order to move the rotor. With a brushless DC motor, electrical current powers a permanent magnet that causes the motor to move, so no physical commutator is necessary (Jian Zhao, Yangwei Yu, July 2011).

(22)

17 Figure 2.7 Brushless DC Motor

2.8 Raspberry Pi Microcontroller

Raspberry Pi is a credit card sized single board computer developed in the UK by the Raspberry Pi Foundation with the intention of promoting the teaching of basic computer science. The Raspberry Pi Foundation is a registered educational charity based in the UK. Foundation’s goal is to advance the education of adults and children particularly in the field of computers, computer science and related subjects. Raspberry Pi is powerful enough to process many of the same programs as PCs, from word processors to games. It small size makes Raspberry Pi ideal for programming connected home device.

The language to read the Raspberry Pi microcontroller is Python language. The Python programming language actually started as a scripting language for Linux.

Python programs are similar to shell scripts in the files contain a series of commands that the computer executes from top to bottom. Python is a very useful and versatile high level programming language with easy to read syntax that allows programmers to use fewer lines of code than would be possible in languages such as assembly, C or Java.

Python programs do not need to be compiled before running them. However, the Python interpreter need to be install on the computer to run them. The interpreter is the program that reads the Python file and executes the code. There are program like Py2exe or Pyinstaller that can package Python code into standalone executable programs. Like shell scripts, Python can automate tasks like batch renaming and moving large amounts of files. Using IDLE, Python’s REPL (read, eval, print, loop)

(23)

18 function can be used just like a command line. Programmers use Python to create things like web applications, desktop applications and utilities, special GUI (graphical user interface), small databases and 2D games (Basavaraj Sagar, 2014).

Figure 2.8 Basic Element of Raspberry Pi 2.9 Raspberry Pi Pin

The Raspberry Pi 3 Model B is used and the hardware interfaces for the Raspberry Pi is exposed through the 40-pin header on the board. The functionality includes 24 GPIO pins, one serial UARTs, two SPI bus, one I2C bus, two 5V power pins, two 3.3V power pins and eight ground pins.

Pin Description Function

GPIO (General Purpose Input / Output)

Standard pins that can be used to turn devices on and off.

UART (Universal Asynchronous Receiver / Transmitter)

Serial pins that are used to communicate with other devices.

SPI (Serial Peripheral Interface Bus)

Pins that allow to connect and talk to hardware modules that support SPI protocol.

I2C (Inter-Integrated Circuit) Pins that allow to connect and talk to hardware modules that support I2C protocol.

Power These pull power directly from the Raspberry

Pi 3.

Ground Pins used to ground the devices.

Table 2.1 Raspberry Pi Pin Description

(24)

19 Figure 2.9 Raspberry Pi Pin Arrangement

2.10 Existing Work

2.10.1 Electrical Discharge Machine (EDM)

1) Digital Control of an Electro Discharge Machining (EDM) System

This work is done by Azli Yahya from Loughborough University as his PhD project (Azli 2005). The research presented in this thesis proposes a model of the complete Electro Discharge Machining (EDM) system and the design and implementation of a digital controller for the servomotor control and the gap voltage and current pulse power generator. The complete EDM system model consists of two sub models, namely an EDM process model and the servo system model. The EDM process model was developed using a dimensional analysis technique and the servo system model was developed using the differential equations of Newton's and Kirchhoff's laws. The complete EDM system model was used in a Matlab or Simulink simulation to investigate the EDM system model behaviour. The results of the simulation were used to aid in the design of the compensated EDM control system. The design and development of the digital EDM control system were performed mainly in software with minimal hardware. The control software was designed using the structure programming methodology that combines a flowchart and program structure diagrams for clear description of program code.

2) Controlling DC Motors Using Python with a Raspberry Pi

(25)

20 This work is done by Jason Barnett as his assignment project (Jason 2014).

The research is about to safely connect one or two motors to the Raspberry Pi with as few components as possible. Once the electronics are put together on the breadboard, it is easily to control the components using Python to make the motor spin and then some control is added to change the motor direction backwards. It will require a careful eye to catch any mistakes and a bit of courage especially when connected to the GPIO connectors. It may cause any damage to the Raspberry Pi and the components.

3) Laboratory Scaled Die Sinking EDM

This work is done by Trias Andromeda in his research project (Trias 2016). In this research, a die sinking EDM with motor DC control as an actuator to maintain the electrode movement will be implemented. In this design, a rotary encoder will be used to detect the oscillation occurred along machining process. A microcomputer based controller will be use.

Firstly, the workpiece has been properly installed and fit into tank filled by dielectric fluid connected to the negative terminal of power generator. The electrode is inserted and tighten into the ram and connected to the positive terminal of power generator. By sliding down the ram and electrode close to the workpiece, the DC motor is installed and driven by motor controller. This motor is moving in counter clockwise to come close to workpiece and in clockwise to come away from workpiece. This motor is also equipped by encoder as additional feedback signal which is useful to show the real position of gap mechanically without any distortion due to the present of debris or dielectric fluid flow. Through this encoder sensor, it can be known the oscillation occurred during machining process.

Then, the output signal from encoder is useful to control the moving state of DC motor. DSP based microcontroller will handle this condition. It will decide whether limitation is needed or not. When the encoder gave an indication that the gap is bigger or smaller than the desired setting then the control driver of DC motor will be given instruction to stop the movement further whether in clockwise or counter clockwise.

The maximum of deviation of the motor movement to the right or left, can be done through a human user interface settings.

In general, there are two modes of the EDM. Mode one is an EDM system without encoder. The control gap mechanism maintaining the gap only relies on Vg

(26)

21 (voltage drop between electrode and workpiece) as a feedback signal. The second mode, encoder equipped in DC motor as an additional feedback signal. As stated before, through this sensor, DSP based microcontroller can sense the deviation of DC motor movement (right or left). If the deviation is bigger than the setting value, DSP based microcontroller can force to bound the movement of DC motor. It means that the EDM can enhance the ability to keep the gap.

By using the proposed control mechanism, it is expected that the electrode will reach a certain position close to the workpiece in short time. This process will ensure discharge phenomena generated, EDM run smoothly and finally accelerate mass removal from the workpiece.

2.10.2 Denso Robot Arm

1) Pick and Place Robot (Robotic Arm)

This work is done by Khairul Afikh bin Roslan in his final year project (Afikh, 2009). This project is to design and develop a “Robotic Arm for Pick and Place Application” using PIC microcontroller. His project combines the knowledge of electronic and electrical. The objective of this project is to design and build a more compact, usable and cheaper pick and place robotic arm for educational purpose uses PIC microcontroller from Microchip Technology as the control system to control all the activities. Input devices such as Infrared sensors will send a signal to PIC, then PIC will make a response accordingly. The response normally involves turning on or off output signal to some of the devices such as servo motors and switches.

2) Real Time Image Processing based Robotic Arm Control Standalone System using Raspberry Pi

This work is done by P.Hemalatha, C.K.Hemantha Lakshmi and Dr.

S.A.K.Jilani for their research project (Hemalatha, Hemantha and Jilani, 2015). This paper proposes real time image processing based robotic arm control standalone system using Raspberry pi. In the present era we made a robot capable of surveillance and also with an alternate application in detecting and following a pre specified object. The detection and recognition has been done using open CV library. The whole code for object detection written in MATLAB. This all processing has been done on Raspberry Pi which works on Raspbian OS based on Debian which is Linux OS to program the

(27)

22 controlling of one arm robot using Raspberry Pi for the identification of objects and tracking object operations without any manual control. The total programming model is developed in MATLAB. Simulink support package for Raspberry Pi hardware. The program includes capturing the object image, processing, identifying the green object and controlling of robot arm by using Raspberry Pi.

2.10.3 OTIS-LG Ac Servo Motor Drive

1) Technology of Velocity Control for AC Servo Drive

This work is done by Lin Yao and Zhong Chong Quan in their research project (Yao and Zhong, 2015). In order to promote the response speed and anti- interference of the velocity loop in AC servo drive system a design for velocity loop of AC servo drive which has the velocity observer was proposed. Through modelling analysis, the closed velocity loop was divided into two parts which are the forward regulator and speed feedback controller. With the controllability and observability of the AC servo of state the method of velocity observer was used for the speed feedback controller design. Experimental results show that the proposed design method not only solves the problem that the anti-windup is hard to achieve for the conventional PI controller, but also weaken the influence on the accuracy of velocity control, caused by the speed detection method when the motor work at low speed. The design also extends the velocity regulating range, quickens dynamic responding time and enhances the controlling precision and robustness.

2) Speed Control of an Induction Motor using Raspberry Pi

The project is done by P. M. Palpankar, Shraddha Waghmare and B. Shikkewal for their research project (Palpankar,Shraddha and Shikkewal, 2015). The main objective of this project is to control the speed of induction motor at lower cost and efficient performance. The induction motor speed variation can be easily achieved for a short range by stator voltage control. The terminal voltage across the stator winding of the motor can be varied for obtaining the desired speed control by controlling the firing angle of the semiconductor power devices (TRIAC in our project). Raspberry Pi 2 (model B) plays an important in the project. Raspberry Pi has very small size and it is a low cost device. Raspberry Pi has a Quadcore broadcom BCM2836 900 MHz processor and 1GB RAM. It can perform the work like that of computer thus it can be

(28)

23 referred as minicomputer. Python language must be used for this and it uses Raspbian operating system based on Debian distribution of Linux.

2.10.4 Brushless DC Motor

1) Brushless DC Motor Speed Control using Microcontroller

This project is done by G.Santhosh Kumar and S.Arockia Edwin Xavier for their research project (Santhosh and Arockia, 2015). The hardware project is designed to control the speed of a BLDC motor using closed loop control technique. BLDC motor has various application used in industries like in drilling, lathes, spinning, electric bikes and many more. The speed control of the DC motors is very essential. This proposed system provides a very precise and effective speed control system. The user can enter the desired speed and the motor will run at that exact speed. The hardware for closed loop control of BLDC motor using microcontroller is designed by using the PWM technique. The speed of the BLDC motor was controlled and it was made to run at exactly entered speed.

2) Speed Control of BLDC Motor using PWM Technique

This work is done by R.M. Pindoriya, S. Rajendran and P.J. Chauhan for their research project (Pindoriya, Rajendran and Chauhan, 2014). Efficiency and reliability are the key features for the development of advanced motor drives. Residential and commercial appliances such as refrigerators and air conditioning systems use conventional motor drive technology. A brushless DC (BLDC) motor drive is characterized by higher efficiency, lower maintenance, and higher cost. Therefore, it is necessary to have a low-cost but effective BLDC motor controller. PWM has been widely used in power converter control. PWM control is the most power full technique that offer a simple method for controlling of analog system with processors digital output.

(29)

24 CHAPTER 3

METHODOLOGY 3.1 Introduction

This chapter will explain in detail the step to setup the experiment to connect the motor and driver to the Raspberry Pi. The overall project flow is described in detail in this section.

3.2 Project Methodology Flow

The first step of this project is to study about electrical discharge machine (Mitsubishi EDM Model M35J) system and the motor that are involved. The machine actually had already damaged but some of the mechanical parts of the machine can be used to upgrade the situation. The problem of the machine is the Z-axis cannot function properly. Thus, the X-axis and Y-axis can be used to continue the project. But, after the observation is made, this machine cannot be upgraded because all the circuit has been disconnected and the machine does not have a complete manual guide.

Next, for the second experiment, the project is continued by using the Denso robot arm. The parts such as the motor, driver and end effector is important to be studied. The details of every part is needed to do the experiment. But, after the observation is made, this experiment cannot be continued because the information details of every parts are difficult to search. In addition, the manual and technical guide cannot be found.

For the third experiment, the project is used the OTIS-LG AC servo drive FDA5000C Series. The main parts that is studied is the motor and driver. The driver is the crucial part and the circuit modification is made to connect with the Raspberry Pi microcontroller. The circuit is modified based on the operation of the driver to control the direction and speed of the motor. The programming coding in Python is built in order to drive the circuit using Raspberry Pi. But, after some modification is made, the motor cannot rotate and run the programming coding.

Then, the project is replaced with the DC motor. The specification of the motor is studied and some circuit modification is made. A circuit is design to control the direction and speed of the motor. The programming coding is built in Python in order to drive the circuit using Raspberry Pi.

(30)

25 Experiment 1: Refurbishment and upgrading the EDM machine using Raspberry Pi microcontroller

3.3 Mitsubishi M35J CNC Sinker Type EDM Electrical Discharge Machine The machine has DC servo motor, encoder, linear guide, limit switch, driver, power system and hydraulic pump as their main important parts. The machine also equipped with Mitsubishi C7 CNC Controller, G35B power supply, C-Axis, 8 position AEC (3R Mini), Mitsubishi Flexible Automated Programming (FAP), Mirror-Surface (GM) finishing circuit, Superfine-Finishing (SF) circuit, graphite machining adapter, Mitsubishi cooling tower and dielectric tank.

Figure 3.1 Basic Element of Mitsubishi EDM Machine Model M35J 3.3.1 Encoder

The encoder that equipped to the EDM machine has serial number TS 1400N 904 S/N A20972R are high performance and low cost. This encoder emphasize high reliability, high resolution and easy assembly. The encoder contain a lensed LED source, an integrated circuit with detectors and output circuitry and a code wheel which rotates between the emitter and detector IC.

(31)

26 3.3.2 DC Servo Motor Drive

The type of motor used is DC servo motor. The DC motor is installed and driven by motor controller. This motor is moving in counter clockwise to come close to workpiece and in clockwise to come away from workpiece. It is also equipped by encoder as additional feedback signal that useful to control the moving state of DC motor.

3.3.3 Block Diagram of EDM System

The controller that will be used is Raspberry Pi microcontroller and actuator is the driver of the motor. The process will be control by the DC servomotor that moving in counter clockwise and clockwise direction based on the instruction that will be given by the microcontroller. The controlled variable will produce output that are instructed to the system. The system also equipped by the encoder as the feedback signal that useful to control the moving state of DC servomotor.

Figure 3.2 Block Diagram of EDM System with Raspberry Pi

After an observation has been made, the experiment cannot be carried out because all the circuit connection has been disconnected and the machine does not have a complete manual.

(32)

27 Experiment 2: Refurbishment and upgrading the Denso robot arm using Raspberry Pi microcontroller

3.4 Robot System Configuration

The robot controller of Denso robot arm connect the CN1 connector to the personal computer and vision device. Then, the teach pendent and operating panel connected to the CN5 connector of the robot controller and CN7 connector to the power supply of 24V. The CN9 connector allow the user to control directly from the robot through the solenoid valves and relays. The input from the PLC such as the power supply, photoelectric switches, proximity switches and equipment operation panel directly connected through the CN8 connector. The output from the robot controller CN10 connector to the PLC. The 200V alternating current (AC) is transferred to the robot controller through CN11. The robot unit is connected through CN12 to the robot controller by the motor encoder cable.

Figure 3.3 Robot System Configuration

(33)

28 3.4.1 Block Diagram of Denso Robot Arm Controller

The main board of the controller have the memory, floppy disk drive, host CPU, servo circuit, servo CPU and encoder. The host CPU connected the CRT, RS232C and TP. Meanwhile, the servo circuit connected to the IPM board that

contain driver, transistor and sensor by the PWM signal and then directly connected to the AC servomotor and absolute encoder. The controller also has power supply board that connect the noise filter board about 200 to 230V DC, the power source for logic circuit, power source for analog circuit and power source for input or output circuits.

The input output board contain parallel port circuit, input circuit and output circuit.

Some controller have the Ethernet board, deviceNet board and µvision board.

Figure 3.4 Block Diagram of Controller

After an observation has been made, the experiment cannot be carried out because the machine does not have a complete manual about the circuit connection.

(34)

29 Experiment 3: Refurbishment and upgrading the OTIS-LG AC servo motor drive using Raspberry Pi

3.5 OTIS-LG AC Servo Drive

The OTIS-LG AC Servo Drive has serial number 1307001 533. The type of the drive is FDA-5010Y (ID:6). The source of current is alternating current (AC) with 200 to 230 voltage and the frequency is between 50 to 60 Hz. The output current is 7.0 A.

Figure 3.5 OTIS-LG Servo Drive 3.5.1 OTIS-LG AC Servo Motor

AC servomotor is AC motor that incorporate encoders are used with controllers for providing feedback and closed-loop control. These motors can be positioned to high accuracy, meaning that they can be controlled exactly as required for the application. AC servomotor provide a high level of precision.

Figure 3.6 OTIS-LG Servo Motor

(35)

30 3.5.2 Main Circuit Terminal Board Wiring at The Driver

Figure 3.7 Main Circuit Terminal Board Wiring method as follows:

1) The R, S and T terminals are used to connect main power supply of 3-phase AC 200-230V to the power circuit.

2) The regenerated resistance is connected between P and B terminals. The standard regenerated resistance (See Table 1) is a standard item.

3) The U, V and W phases of the servo motor to the U, V and W terminals.

4) The terminal is grounded and also connect the servo earth cable to this terminal.

AC Servo drive system FDA5000C

Wire thickness AWG#16 (1.25mm2)

Drive system side press terminal KET GP110012

Switch GMC-12(13A) or equivalent

Breaker ABS 33b (5A)

Noise filter NFS 305 or NFS 310

Standard regenerated resistance (for P and B terminals)

50W 50Ω

Table 3.1 The Recommended Parts Installed on Electric Panel

(36)

31 3.5.3 Wiring and Signal of Driver Connection (CN1)

The CN1 input consist of the power supply, position command selection, operation start command, servo enable, CW jog, CCW jog, origin switch, origin command and alarm reset. Besides that, it also consist upper controller or manual pulse generator that produce the position command pulse with 5V line drive through the forward pulse input and reverse pulse input. Then, it has analog speed command and frame ground terminal. The CN1 output consist of monitor output, line driver pulse frequency, origin reach completion, servo ready, brake output, alarm state, position decision complement and ground terminal.

Figure 3.8 Signal and Wiring Connection of Driver

(37)

32 3.5.4 CN1 Pin Arrangement

CN1 is the connector located at the right lower part of the front of drive system.

This connector is used to connect the drive system with the upper control system which command the operation. The serial number of the connector is 10150-3000VE.

Figure 3.9 Pin Array of CN1 3.5.5 CN1 Wiring and Signal

Signal Title Pin

No.

Function

Start Command START 41 Start operation

Origin Command ORGCOM 13 Use to set origin of machine CW unable/CW

Jog

CCWLIM/CCWJO G

40 OFF: Rotation Unable/ Jog operation

ON: Rotation Able/ Jog stop CCW unable/CCW

Jog

CWLIM/CWJOG 14 Alarm reset/ motor

stop

ALMRST/STOP 38 Alarm state: Reset Alarm Origin switch ORG-DOG 39 Contact DOG switch signal

(ON: switch domain)

(38)

33 Servo Motor

Operation Command

SVONEN 15 Determines whether servo

motor can be started

(ON: can start, OFF: cannot start)

Position command select 0

COMSEL0 18 Set internal position command by combining five signal Position command

select 1

COMSEL1 43

Position command select 2

COMSEL2 17

Position command select 3

COMSEL3 42

Position command select 4/MPGEN

COMSEL4/MPGE N

16

24V Power Input +24VIN 49 Connect greater than

(+24VDC) 1.0A) of external power supply

+24V GND Input GND24 24 Connect GND of external power supply

25 BRAKE Drive

Output

BRAKE 47 This is the output signal intended to drive internal brake of motor

READY State Output

RDY 22 This is No Alarm, Power

Good status when power is turned on.

Position decision completion/Positio n 0

INPOS/OP0 46 Display approachment in position completion signal in case of absolute position operation

Position 1 OP1 20

Position 2 OP2 45

Position 3 OP3 19

Position 4 OP4 44

Alarm state ALARM 21 Turn off if alarm is detected

(39)

34 Origin reach

completion

ORGOUT 48 Turn on when reach origin FRAME

GROUND

FG 50 Connects earth cable of CN1

Encoder Output PAO 7 Outputs the encoder signal of motor in line drive system after driving it according to the frequency dividing ratio set by the ratio

/PAO 32

PBO 6

/PBO 31

PZO 5

/PZO 30

Analog Speed Command(Overrid e)

SPDIN 27 If we input speed command in analog voltage of the ratio set by parameter, speed override function operates

Monitor Output 1 MONIT 1 3 Outputs within the range of -5 to +5V according to values set to monitor 1

Monitor Output 2 MONIT 2 2 Outputs within the range of -5 to +5V according to values set to monitor 2

+12V Output +12V 35 Output ±12V used only when

speed override command are simply applied

-12V Output -12V 37

0V GND 1 This is the power supply

common Ground Terminal for analog speed override

command, positive speed monitor output and encoder output terminals.

8 26 33 34 36

FPulse PPFIN 11 Set pulse forms according to

the set value of parameter Pulse form:

1. Direction + Pulse

PFIN 10

RPulse PPRIN 9

PRIN 12

(40)

35 2. CW Pulse + CCW

Pulse

3. Two phase pulse (Phase A + Phase B) Table 3.2 CN1 Wiring and Signal

3.5.6 Input Contact Signal

Pin Number (No.) Signal Function in Controlling Position

Contact Type COMSEL0 (18) Position Command selection 0 ON:1, OFF:0

MPGEN signal: ON=Pulse command operation

COMSEL1 (43) Position Command selection 1 COMSEL2 (17) Position Command selection 2 COMSEL3 (42) Position Command selection 3 COMSEL4/MPGEN (16) Position Command selection

4/MPGEN

START (41) Start Command ON = Starting operation

SVONEN (15) Enable to servo operation ON = Servo drive enable

CCWLIM/JOG (40) Not CW/ CW Jog OFF = Not CW/CW Jog

CWLIM/JOG (14) Not CCW/ CCW Jog OFF = Not CCW/CCW Jog

ORG (39) Origin DOG switch ON = Dog switch range

ORGCOM (13) Origin Command ON = Origin operation

ALMRST:STOP (38) ALARM RESET/ Motor stop ON = Alarm Reset ON = Motor stop Table 3.3 Input Contact Signal

3.5.7 Position Command Pulse Input Signal

1. The position command input pulse is set by using the open collector input when the external power supply of 24V is used.

2. The types of pulses that can be used are ‘direction + pulse’, ‘forward pulse + reverse pulse’ and ‘lead pulse + lag pulse’.

3. The resistance 150Ω is used.

(41)

36 Figure 3.10 Input Signal

3.5.8 Raspberry Pi Pin and CN1 Driver Connection

1) The pin number 2 that has 5V power is connected to the pin number 11 (PPFIN) that supply +5VA power. The 150Ω resistor is put between the connection.

2) Meanwhile, the GPIO 23 that has pin number 16 is connected to pin number 10 that has forward pulse input (PFIN). The 1kΩ resistor and transistor TIP122 are connected between the connection. The emitter of the transistor is connected to the ground of the Raspberry Pi.

3) Then, the pin number 4 that has 5V power is connected to the pin number 9 (PPRIN) that supply +5VA power. The 150Ω resistor is put between the connection.

4) The GPIO 24 that has pin number 18 is connected to pin number 12 that has reverse pulse input (PRIN). The 1kΩ resistor and transistor TIP122 are connected between the connection. The emitter of the transistor is connected to the ground of the Raspberry Pi.

Raspberry Pi Pin CN1 Driver Connection

5V PWR (Pin No.2) PPFIN (Pin No.11)

GPIO 23 (Pin No.16) PFIN (Pin No.10)

5V PWR (Pin No.4) PPRIN (Pin No.9)

GPIO 24 (Pin No.18) PRIN (Pin No.12)

Table 3.4 Raspberry Pi Pin and CN1 Driver Connection

(42)

37 Figure 3.11 The Raspberry Pi Pin and CN1 Driver Circuit Connection

3.5.9 External Power Supply and CN1 Driver Connection

1) The positive terminal of the external power supply is connected to the CN1 driver 24V power input at pin number 49.

2) Meanwhile, the negative terminal of the external power supply is connected to the CN1 driver ground input at pin number 24 and 25.

3) The ground of the external power supply is connected to the input signal pin of the CN1 driver at pin number 18, 43, 17, 42, 16, 41,15, 40, 14, 39, 13 and 38.

External Power Supply CN1 Driver Pin Number CN1 Driver Connection

Positive Terminal 49 24V Power Input

Negative Terminal 24 GND Input

25

Ground 18 COMSEL0

43 COMSEL1

17 COMSEL2

42 COMSEL3

16 COMSEL4/MPGEN

41 START

15 SVONEN

40 CCWLIM/JOG

(43)

38

14 CWLIM/JOG

39 ORG

13 ORGCOM

38 ALMRST/STOP

Table 3.5 External Power Supply and Driver Connection

Figure 3.12 External Power Supply and CN1 Driver Circuit Connection 3.5.10 The Overall Circuit Connection

Figure 3.13 Overall Circuit Connection

(44)

39 3.5.11 The Setup of Experiment

Figure 3.14 The setup of Experiment

After the experiment is done, the input signal from CN1 connector cannot be sent to the motor driver. This is because there is no details about which input signal connection that can drive the motor driver.

Experiment 4: Refurbishment and upgrading the brushless DC motor using Raspberry Pi microcontroller

3.6 Brushless DC Motor System Configuration

The AXH Series combines a compact, brushless DC speed control motor and 24 VDC board-level driver. These systems provide space savings and high power output, and are easy to use. The size of the driver has been reduced by approximately 60%

when compared to conventional DC brushless drivers. The driver is about 15W to 50W.

The size of the motor has been reduced by approximately 55% when compared to conventional AC speed control motors is about 3.15 in. or 80mm size. The motor has extremely high output power for its small size. The fluctuation is only 1% for load, voltage and temperature.

These motors provide superior speed stability with minimal speed fluctuation. The speed can be set within the wide range of 100 r/min to 3000 r/min (30:1). The motor maintains a constant torque from low speed to high speed.

The geared type motors come pre-assembled with a gearhead. These gearheads provide torque up to 17.7 lb-in (2N·m) for the 15W motors and up to 141 lb-in (16N·m)

(45)

40 with the 50 W motors. The motor is equipped with protective functions to handle overload, overvoltage, undervoltage, overspeed and out-of-phase power. When one of these protective functions detects an abnormality, a LED blinks and motor comes to a stop.

Figure 3.15 The System Configuration of Driver and Motor 3.6.1 The Driver Connection Diagram

Figure 3.16 The Driver Connection Diagram

(46)

41 3.6.2 The Input Signal Circuit

Figure 3.17 The Input Signal Circuit 3.6.3 The Input Circuit Connection

Figure 3.18 The Input Circuit Connection 3.6.4 Raspberry Pi Pin and Driver Connection

Method 1: To control the direction of the motor rotation

1) The Raspberry Pi of GPIO 18 is connected to the driver pin number 11 that has start and stop input. The resistor of 1kΩ and transistor 2N2222 are connected between the circuit.

2) The Raspberry Pi of GPIO 23 is connected to the driver pin number 10 that has run and brake input. The resistor of 1kΩ and transistor 2N2222 are connected between the circuit.

(47)

42 3) The Raspberry Pi of GPIO 24 is connected to the driver pin number 9 that has CW (clockwise) and CCW (counter clockwise) input. The resistor of 1kΩ and transistor 2N2222 are connected between the circuit.

4) Then, the Raspberry Pi of GPIO 25 is connected to the driver pin number 8 that has internal and external input. The resistor of 1kΩ and transistor 2N2222 are connected between the circuit.

Raspberry Pi Driver Pin Number Driver Connection

GPIO 18 11 Start/Stop

GPIO 23 10 Run/Brake

GPIO 24 9 CW/CCW

GPIO 25 8 Int.VR./Ext. Input

Table 3.6 Raspberry Pi and Driver Connection

Figure 3.19 The Circuit Connection of Raspberry Pi and Motor Driver

(48)

43 3.6.5 The Setup of the Experiment (To control the direction of the motor

rotation)

Figure 3.20 Setup of the Experiment 3.6.6 The Output Signal Connection

Figure 3.21 The Output Signal Connection 3.6.7 The Speed Output

The system outputs pulse signals (with a width of 0.3 ms) at a rate of 30 pulses per rotation of the motor output shaft, synchronized with the motor drive. The speed output frequency and the motor speed can be calculated.

(49)

44 3.6.8 Raspberry Pi Pin and Driver Connection

Method 2: To control the speed of the motor rotation

1) The Raspberry Pi of GPIO 18 is connected to the driver pin number 11 that has start and stop input. The resistor of 1kΩ and transistor 2N2222 are connected between the circuit.

2) The Raspberry Pi of GPIO 23 is connected to the driver pin number 10 that has run and brake input. The resistor of 1kΩ and transistor 2N2222 are connected between the circuit.

3) The Raspberry Pi of GPIO 24 is connected to the driver pin number 9 that has CW (clockwise) and CCW (counter clockwise) input. The resistor of 1kΩ and transistor 2N2222 are connected between the circuit.

4) Then, the Raspberry Pi of GPIO 25 is connected to the driver pin number 8 that has internal and external input. The resistor of 1kΩ and transistor 2N2222 are connected between the circuit.

5) The Raspberry Pi of GPIO 12 is connected to the driver pin number 2 that has speed output. The resistor of 1kΩ and 10kΩ are used to connect the circuit.

Raspberry Pi Driver Pin Number Driver Connection

GPIO 18 11 Start/Stop

GPIO 23 10 Run/Brake

GPIO 24 9 CW/CCW

GPIO 25 8 Int.VR./Ext. Input

GPIO 12 2 Speed Output

Table 3.7 Raspberry Pi and Driver Connection

(50)

45 Figure 3.22 The Circuit Connection of Raspberry Pi and Motor Driver

3.6.9 The Setup of the Experiment (To control the speed of the motor rotation)

Figure 3.23 Setup of the Experiment

(51)

46 CHAPTER 4

RESULT AND DISCUSSION

4.1 Controlling DC Motor Without using Raspberry Pi Microcontroller

Based on the early observation, the motor ran at the constant speed as the voltage is supplied without Raspberry Pi. DC motor is directly connected to the voltage supply and it will be supplied with the constant power all the time. The input circuit connection such as the start or stop input, brake input, rotation direction switching input, speed potentiometer selection input and alarm reset input is connected to the ground to make the rotation.

4.2 Raspberry Pi Coding To Control the Direction of DC Motor

Figure 4.1 Raspberry Pi Coding to Control Direction

(52)

47 The first two lines tell Python what is needed in the program. The first line is wanted to access a module called RPi.GPIO. This module handles all the work involved around turning the GPIO pins on and off on the Raspberry Pi. The second line brings in sleep from the module time to make it possible to pause the script giving it time to perform a certain action by leaving a motor on for a few seconds.

The function setmode tells RPi.GPIO to the GPIO.BCM option are referring to the pins by the "Broadcom SOC channel" number, these are the numbers after "GPIO"

on the Raspberry Pi. The GPIO numbers of 18, 23, 24 and 25 that are used to tell Python that they are the GPIO pins associated with the motor. The GPIO number 18 used to start or stop the motor, GPIO number 23 used to run or brake the motion, GPIO number 24 used to change direction clockwise or counter clockwise and GPIO number 25 used to determine the internal or external input of the motor.

The next line tell the Raspberry Pi to setup the GPIO numbers and these are all outputs which is done with GPIO.OUT. With the script set up, the Raspberry Pi ready to rotate the motor forward and backward direction. It will turn on some pins, wait two seconds then stopping the motor.

4.3 Controlling The Speed of DC Motor Using Internal Potentiometer

When INT.VR/EXT. input is set to the ON (L level), the speed can be set with the internal speed potentiometer. There is no need for this connection when the internal potentiometer is not used.

Figure 4.2 Speed Control by Internal Potentiometer

(53)

48 4.4 Raspberry Pi Coding To Control the Speed of DC Motor

(54)

49 Figure 4.3 Raspberry Pi Coding To Control Speed

(55)

50 For the speed coding, the GPIO number of 12 is added to connect with the speed output pin of the motor. Then, the speed pin is setup as GPIO.IN to read the data of speed state and GPIO.OUT to do the output. Then, the PWM instance is created by GPIO.PWM(channel, frequency). The channel is 12 and the frequency is 500Hz. Then, PWM is started by pwm.start(duty cycle). Next, the counter variable is defined to start at 0 and GPIO.input(Speed) is introduced in the program. The file of motor.csv is opened to read the coordinate of the motor at 1, direction at 3 and speed at 5. The mode of the motor whether on or off, the direction whether clockwise or counter-clockwise and the speed whether high or low can be set by changing the value of 1 or 0 in the motor.csv file.

Figure 4.4 motor.csv File

Figure 4.5 File of the Coordinate in Excel

If the motor is changed to 1, then the “motor on” is printed and do the count of speed state whether it is 1 for rising and 0 for falling. Then, the counter increased 1 if it is rising and the counter decrease 1 if it is falling. If the speed is changed to 1, then it showed that the speed is in high speed. Meanwhile, if the direction is changed to 1, it

(56)

51 showed that the direction in the clockwise rotation and if the direction is changed to 0, it showed that the direction in the anti-clockwise rotation. Moreover, if the speed is changed to 0, then it showed that the speed is in low speed. Next, if the motor is changed to 0, then the “motor_off” is printed.

4.5 Speed Output

i) When motor =1, direction=0, speed=0

Figure 4.6 Data Collection 1 Number of pulse Speed State

1 0

2 0

3 1

4 0

5 0

6 1

7 0

8 0

9 0

10 1

Table 4.1 Speed State Count for Data Collection 1

(57)

52 Figure 4.7 Pulse Output for Motor=1, Direction=0, Speed=0

ii) When motor=1, direction=0, speed=1

Figure 4.8 Data Collection 2

0 0.2 0.4 0.6 0.8 1 1.2

0 2 4 6 8 10 12

Pulse Output for Motor=1, Direction=0, Speed=0

(58)

53 Number of pulse Speed State

1 0

2 1

3 1

4 0

5 1

6 0

7 0

8 1

9 1

10 0

Table 4.2 Speed State Count for Data Collection 2

Figure 4.9 Pulse Output for Motor=1, Direction=0, Speed=1

0 0.2 0.4 0.6 0.8 1 1.2

0 2 4 6 8 10 12

Pulse Output for Motor=1, Direction=0, Speed=1

(59)

54 iii) When motor=1, direction=1, speed=0

Figure 4.10 Data Collection 3 Number of pulse Speed State

1 0

2 0

3 0

4 0

5 0

6 1

7 0

8 0

9 0

10 0

Table 4.3 Speed State Count for Data Collection 3

Rujukan

DOKUMEN BERKAITAN

Exclusive QS survey data reveals how prospective international students and higher education institutions are responding to this global health

Secondly, the methodology derived from the essential Qur’anic worldview of Tawhid, the oneness of Allah, and thereby, the unity of the divine law, which is the praxis of unity

Gen A mengawal penukaran satu pigmen putih, Po, kepada satu pigmen putih yang lain, Pi, di mana alel dominan A menghasilkan enzim benfungsi sementara ale/ a menghasilkan

،)سدقلا فِ رهظي رمع( ةياور فِ ةنمضتلما ةيملاسلإا رصانعلا ضعب ةبتاكلا تلوانت ثحبلا ةثحابلا زّكرت فوسو ،ةياوّرلا هذله ماعلا موهفلماب قلعتي ام ةساردلا كلت

In this research, the researchers will examine the relationship between the fluctuation of housing price in the United States and the macroeconomic variables, which are

In Timor, Tanimbar, Seram, Buru, Buton, East Sulawesi and Banggai-Sula area, the Early Tertiary sediment are a continuation of Late Cretaceous deposition.. Since

The FSM Controller controls the signals to read data from and write the data to two separated buffers which are implemented using dedicated block RAM resource of Xilinx FPGA..

The result of this study indicates most pupils perceive the learning of Science and Mathematics in English has brought positive effects especially in terms