Development Of Embedded Controller For High Power Led Rope Light Application.

(1)

FAKULTI KEJURUTERAAN ELEKTRIK UNIVERSITI TEKNIKAL MALAYSIA MELAKA

LAPORAN PROJEK SARJANA MUDA

BEKU 4983

DEVELOPMENT OF EMBEDDED CONTROLLER FOR HIGH

POWER LED ROPE LIGHT APPLICATION

SEOW SOON LOY B010510125


(2)

“ I hereby declare that I have read through this report entitle “Development of Embedded Controller for High Power LED Rope Light Application” and found that it has comply the partial fulfillment for awarding the degree of Bachelor of Electrical Engineering (Power Electronic)”

Signature : ...

Supervisor’s Name : Professor Madya Dr. Zulkifilie bin Ibrahim


(3)

DEVELOPMENT OF EMBEDDED CONTROLLER FOR HIGH POWER LED ROPE LIGHT APPLICATION

SEOW SOON LOY

A report submitted in partial fulfillment of the requirements for the degree of Bachelor in Electrical Engineering (Power Electronic)

Faculty Of Electrical Engineering

UNIVERSITI TEKNIKAL MALAYSIA MELAKA


(4)

I declare that this report entitle “Development of Embedded Controller for High Power LED Rope Light Application” is the result of my own research except as cited in the references. The report has not been accepted for any degree and is not concurrently submitted in candidature of any other degree.

Signature : ...

Name : SEOW SOON LOY


(5)

(6)

ACKNOWLEDGEMENT

In preparing this report, I was in contact with many people, researchers, academicians and practitioners. They have contributed towards my understanding and thought. In particular, I wish to express my sincere appreciation to my main project supervisor, Professor Madya Dr. Zulkifilie bin Ibrahim, for encouragement, guidance critics and knowledge to solve my problem arise. I am also very thankful to Professor Madya Dr. Ismadi Bugis for his guidance, advices and motivation. Without their continued support and interest, this project would not have been same as presented here.

I also would like to thanks Pn. Irma Wani binti Jamaludin and En.Md Hairul Nizam bin Talib as my panels for Final Year Project presentation. They shared out their time to attend my presentation PSM 1 and PSM 2. Besides, they also give their opinions, advice and provide me with good idea and knowledge to complete my final year project.

Lastly, I would like to thanks to postgraduate student, Cik Raihana for sharing and giving me her opinions, advices and provide me a good idea to do write my thesis. I would like to thank my friends and family for giving me their support as well as their knowledge in order to complete my project.


(7)

ABSTRACT

The project is titled as “Development of an embedded controller for High-Power LED Rope Light application”. In this project, the embedded controller developed is based on ATMEL ATMega 168 prototype board. This project is to design and develop the changing color patterns and LED characteristic. Instead of using assembly language to compile, this controller will use Arduino which use C programming language to develop the algorithm. The goal of the project is to design and develop a laboratory scale functioning prototype in order to demonstrate the interfacing between the controller and phase angle power control module. The ATMEL ATMega168 controller is able to generate pulse wave signal(PWM). The desired pulse wave signal generated is an input signal for phase angle power control module as the input to thyristor gate terminal in order to control the color changing patterns and LED characteristic. The major hardware implementation in this project is ATMEL ATMega 168 prototype board. ATMEL ATMega 168 is chosen due to its specification features of high speed, easy-design hardware system and low power consumption.


(8)

ABSTRAK

Projek ini adalah berjudul “Pembangunan pengawal tersirat untuk aplikasi penggunaan lampu bersambung LED kuasa tinggi”. Dalam projek ini, pengawal tersirat maju adalah diasaskan oleh ATMEL ATMega 168, ia merupakan sebuah prototaip lembaga. Projek ini adalah mereka bentuk dan membangunkan corak-corak warna berubah-ubah dan cirri-ciri LED. Sebaliknya menggunakan bahasa perhimpunan untuk mengumpul, pengawal ini akan menggunakan Arduino yang mengunakan bahasa pengaturcaraan C untuk membangunkan algoritma. Matlamat projek adalah mereka bentuk dan membangunkan satu skala makmal berfungsi prototaip teratur untuk menunjukkan pengantaramukaan antara pengawal dengan modul sudut penembakan kuasa kawalan. Pengawal ATMEL ATMega168 berkeupayaan menjana gelombang nadi isyarat. Gelombang nadi terhasrat isyarat dijana adalah satu isyarat input untuk modul sudut penembakan kuasa kawalan sebagai input untuk tiristor pangkalan pintu pagar untuk mengawal perubahan corak-corak warna dan ciri-ciri LED. Pelaksanaan perkakasan utama dalam projek ini adalah ATMEL ATMega 168 prototaip lembaga. ATMEL ATMega 168 dipilih disebabkan oleh spesifikasinya ciri-ciri kelajuan tinggi, mudah reka bentuk sistem perkakasan dan penggunaan kuasa rendah.


(9)

TABLE OF CONTENTS

CHAPTER TITLE PAGE

PROJECT TITLE ii

ACKNOWLEDGEMENT v

ABSTRACT vi

TABLE OF CONTENTS viii

LIST OF TABLES xi

LIST OF FIGURES xii

LIST OF ABBREVIATION xvi

LIST OF APPENDICES xviii

1 INTRODUCTION

1.1 Objectives of the Project 2

1.2 Scope of the Project 2

1.3 Problem Statement 2

2 LITERATURE REVIEW

2.1 Embedded Systems 4

2.1.1 History 4


(10)

3 METHODOLOGY

3.1 Project Implementation Flow Chart 9

3.2 Project Planning 12

3.3 Project Description 13

3.4 Equipment 16

3.4.1 Digital Oscilloscope (TDS 210) 16 3.4.2 DC Voltage Power Supply (GPC-3030) 19 3.4.3 AC/DC Adapter 20

3.4.4 Multimeter 20

3.5 Hardware part process 21

3.5.1 AVR ATMega168 Board 22 3.5.1.1 Features and specifications of AVR

ATMega168 Board

23

3.5.1.2 The CPU of AVR ATMega 168 24 3.5.1.3 Block Diagram of AVR Achitecture 26 3.5.1.4 AVR Memories 27 3.5.1.5 SRAM Data Memory 28 3.5.1.6 I/O Ports 30 3.5.1.7 SPI – Serial Peripheral Interface 32 3.5.1.8 Analog-to-Digital Converter 35 3.5.2 Full-wave Rectifier circuit 36


(11)

3.5.3 Thyristor Firing Angle Control Circuit 39 3.5.3.1 Zero crossing circuit 41 3.5.3.2 Sawtooth Generator 41 3.5.3.3 Comparator 43 3.5.3.4 Isolator 44 3.5.4 Methods and Surveys Done for Project Modeling 44 3.5.4.1 Designed thyristor firing angle control

circuit.

45

3.5.4.2 Conventional existing LED rope light controller (BEATINEON)

47

3.6 Software Development 50

3.6.1 Arduino 50

3.7 Experimental Procedure 50

3.7.1 Hardware Setup 51

3.7.1.1 AVR ATMega168 Matchbox 51 3.7.2 Hardware Integration 53 3.7.3 How to Programme the Controller 53 3.7.4 Source Code (Coding) 61

4 RESULT AND DISCUSSION

4.1 Thyristor Firing Angle Modeling and Simulation 64


(12)

4.1.2 Analysis of the simulation result 67 4.2 Conventional LED rope light controller (BEATINEON) 68 4.2.1 Result Capture from Oscilloscope 68 4.2.2 Analysis of Capture Results 70 4.3 Prototype LED Rope Light Controller 71 4.3.1 Results Capture from Oscilloscope 71 4.3.2 Analysis of Capture Results 74

5 CONCLUSION, SUGGESTION AND FUTURE WORK

5.1 Conclusion 75 5.2 Suggestion and Future Work 76

REFERENCE 77


(13)

LIST OF TABLE

TABLE TITLE PAGE

3.1 Gantt Chart of Project Planning 12

3.2 Specification of Oscilloscope 17

3.3 Specifications of Oscilloscope Probe 18

3.4 Specification of DC Power Supply 19


(14)

LIST OF FIGURES

FIGURE TITLE PAGE

2.1 Embedded circuit 6

2.2 Embedded PC mother board 6

3.1 Flow Chart of project implementation 9

3.2 Block Diagram of Overall Project 13

3.3 Photo of Overall Project 14

3.4 The Components Used for Overall Project. 15

3.5 Circuit Diagram of Overall Project 15

3.6 Digital Oscilloscope 16

3.7 Oscilloscope Probe 18

3.8 Block Diagram of Oscilloscope Connection 18

3.9 DC Voltage Power Supply 19

3.10 AC/DC Adapter 20

3.11 Block Diagram of Adapter Connection 20

3.12 Multimeter 21

3.13 AVR ATMega168 Board. 22

3.14 AVR Atmega168 Board Schematic Diagram 23

3.15 Block diagram of AVR ATMega 168 25

3.16 Block Diagram of AVR Achitecture 27

3.17 Program Memory Map, ATmega168 28

3.18 Data Memory Map 29

3.19 On-chip Data SRAM Access Cycles 30

3.20 I/O Pin Equivalent Schematic 30

3.21 Ports as General Digital I/O 31

3.22 SPI Block Diagram 32

3.23 SPI Master-slave Interconnection 34


(15)

3.25 Full-wave Rectifier 37

3.26 When the AC voltage is in positive-half. 38

3.27 When the AC voltage is in negative-half. 38

3.28 AC Wave input 39

3.29 Rectified Waveform 39

3.30 Phase angle power control module 40

3.31 Block Diagram of phase angle module 40

3.32 Zero-crossing in a waveform representing voltage vs. Time

41

3.33 Sawtooth Waveform 42

3.34 Schematic diagram of opto-isolator 44

3.35 Designed thyristor firing angle control circuit 45

3.36 The photo of the LED rope light controller 47

3.37 Schematic diagram of the LED rope light controller (BEATINEON) 47 3.38 The hand-draw simplified circuit of the LED rope light controller (BEATINEON) 48 3.39 The schematic diagram of the simplified circuit of the LED rope light controller

(BEATINEON)

49

3.40 Testing on (BEATINEON) LED rope light controller ‘s integrated circuit (IC) 49 3.41 Interfacing the AVR ATMega 168 Matchbox with POP interface Board 51

3.42 Connect the AD/DC adapter into the POP interface board 52

3.43 Connect the LED to the output port 52

3.44 Arduino Board 54

3.45 Connect USB to the Arduino Board 55

3.46 Add New Hardware Wizard Box 55

3.47 Step to install from a list or specified location (Advanced) 56

3.48 Step to search the best driver 56

3.49 Step to complete the wizard 57

3.50 Step to open LED blink sketch 58

3.51 Example of blink coding 58

3.52 Step to select serial port at Windows Device Manager 59

3.53 Step to select serial port at Arduino software 59


(16)

3.55 Push the reset button before upload button 60

3.56 Select the upload to I/O Board 60

4.1 Thyristor Firing Angle Control Circuit 64

4.2 Waveform at point A 65

4.3 Waveform at point B 65

4.4 Waveform at point C 66

4.5 Waveform at point D 66

4.6 Waveform at point F-F’ 66

4.7 Waveform captured at transistor’s collector terminal 68

4.8 Waveform captured at transistor’s base terminal 68

4.9 Waveform captured at transistor’s emitter terminal 69

4.10 Waveform captured at thyristor’s gate terminal 69

4.11 Waveform captured at rectifier output (positive terminal) 71 4.12 Waveforrm captured at anode terminal (for thyristor) in phase angle control module 71 4.13 Waveform captured using current probe at (when light intensity start to increase) 72 4.14 Waveform captured using current probe at load (when light intensity reach maximum) 72 4.15 Waveform captured using current probe at load (when light intensity reduced from

maximum)

73


(17)

LIST OF ABBREVIATIONS

ABBREVIATION

LED Light-emitting diode

MIT Massachusetts Institute of Technology SCS Silicon Controlled Switch

VAK Positive potential at anode

VBO Breakdown voltage

VG Voltage at Gate terminal

VGT Gate trigger voltage

IGT Gate trigger current

DC Direct current

AC Alternating current

CMOS Complementary metal–oxide–semiconductor RISC Reduced instruction set computing

CPU Central Processing Unit

AVR Advanced Virtual RISC

MIPS Microprocessor without Interlocked Pipeline Stages

I/O Input/ Output

ADC Analog to Digital Converter

TQFP Thin Quad Flat Pack

MLF MicroLeadFrame

PDIP Plastic Dual In-line Package

ALU Arithmetic Logic Unit

ISP Internet service provide

SPI System Packet Interface

CISC Complex Instruction Set Computer SRAM Static Random Access Memory


(18)

LDD Load Data Direction

SEI Set Interrupt

CEI Clear Interrupt

BST Bit Storage

BLD Bit Load

RCX Resistance, Capacitance, Inductance SCR Silicon-Controlled Rectifier

VS Voltage Source

PSM Projek Sarjana Muda

PWM Pulse-Width Modulation

PUD Pull-up Disable

DDR Data Direction Register

PIN Port Input Pins

SPIE SPI Interrupt Enable

SPI Serial Peripheral Interface

SS Slave Select

MOSI Master Out-Slave In

SPIF Serial Peripheral Interface Transmission Flag

SPDR SPI Data Register

ADMUX ADC Multiplexer Select

ADCSRA ADC Control & Status Register ADCH/ADC ADC Data Register

ADEN ADC Enable bit


(19)

LIST OF APPENDICES

APPENDIX TITLE PAGE

A Source Code 79

B Datasheets of Component Used 81


(20)

CHAPTER 1

INTRODUCTION

This project is titled as “Development of an Embedded Controller for High Power LED Rope Light Application”. The purpose of this project is to develop an embedded controller that able to control the LED characteristic changing patterns such as blinking, dimming and so on. This project is divided into two parts; hardware implementation and software part.

In the hardware part, a circuit that be able to turn on the thyristor and direct interface with the ATMega 168 microcontroller from ATMEL’s product as well as to connect with the LED rope light will be designed. The thyristor firing angle circuit control circuit or module is to control the degree of firing angle and to synchronize the currents and voltages between the controller so that the thyristor will fire at the same phase angle. The pulse generated by the ATMega 168 microcontroller will trigger the gate terminal of the thyristor so that the thyristor starts to conducts. As the thyristor is on, the LED rope light (load) will on according to the desired lighting.

In the software part, the programming using Arduino 0008 software will be developed by using C language, a kind of high level programming language, instead of assembly language. As the result, the ATMEL controller developed is able to provide precise PWM signal in order to drive the thyristor to turn on the circuit. Then, the embedded controller will be interfaced to the thyristor firing angle control/ module developed to run in real time and debug.


(21)

1.1 Objective

• Develop an embedded controller that is able to control the LED characteristic changing patterns such as blinking, dimming and so on.

1.2 Scope of project

• To develop a controller that able to control the changing patterns and the LED characteristic.

• To interfacing between the controller and the thyristor to switch ‘on’ the circuit to turn on the LED rope light.

1.3 Problem Statement

In the present world, LED rope light is already in the market. It is easy to turn on the LED rope light but the problem is to control the color changing pattern of LED rope light and characteristic of LED such as blinking, dimming or control the brightness. The drawbacks of the conventional LED rope lights are limited functions, patterns, operating length, low energy efficiency and flexibility. The operating length is about 100 meter per controller. In order to control a long LED rope light more than 100 meter, many controller need to be use depending on the length of LED rope light. Besides, it is hard to synchronize the pattern of lighting of LED rope light if many controllers is used. The traditional AC/DC power converter using bulky current transformer control circuit waste energy because of the large reversing currents required to sense polarity shifts through the switching devices.

In the software part, it is difficult to develop PWM (Pulse Width Modulation). It is also difficult to write a program that is able to change the patterns of colors as indicated in this project scope. The problem also occurs when interface the developed embedded controller with the thyristor firing angle control circuit/ module. Therefore, there is necessity to develop a cost-effective and programmable controller that be able to perform the changing patterns of colors as indicated.


(22)

CHAPTER 2

LITERATURE REVIEW

2.1 Embedded systems and embedded controllers

2.1.1 History

In the earliest years of computers in the 1930-40s, computers were sometimes dedicated to a single task, but were far too large and expensive for most kinds of tasks performed by embedded computers of today. Over time however, the concept of programmable controllers evolved from traditional electromechanical sequencers, via solid state devices, to the use of computer technology.


(23)

One of the first recognizably modern embedded systems was the Apollo Guidance Computer, developed by Charles Stark Draper at the MIT Instrumentation Laboratory. At the project's inception, the Apollo guidance computer was considered the riskiest item in the Apollo project as it employed the then newly developed monolithic integrated circuits to reduce the size and weight. An early mass-produced embedded system was the Autonetics D-17 guidance computer for the Minuteman missile, released in 1961. It was built from transistor logic and had a hard disk for main memory. When the Minuteman II went into production in 1966, the D-17 was replaced with a new computer that was the first high-volume use of integrated circuits. This program alone reduced prices on quad NAND gate ICs from $1000/each to $3/each, permitting their use in commercial products.

Since these early applications in the 1960s, embedded systems have come down in price and there has been a dramatic rise in processing power and functionality. The first microprocessor for example, the Intel 4004, was designed for calculators and other small systems but still required many external memory and support chips. In 1978 National Engineering Manufacturers Association released a "standard" for programmable microcontrollers, including almost any computer-based controllers, such as single board computers, numerical, and event-based controllers.

As the cost of microprocessors and microcontrollers fell it became feasible to replace expensive knob-based analog components such as potentiometers and variable capacitors with up/down buttons or knobs read out by a microprocessor even in some consumer products. By the mid-1980s, most of the common previously external system components had been integrated into the same chip as the processor and this modern form of the microcontroller allowed an even more widespread use, which by the end of the decade were the norm rather than the exception for almost all electronics devices.

The integration of microcontrollers has further increased the applications for which embedded systems are used into areas where traditionally a computer would not have been considered. A general purpose and comparatively low-cost microcontroller may often be programmed to fulfill the same role as a large number of separate


(24)

components. Although in this context an embedded system is usually more complex than a traditional solution, most of the complexity is contained within the microcontroller itself. There are very few additional components may be needed and most of the design effort is in the software. The intangible nature of software makes it much easier to prototype and test new revisions compared with the design and construction of a new circuit not using an embedded processor. [1]

An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions, [2] often with real-time computing constraints. It is usually embedded as part of a complete device including hardware and mechanical parts. In contrast, a general-purpose computer, such as a personal computer, can do many different tasks depending on programming. Since the embedded system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product, or increasing the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale.

In general, "embedded system" is not an exactly defined term, as many systems have some element of programmability. For example, Handheld computers share some elements with embedded systems such as the operating systems and microprocessors which power them but are not truly embedded systems, because they allow different applications to be loaded and peripherals to be connected.


(1)

LIST OF APPENDICES

APPENDIX TITLE PAGE

A Source Code 79

B Datasheets of Component Used 81


(2)

CHAPTER 1

INTRODUCTION

This project is titled as “Development of an Embedded Controller for High Power LED Rope Light Application”. The purpose of this project is to develop an embedded controller that able to control the LED characteristic changing patterns such as blinking, dimming and so on. This project is divided into two parts; hardware implementation and software part.

In the hardware part, a circuit that be able to turn on the thyristor and direct interface with the ATMega 168 microcontroller from ATMEL’s product as well as to connect with the LED rope light will be designed. The thyristor firing angle circuit control circuit or module is to control the degree of firing angle and to synchronize the currents and voltages between the controller so that the thyristor will fire at the same phase angle. The pulse generated by the ATMega 168 microcontroller will trigger the gate terminal of the thyristor so that the thyristor starts to conducts. As the thyristor is on, the LED rope light (load) will on according to the desired lighting.

In the software part, the programming using Arduino 0008 software will be developed by using C language, a kind of high level programming language, instead of assembly language. As the result, the ATMEL controller developed is able to provide precise PWM signal in order to drive the thyristor to turn on the circuit. Then, the embedded controller will be interfaced to the thyristor firing angle control/ module developed to run in real time and debug.


(3)

1.1 Objective

• Develop an embedded controller that is able to control the LED characteristic changing patterns such as blinking, dimming and so on.

1.2 Scope of project

• To develop a controller that able to control the changing patterns and the LED characteristic.

• To interfacing between the controller and the thyristor to switch ‘on’ the circuit to turn on the LED rope light.

1.3 Problem Statement

In the present world, LED rope light is already in the market. It is easy to turn on the LED rope light but the problem is to control the color changing pattern of LED rope light and characteristic of LED such as blinking, dimming or control the brightness. The drawbacks of the conventional LED rope lights are limited functions, patterns, operating length, low energy efficiency and flexibility. The operating length is about 100 meter per controller. In order to control a long LED rope light more than 100 meter, many controller need to be use depending on the length of LED rope light. Besides, it is hard to synchronize the pattern of lighting of LED rope light if many controllers is used. The traditional AC/DC power converter using bulky current transformer control circuit waste energy because of the large reversing currents required to sense polarity shifts through the switching devices.

In the software part, it is difficult to develop PWM (Pulse Width Modulation). It is also difficult to write a program that is able to change the patterns of colors as indicated in this project scope. The problem also occurs when interface the developed embedded controller with the thyristor firing angle control circuit/ module. Therefore, there is necessity to develop a cost-effective and programmable controller that be able to perform the changing patterns of colors as indicated.


(4)

CHAPTER 2

LITERATURE REVIEW

2.1 Embedded systems and embedded controllers

2.1.1 History

In the earliest years of computers in the 1930-40s, computers were sometimes dedicated to a single task, but were far too large and expensive for most kinds of tasks performed by embedded computers of today. Over time however, the concept of programmable controllers evolved from traditional electromechanical sequencers, via solid state devices, to the use of computer technology.


(5)

One of the first recognizably modern embedded systems was the Apollo Guidance Computer, developed by Charles Stark Draper at the MIT Instrumentation Laboratory. At the project's inception, the Apollo guidance computer was considered the riskiest item in the Apollo project as it employed the then newly developed monolithic integrated circuits to reduce the size and weight. An early mass-produced embedded system was the Autonetics D-17 guidance computer for the Minuteman missile, released in 1961. It was built from transistor logic and had a hard disk for main memory. When the Minuteman II went into production in 1966, the D-17 was replaced with a new computer that was the first high-volume use of integrated circuits. This program alone reduced prices on quad NAND gate ICs from $1000/each to $3/each, permitting their use in commercial products.

Since these early applications in the 1960s, embedded systems have come down in price and there has been a dramatic rise in processing power and functionality. The first microprocessor for example, the Intel 4004, was designed for calculators and other small systems but still required many external memory and support chips. In 1978 National Engineering Manufacturers Association released a "standard" for programmable microcontrollers, including almost any computer-based controllers, such as single board computers, numerical, and event-based controllers.

As the cost of microprocessors and microcontrollers fell it became feasible to replace expensive knob-based analog components such as potentiometers and variable capacitors with up/down buttons or knobs read out by a microprocessor even in some consumer products. By the mid-1980s, most of the common previously external system components had been integrated into the same chip as the processor and this modern form of the microcontroller allowed an even more widespread use, which by the end of the decade were the norm rather than the exception for almost all electronics devices.

The integration of microcontrollers has further increased the applications for which embedded systems are used into areas where traditionally a computer would not have been considered. A general purpose and comparatively low-cost microcontroller may often be programmed to fulfill the same role as a large number of separate


(6)

components. Although in this context an embedded system is usually more complex than a traditional solution, most of the complexity is contained within the microcontroller itself. There are very few additional components may be needed and most of the design effort is in the software. The intangible nature of software makes it much easier to prototype and test new revisions compared with the design and construction of a new circuit not using an embedded processor. [1]

An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions, [2] often with real-time computing constraints. It is usually embedded as part of a complete device including hardware and mechanical parts. In contrast, a general-purpose computer, such as a personal computer, can do many different tasks depending on programming. Since the embedded system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product, or increasing the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale.

In general, "embedded system" is not an exactly defined term, as many systems have some element of programmability. For example, Handheld computers share some elements with embedded systems such as the operating systems and microprocessors which power them but are not truly embedded systems, because they allow different applications to be loaded and peripherals to be connected.