You are on page 1of 43

A Dissertation Report on

EMBEDDED WEB SERVER DESIGN USING SINGLE BOARD COMPUTER SAM9G45 V2.0 AND APPLICATIONS
Submitted in Partial Fulfillment towards the Award of Degree of

Masters of Technology
ELECTRONICS AND COMMUNICATION ENGINEERING (COMMUNICATION SYSTEMS)

Submitted by SOLANKI KETAN M.


(Roll No.: 11PGEC022)

Guided by

Prof. Hiren K. Mewada

V. T. Patel Department of Electronics and Communication Engineering Faculty of Technology & Engineering Charotar University of Science and Technology Changa 388 421 GUJARAT
MAY 2013

A Dissertation Report on

EMBEDDED WEB SERVER DESIGN USING SINGLE BOARD COMPUTER SAM9G45 V2.0 AND APPLICATIONS
Submitted to Charotar University of Science & Technology (CHARUSAT) for Partial Fulfillment Towards the Award of Degree of

Masters of Technology
Electronics and Communication Engineering (Communication System Engineering)

Submitted by SOLANKI KETAN M.


(Roll No.: 11PGEC022)

Under the Guidance of


Prof. Hiren K. Mewada Associate Professor

V. T. Patel Department of Electronics and Communication Engineering Faculty of Technology & Engineering Charotar University of Science and Technology, Changa
DEC 2012

Certificate
This is to certify that the dissertation entitled EMBEDDED WEB SERVER USING SINGLE BOARD COMPUTER SBC-SAM9G45 V2.0 submitted by Mr. SOLANKI KETAN M. (Roll No.11PGEC022) in the fourth Semester subject EC803 - PROJECT PHASE-II , towards the partial fulfillment of the requirement for the award of the degree of MASTERS OF TECHNOLOGY (ELECTRONICS AND COMMUNICATION ENGG) in the field of COMMUNICATION SYSTEM ENGINEERING at Charotar University of Science and Technology

(CHARUSAT) is a record of the bona-fide work carried out by him under my guidance and supervision. The work submitted, in my opinion, has reached to a level required for being accepted for the examination. The matters embodied in this dissertation work, to the best of my knowledge, have not been submitted to any other University or institute for the award of any degree or diploma.

Guide:

Prof. Hiren K Mewada Associate Professor, V.T.Patel Dept of Electronics and Communication Engineering, Charotar University of Science & Technology, Changa

Prof. B. N. Shah Head, V.T.Patel Dept of Electronics and Communication Engineering Faculty of Technology & Engineering, Charotar University of Science & Technology, Changa

Dr. N. D. Shah Principal, Faculty of Technology & Engineering, Charotar University of Science & Technology, Changa

Dissertation Approval Sheet

The Dissertation entitled

EMBEDDED WEB SERVER USING SINGLE BOARD COMPUTER SBC-SAM9G45 V2.0


Submitted By SOLANKI KETAN M. (Roll No.11PGEC022)

As a partial fulfillment of the requirement for the degree of

Masters of Technology
Electronics and Communication Engineering (Communication System Engineering)
is hereby approved for the award of degree

Internal Examiner

External Examiner

Date : Place :

ACKNOWLEDGEMENT

I express my cavernous sense of obligation and gratitude to my guide Prof. Hiren K Mewada for his genuine guidance and constant encouragement throughout this project work. I am highly obliged as my honourable guide have devoted his valuable time and shared his expertise knowledge.

I pay my profound gratefulness to Shri Jaybhai Savani, Owner of Fourth Dimension Systems & Solution. Surat (Appendix B) for giving me an opportunity to carry out the project work and to provide me the fundamental resources as well as fully supportive in software and hardware development throughout the project. I must thank him for sparing his valuable time from his busy schedule.

I am also grateful for the cooperation and full mechanical support from Shri Ketanbhai Limbad, LIMBAD Sewing MachinesDhoraji (Appendix A) in designing hardware module for the demonstration of X-Y motion controlling.

I extend my sincere thanks to HOD, Department of Electronics & Communication Engineering and Dean, Faculty of Technology & Engineering, CHARUSAT for providing me such an opportunity to do my project work. I also wish to express my heartfelt appreciation to my friends, colleagues and many who have rendered their support for the successful completion of the project, both explicitly and implicitly.

SOLANKI KETAN M. (11PGEC022)

Date:

Place

ABSTRACT

Powerful microcontrollers are used as parts of most industrial and home appliances of today. Integrating web servers to these intelligent devices will aid in controlling them over the Internet and also in creating effective user interfaces in the form of web pages. Assigning multiple functionalities to a single button on a machine help manufacturers economize user interfaces, but, this can easily create confusion for the users. Since the cost of webbased interfaces is considerably low, they can be used to provide the infrastructure for the design of simple and more user-friendly interfaces for industrial machines and instruments.

Also, a web page based interface is much easier to change, when needed, as compared to a hardware interface. The main benefits of this approach include its lightweight design, automatic configuration, and, utilization of widely available and tested network.

Here In the same kind of design of embedded web server, the user interface reaches to the most reliable technique known as touch screen interface. Single Board Computer SAM9G45 provides highly reliable embedded system in industrial environment for the purpose of automation, remote data acquisition, web servers, real time management system, smart controlling, and touch screen user interface with industrial machines.

Web server is a kind of remote data acquisition using web pages and broad area of inter networks. Main task of the project is to provide easy fast and visual controlling of industrial machineries and controlling systems so as to get accuracy and precision by means of master-slave concept of processors in manufacturing and other production industries. Here I have demonstrated the concept of embedded server in terms of one of the largest growing applications i.e. Automatic Embroidery Machine Control.

ii

LIST OF FIGURES

No. 1.1 1.2 1.3 2.1 2.2 3.1 3.2 4.1 4.2 4.3 4.4 4.5 4.6 4.7

Title Basic block of Embroidery machine control Goal of thesis Nokia QT Creator Model of NC engraving machine control system Model of intelligent home control system Software Architecture Data file generated by wilcom Model of nut bolt mechanism Designed nut bolt mechanism Design of circular to linear mechanism of Y displace. GPIO connector GPIO pins layout Stepper motor driver circuit Designed stepper motor driver circuit

Page 3 5 7 10 11 13 14 16 17 17 18 19 20 21

iii

LIST OF ABBREVIATION

AHB ARM APB DSP GPIO LR MMU MPU RISC RTD RTOS SAM SBC SoC TFTP

Advanced High-performance Bus Advanced RISC Machines Advanced Peripheral Bus Digital Signal Processor General Purpose Input/output Ports Link Register Memory Management Unit Memory Protection Unit Reduced Instruction Set Computing Real Time Debug Real-Time Operating System Specialized ARM based Microcontroller Single Board Computer System-on-Chip Trivial File Transfer Protocol

iv

CONTENTS

Acknowledgement Abstract .. List of Figures List of Abbreviation ...

i ii iii iv

ORGANIZATION OF PROJECT 1. INTRODUCTION 1.1 1.2 1.3 1.4 1.5 Introduction to Embedded Web server Automatic Embroidery Machine Control Goal of Thesis and Application requirements Why to choose SAM9G45 for this project? QT Creator Embedded Tool

1 2 2 3 5 6 7

2. LITERATURE REVIEW

3. DESIGN OF SYSTEM SOFTWARE 3.1 3.2 3.3 Software Architecture Structure of data file (.DAT) file generated by WILCOM Displaying the Embroidery design on Touch LCD

13 13 14 15

4. SYSTEM HARDWARE DESIGN 4.1 4.2 4.3 Model Representation of Hardware X Y motion controlling of Stitch X and Y Stepper Motors Interface through GPIO

16 16 18 18

5. DEBUGGING AND SIMULATION RESULTS

22

CONCLUSIVE REMARKS & INNOVATIVE INCLUSIONS

26

REFERENCES APPENDIX A APPENDIX B

28 29 33

vi

ORGANIZATION OF PROJECT

Chapter.1 provides the introduction, goal of project, fundamental and basic principle of embedded web server, automatic embroidery machine control, and QT creator Embedded tool.

Chapter.2 explains the literature review of the IEEE papers which are based on ARM Linux, and applications

Chapter.3 includes the software architecture of the embedded web server , structure of data file(.dat) and displaying technique of design on touch LCD .

Chapter.4 provides details of hardware design of the system, X Y motion control of stitch, and X Y stepper motors interface with GPIO.

Chapter.5 includes the debugging of application and simulation results of the final application on embedded server.

CHAPTER1 INTRODUCTION
1.1. INTRODUCTION TO EMBEDDED WEB SERVER

General web servers, which were developed for general-purpose computers such as NT servers or UNIX and Linux workstations, typically require megabytes of memory, a fast processor, a preemptive multitasking operating system, and other resources. A web server can be embedded in a device to provide remote access to the device from a web browser. The embedded system can be utilized to serve the embedded web documents, including static and dynamic information about embedded systems, to web browsers. This type of web server is called an Embedded Web Server. An embedded web server is a microcontroller that contains an Internet software suite as well as application code for monitoring and controlling systems. Embedded web servers are integral part of an embedded network. If I fundamentally describe the principle of the embedded web server then, It states that the system which controls and calibrate the industrial sensors and its sensing data by means of web pages through fast Ethernet communication media. Here the web server is similar to that used in IT applications. The difference here is that the embedded web server uses the hardware interface by means of I/O ports to access the other peripherals in real time. The application such as real time management, remote data acquisition, user interface with machine using GUI, can be implemented on the system which can work as an standalone server. This server not only uploads the data on the server memory, but also does the below functions: Graphical User Interface with machine. Controlling of different peripheral connected with systems. Image Processing with ability of touch screen interface. Master-Slave type topology for multicore processing. Ability to connect with existing Internetwork in Industry for remote sharing Standalone application based server

1.2.

AUTOMATIC EMBROIDARY MACHINE CONTROL

Separating the X and Y direction displacements from Byte Array

B(X,Y)
Trivial File Transfer or Flash drive/ SD Card transfer

Convert Data File to Byte Array

AT91SAM9G4 5 Processor (ARM926EJ-S)

X&Y Displacement s in separate form

y x
Transfe r through GPIO

42304843 9048988f dd945943 58053059 3059309

y QT Painting Tool

Input data file from WILCOM

Stepper Motor Driver Circuits

X motor
TOUCH LCD DISPLAY

Y motor

Figure-1.1: Basic Block Diagram of Embroidery Machine Control

Here the Figure-1.1 illustrates the basic block diagram of the embedded web server implemented on automatic embroidery machine control, in which the heart of the system is Embedded Controller. The controller (here AT91SAM9G45) is used as core of the system which plays the role of Control Processing Unit, Arithmetic & Logic Calculations, etc. Embedded server is a new concept in manufacturing and automation industry to provide ease and flexibility in communication between peripherals of the machine or machine to machine data acquisition and remote login.

Now, the embroidery design is one of the most growing and upgrading technologies in industrial areas. So, it is more advantageous to implement the embedded web server concept in automatic embroidery machine control. Indeed, this would be the control system with closed loop feedback system, in which I have demonstrated the

key function of the embroidery machine i.e. X and Y displacements of stitch by means of stepper motor control through SBC-SAM9G45 board.

So, to achieve such type of goal the whole system is designed as show in Figure 1.1. Before starting the actual flow of the application, here elementary we need design file which is generated by industrial embroidery designing software WILCOM. The generated design file includes information regarding the format of the design file, the X displacement and Y displacement of stitch. The file would be hexadecimal coded.

Next step is to transfer this design file to our embedded server system for decoding the required information. Transferring media has to be faster so as to get more speed in processing the data. For this most convenient way of file transfer is TFTP i.e Trivial File Transfer, which is faster and error free file transferring protocol between embedded machines such as computers and SBCs. Another manual way of file transfer is through Flash Drive or SD Card which I have used in my system.

Once the file is received at the SBC board, the design file is converted to byte array so as to get each hex data in separate form. Array of the data consists of Function, X displacement, Y displacement consecutively. Here as per application I require only two information among these i.e. X and Y displacements. As per the design made in WILCOM, there are positive and negative displacements in both X and Y directions of 2D Plan. So, it is needed to decode the design file accordingly.

Now, the main work of the Processor as an Arithmetic & Logic Unit starts. The separated data of X and Y displacements to be decoded by SAM9G45 processor for the purpose of displaying the actual design on LCD as well as to control the X stepper motor and Y stepper motor for stitch movement. Here, the processor might face the conflict between displaying the design on LCD and controlling of motors by using same data decoded from design file. But, now we should mind well that SAM9G45 is famous in its architecture family as faster and smart ARM based Microcontroller with 5 stage of pipe lining and flexible task scheduling. So for the processor, there would not be troublesome of doing these two functions simultaneously.

1.3.

GOAL OF THESIS AND APPLICATION REQUIREMENTS

General Server room

Embedded Web Server Using SBC9G45

Figure-1.2: Goal of the Thesis

As illustrated in Figure-1.2 the idea to design embedded web server using single board computer in one way to suppress the complexity of the server room in various industries of production and manufacturing. Not only the complexity but in terms of the flexibility, reduction in modularity, accuracy and precision in industrial applications, high speed and low power consumption etc. Now, to design such an embedded server to achieve the goal of thesis, fundamentally we have to consider its application requirements. Here, I have implemented the design of embedded server in automation application i.e. automatic embroidery machine control.

For the application above, the requirement is to interface software and hardware environments together to develop the function- X Y motion control of embroidery stitch. In automation industries the famous devise for X Y motion control is digital motors nothing but Stepper Motors and more advanced Servo Motors. In this case I have taken stepper motor for programming convenience in design, to achieve the less complexity of software architecture (refer to 2.1).

Here, the application requires WILCOM embroidery designing software for data file design, System on Chip Board for controlling system, two high torque stepper motors along with high power driver circuits (TIP122). Hardware Mechanism side, by considering industrial design concept, for the X displacement requires the NUT-BOLT mechanism, and for Y displacement requires any Circular-to-Linear conversing mechanism (here I have used robotic tires).

1.4.

WHY TO CHOOSE SAM9G45 FOR THE PROJECT?

The idea of choosing the single board computer SAM9G45 V2.0 is mainly due to the flexibility in the modularity of the core board and latest low cost with smarter functionality core board in SBC family.(refer to company site in [6] for any embedded hardware or SBCs). Second feature is of GPIO programming which provides easy and fast interface with other controlling devices like stepper motor control, servo motor control, and sensor array etc. The third key advantage of using this board is nothing but its core architecture (ARM926EJ-S) itself in ARM9 family whose brief description is given below ARM926EJ-S Jazelle enhanced cached processor for OS-based platform applications: MMU to support: Symbian OS, Linux, Palm OS, and Windows CE Selectable size instruction and data caches - 4 K, 8 K, 16 K128 K Tightly coupled memories supported 0 K, 4 K, 8 K1MB Instruction and data TCM interfaces with wait state support Separate instruction and data AHB buses ETM9 interface for real-time trace with the ETM9 Macrocell 180 MHz* on TSMC 0.18 m

1.5.

QT CREATOR EMBEDDED TOOL

The Software used is QT Creator using C++ Programming with GCC Cross compilation method to generate Linux Binary application. This software works on Linux operating system Environment.

Figure-1.3: Nokia QT Creator Qt/Embedded is a famous commercial embedded GUI tool, has great cross-platform ability, can be conveniently applied in present popular OS, such as embedded Linux. Considering advantages mentioned above, this adopts it as embedded lightweight GUI component library basic construct tool oriented to industry monitoring. [1]

qmake: Used to generate Makefile for the particular project. The Makefile is nothing but scheduling file for the project with set of arguments for GCC cross compilation. Makefile: Make reads its instructions from text files. An initialization file is read first, followed by the Makefile. The initialization file holds instructions for all makes and is used to customize the operation of Make. Make automatically reads the initialization file whenever it starts up. Typically the initialization file is named make.ini and it resides in the directory of make.exe.

CHAPTER2 LITERATURE REVIEW


Embedded system has already been applied widely in automation, production, and manufacturing industries. As the size of embedded application system increases, the system becomes more and more complex [2]. Hence, in the several papers which I am going to review mainly focused on software & hardware architecture, application implementation using different kinds of microcontrollers from ARM9 family, and their relative merits and demerits in real time.

A. KEY ROLE OF SOFTWARE ARCHITECTURE IN EMBEDDED LINUX In embedded system, not only the hardware is important but also software architecture. So, a good architecture can help ensure that a system will satisfy key requirements in such areas as performance, reliability, portability, scalability, and interoperability. A bad architecture can be disastrous. Architecture design is highlevel design for overall system from the system point of view. Different experts will define software architecture on their own. After all, it is a tool to solve practical problems in various domains and contexts, thus various architectural models or definitions have been released. [2].

Now, to reduce the complexity of software architecture, it is important to avail the most appropriate tool for software development. The most famous and widely used software tool for development of software architecture is QT Embedded tool, which is open source GNU programming tool based on C and C++, and can be conveniently applied in present popular OS, such as embedded Linux. QUE can directly communicate with I/O devices. Furthermore, its system architecture oriented for object makes its code structuralized, reusable and run fast. QUE supports frame buffer driver and can directly write frame buffer without X-server or X-lib support. In this way, it saves memory cost and improves application running efficiency [2].

Secondly, the Linux kernel, Uboot, and Embedded OS also plays huge role in development of software architecture. Based on the embedded Linux kernel, root file system and embedded graphical user interface (GUI) were selected with the requirements of the system. System management interface is also supported by embedded Linux [2]. The Uboot which is specifically designed for embedded Linux system is an open source bootloader, whose task is to initialize the processor and peripheral hardware resources and to boot the operating system. This version with Kernel linux2.6.32 offer more drivers and APIs [4].

These were the elementary features supporting the architecture of software developed for particular application, now once the architecture is defined the second most important and confusing feature is task management. Task Management is also referred as task structuring or more precisely the task partition for application such as Engraving Machine Control. A task represents the execution of a sequential program or a sequential component in a concurrent program. Each task deals with one sequential thread of execution; hence no concurrency is allowed within a task. However, overall system concurrency is obtained by having multiple tasks that execute in parallel [2]. The task structuring criteria are a set of heuristics derived from experience that obtained in the design of concurrent system. The main consideration in identifying tasks is the asynchronous nature of the functions within the system. The H Gamma principles are grouped into three separate categories based on how they are used to assist in the task structuring activity [2]. The YAFFS (yet another flash file system) is adopted for root file system, which is also a kind of Log-structured file system like JFFS/JFFS2. It is specially designed for NAND Flash and suitable for mass-storage devices. YAFFS is thus designed not only to adapt to the features of NAND Flash, but also to better use the advantages of NAND Flash to reach best performance. It uses log structure, error checking correction and technique to improve NAND Flash's robustness. The advent of YAFFS makes the low cost NAND chip effective and robust. YAFFS is highly portable and can run on Linux [2].

B. APPLICATIONS IMPLEMENTED ON ARM-LINUX PLATFORM In the thesis, I am demonstrating design of the application Automatic embroidery machine control using same platform of Embedded Linux. So, different kinds of same applications designed based on Embedded Linux. I am going to review some of them which more suitable as per the goal of the thesis. These applications give the historical Idea on Embedded Linux which is already implemented using different ARM9 controllers. Numeric Control Engraving Machine

In this paper, Very first the application is developed by embedded Linux to achieve the X-Y-Z 3D planner motion control by means of interfacing ARM9 and FPGA in master-slave fashion. The basic model is shown in below Figure-2.1.

Figure-2.1: Model of NC Engraving Machine Control (Taken from [2])

The hardware of the NC engraving controller is provided with the architecture of ARM and FPGA (Field Programmable Gate Array). The master control chip of the controller adopts 32-bit RISC (Reduced Instruction Set Computer) ARM microprocessor chip S3C2440 of Samsung Company which based on ARM920T structure. It has high work efficiency up to 400MHz and many kinds of general interfaces. Furthermore, it provides on chip memory manage unit (MMU) which is used to realize virtual memory management, so as Linux can be easily ported to ARM. The Cyclone FPGA EPlC6 of Altera Company was adopted as the slave chip to lighten the burden of the master control chip. NAND Flash memory is used for non-volatile program and data storage. Main memory is synchronous dynamic random-access memory (SDRAM) and might contain anywhere from a few

10

megabytes to hundreds of megabytes depending on the application. The main processing flow of the system is described as follow: keying information of control panel is sent to ARM through serial port. ARM then process and send the corresponding control data to FPGA or display panel. FPGA is mainly doing frontend processing work of sensor and control information. The signals sent by FPGA are transformed and isolated by the adapter panel, and then are sent to the driver which will drive the stepping motor of the engraving machine so as to control the cutting tool path. Here, the task partition uses the principle of H Gamma. The task such as User Interface Task, Key board Processing Task, File Processing Task, Data processing Task, FPGA Processing Task Etc. [2]. In this paper new software architecture is proposed for NC engraving machine control, the corresponding functional modules can also be added make it suitable for different types of engraving and other planner motion controlling such as the application embroidery machine control implemented in the thesis . Intelligent Home Control System

Figure-2.2: basic model of Intelligent Home Control (Taken from [4])

In this application, as shown in Figure-2.2 system has adopted modular design based on the ARM9 processor S3C2440 as core board in Linux platform. In application design the Linux kernel using Linux 2632 version, the system completes temperature information gathering, gas detection and alarm GMT chronograph timing control functionality of the appliance with the Atmegal16 and Atmegal8 between which the wireless communication uses the 2.4G frequency NRF24LO 1 chip as control microcontroller. Eventually the information of the control system is displayed via QT

11

4.6.3 GUI interface. The system can remotely telnet the IP address to browser the camera's video stream on the web by transplanting Linux system platform and mjpgstreamer server successfully [4]. There are many advantages for the system such as clear module structure, easy operation and easy exploiting and stability. Besides it is easy to come true the remote video collection and overcome existing video capture distance problems using the existing network resources.

C. CONCLUSION By reviewing the list of papers which are based on application development using ARM9 Embedded Linux, the conclusive point is to be discussed that the software architecture is prime concern to the application for the designing of control mechanism and task management which is performed by the core processor. The each system design gives the new way towards the software and hardware architecture.

As from the NC engraving machine control the task partitioning is the key feature of the upgrading technology of embedded system. Same way from the intelligent home control system, we conclude about the real time debugging of the ARM core by interfacing different kinds of sensor arrays such as temperature collector, Gas alarm, camera, and mjpg-server etc. [4].

Same type of design technology I have implemented in this thesis using single board computer SAM9G45. Its design flow of hardware and software architecture is illustrated in consecutive chapters 3 and 4.

12

CHAPTER3 DESIGN OF SYSTEM SOFTWARE

3.1 SOFTWARE ARCHITECTURE Software Architecture


Functional Modules

User Interface

Data File Decoding Pixel Data Processing

GPIO Data Processing Task Management

Pixel Painting

Root File System (YAFFS)

QT Embedded (GUI) Embedded Linux Kernel

System Management

Flash Drive, SDRAM, USB, LCD, GPIO Ports, Etc.

Hardware Figure-3.1: Software Architecture

As discussed in section 1.3, to achieve the goal of the thesis by implementing the automatic embroidery machine control. The software architecture has to be designed for better understanding of internal processes and functions performed by core board. For the hierarchical design flows of embedded web server the above Figure-3.1 illustrates the architecture of software to be implemented on ARM using QT Embedded tool. At the software platform, the main functions dictated as fundamental modules of software. These functional modules are as per the design of automatic embroidery machine as discussed in section 1.2. Here the user interface is through the touch

13

screen LCD by means of GUI. Then the file generated in WILCOM should be decoded to record the X and Y displacement data. Next important function is to get decoded file in visual form on LCD to conform whether the right design file is there or not. For this visualization on LCD the design is painted on LCD using painting tool of QT creator. Then pixel data processing as per the design file decoded in form of Byte array. Simultaneously, same data is used in controlling the stepper motors for X and Y Linear movement. So, for that the pattern of pulses transmitted through GPIO by using GPIO data processing function. These two functions, painting and stepper motor control is managed by task management function of processor. Then the bridge between software and hardware of the system is Embedded Linux kernel linux-2.6.30, which provides the device driver interface with Flash Drive, SDRAM, USB, LCD, and GPIO ports etc. then the actual hardware is interfaced with the whole architecture for final application analysis.

3.2 STRUCTURE OF DATA FILE (.DAT) GENERATED BY WILCOM

Figure-3.2: .dat file generated by wilcom for horizontal line

Above Figure-3.2 shows the structure of data file for embroidery design, which is generated by WILCOM software. The .dat file includes the three main parts i.e. Header, Information and Footer. For our application the most important part is Information placed at each hex location in file which starts from 100H. From this

14

location the actual design information starts which is fashioned as Function, X displacement, Y displacement in three consecutive hex locations. This information continues up to the last displacement of stich recorded in WILCOM as per our design. Here in Figure-3.2, for example the design file of horizontal line is shown in which the starting of 100H location indicates the function i.e. C0H then D6H and 00H are X and Y data respectively and so on..

3.3 DISPLAYING THE EMBROIDARY DESIGN ON TOUCH LCD

As from the decoded data from the design file, the data is then converted in byte array and then each X and Y displacement data to be recorded in separate byte array including positive and negative displacement for each X and Y data. The negative displacement would be counted by using 2s complement of recorded data of X as well as Y. Then using draw line and move to function of painting tool of QT embedded, the design is then displayed on LCD screen by taking center pixel location as an origin of the design. Task structuring has to be considered in this case as the processor performs the two tasks at a time i.e. to decode the design file, to display the design according to X and Y data stored in byte array.

The QT Embedded tool provides the smart application development for GUI interface as well as graphics painting tool for the pixel painting on the LCD screen. Here the scaling of LCD screen requires as the pixel position is a positive value. So for that there is a provision in graphics tool of QT creator to scale the origin of the pixel matrix to the center of the LCD screen. Then the painting of design on LCD is more suitable for design and able to visualize the design in proper manner. The simulation results of painting the design for visualization on the LCD is discussed and shown by snap shots in Chapter 5.

The next parallel task of displaying on LCD is to display the information of X and Y displacements decoded from design file. For the same task the design file needs to be converted using 2s complement, from hex to signed integer. And then the line display tool displays the list of X and Y data (refer to chapter 5 for results) .

15

CHAPTER4 SYSTEM HARDWARE DESIGN


4.1. MODEL REPESENTATION OF HARDWARE

As discussed the model of embroidery machine control in section 1.2, the hardware design is based on the function of X and Y motion control of stitch. So, mechanical hardware is designed using nut-bolt mechanism for X displacement and circular to linear for Y displacement.

Figure-4.1: Model of Nut-Bolt mechanism for X displacement

For the X displacement the nut bolt mechanism is to be designed as shown in below Figure- 4.1. This shows the model of nut bolt mechanism used in linear sliding of X displacement. As the stepper motor rotates the screw clockwise or anticlockwise, the nut slides left to right or right to left. The stitch would be connected with the nut for designing purpose. Here for demonstration I have used pencil to draw the design. In

16

this mechanism the number of rotations should be provided to the motor is depends on the minimum displacement of nut on the screw with one full rotation. So, by considering the industrial design of nut bolt mechanism I have designed the solid pipe of metal and patterned the screw with 3-16-18 sized die. Same way nut is designed with same sized tub to match the nut-bolt mechanism. the same design is shown in below figure-4.2. Same way for Y displacement the circular motion is converted in linear motion by means of robotics tire mechanism as shown in below figure- 4.3.

Figure-4.2: designed Nut-Bolt mechanism for X displacement

Figure-4.3: designed Circular to Linear mechanism for Y displacement

17

4.2. X Y MOTION CONTROLLING OF STITCH

Now the time to interface the software architecture with hardware by means of X stepper motor and Y stepper motor as described in section 1.2. For that the mechanism of stitch control from design file generated by WILCOM need to be understand first. At this stage we have design file decoded in terms of X and Y displacements. The decoded data would be in form of number of pulses would be given to the stepper motors to rotate and accordingly gives the linear displacements (section 4.2). The displacements are either positive or negative from current position of the stitch, hence accordingly we have to pulse the motor clock wise or anticlockwise. The pulses to the stepper motor are transmitted by GPIO which is discussed in next section. Here the most important task is sync between X and Y displacement when design has both the displacement simultaneously. For this the pulses should be transmitted to the stepper motors such that design is drawn with minimum error.

4.3. X AND Y STEPPER MOTOR INTERFACE THROUGH GPIO

The controlling of stepper motor is performed by GPIO port of the SAM9G45. There are two stepper motors for X and Y displacements. Now the interface is as shown below by describing the GPIO port with its pin diagram. GPIO is the abbreviated form of General Purpose Input Output. The SBC-SAM9G45 has a 2 x 5Pin 2.54mm spaced GPIO interface, i.e. J1.

Figure- 4.4: GPIO connector in SBC-SAM9G45 Board

18

Figure- 4.5: GPIO pins in SBC-SAM9G45 Board

The figure-4.3 above is the schematic representation of GPIO pins and their signal address with processor AT91SAM9G45. Pin 1 2 3 4 5 6 7 8 9 10 Signal PA25_IO1 PA26_IO2 PA27_IO3 PA28_IO4 PA29_IO5 PA30_IO6 PD31_PWM PD27_ADC GND VDD (3.3V) Define in Linux AT91_PIN_PA25 AT91_PIN_PA26 AT91_PIN_PA27 AT91_PIN_PA28 AT91_PIN_PA29 AT91_PIN_PA30 AT91_PIN_PD31 AT91_PIN_PD27

Now among these pins the eight pins 1-8 are used for stepper motor control i.e. PA25 to PA28 for X motor, and PA29 to PD27 for Y motor. The two motor is then controlled by four bit pattern coming from these IO pins from the software architecture as per the design file data coming from WILCOM.

19

STEPPER MOTOR DRIVER CIRCUIT

Here the motors used are bipolar permanent magnet stepper motors, which are driven by the TIP122 driver circuit shown below. The TIP122 is a switching transistor with high power capabilities and can drive the stepper motors with high torque up 5Kgcm.

Figure- 4.6: Stepper Motor Driver using TIP122

The above circuit only demonstrates the driver circuit actually used in my hardware. The four control signals connect to four pins of the GPIO port then the each signal go through the TIP122 transistor to supply the high precision logics to all four coils of the stepper motor. The advantages of using the TIP122 over other drivers such as ULN2003 is high current driving circuit, provides the faster response in case of weak signal from the processor to pulse the motor. Here, as from above figure diodes 1N4007 at other side is not required by the design aspects. Because the logical signal is directly coming from the SBCs GPIO pins which need not to use this type of clipping. Now, from each four pairs of the GPIO pins the logic transmits as per below fashion:: Clockwise Rotation: CH - 9H - 3H - 6H. Anticlockwise Rotation: 6H - 3H - 9H - CH. This pattern is actually transmitted in binary, like 1100, 1001, 0011, and 0110. Reason is the clear that the GPIO pins are bit addressable and cannot used as combined 8 bit data transfer. This pattern drives the motor with high torque stepping.

20

High Torque Stepping - high power / precision mode turns ON two coils on at a time. 48 pulses are needed to complete one revolution. Each pulse moves rotor by 1.8 degrees. The Pulse Sequence to be given to stepper motor: Pulse Coil a1 Coil b1 Coil a2 Coil b2 ON ON 1 ON ON 2 ON ON 3 ON ON 4 Table-4.1

Now this pattern is transmitted from the each four GPIO ports for each motor. Based on the data taken from design file the above sequence of pulses needs to be applied or repeated as required. The stepper motor is working on 24V operating potential. And hence an extra supply needs to be provided to driver circuitry. Because the SAM9G45 board output is only 3.3V which is not sufficient to drive the motor. Before doing so, we have gone through the GPIO testing mode by sending the bit pattern manually.

The designed driver circuit is as shown in figure below:

Figure- 4.7: designed Stepper Motor Driver circuit using TIP122

21

CHAPTER5 DEBUGGING AND SIMULATION RESULTS


The calibration is such an important task of any embedded system to achieve the practical results of the system tending to ideal ones. Now the debugging of the application developed is as following snapshots. 1. Drawing a Horizontal Line:

Snapshot-1: data of horizontal line

Snapshot-2: horizontal line displayed on LCD screen

Here the above two snapshots gives the simulation result of horizontal line designed by WILCOM, then decoded in embedded server. First snapshot shows the list of X and Y displacement details to draw the horizontal line. The + sign indicates the positive displacement of the stitch.

22

2. Drawing a Vertical Line:

Snapshot-3: data of vertical line

Snapshot-4: vertical line displayed on LCD screen

Same as horizontal line the above snapshots 3 and 4 give the simulated results of vertical line, in which the list of X and Y displacements is displayed. The next snapshot is of vertical line graphically displayed on the LCD screen by means of painting tool of QT Creator

Now next is to design the pattern which has X and Y displacements simultaneously. So next results are taken for triangle which is challenging among above two design.

23

3. Drawing a Triangle:

Snapshot-5: X and Y data of triangle

Snapshot-6: triangle displayed on LCD

In case of triangle, now we have the both information of X and Y displacements simultaneously. So, the painting tool moves the line according to the both displacements details. The simulation results shown above are approximately identical designs with the designs actually drawn in WILCOM design software.

24

REAL TIME RESULTS TAKEN FROM HARDWARE

1. HORIZONTAL LINE

2. VERTICAL LINE

3. TRIANGLE

25

CONCLUSIVE REMARKS AND INNOVATIVE INCLUSION

CONCLUSIVE REMARKS

By working with the project, the project goals set were accomplished successfully. The implemented application has achieved as in the future scope we shall mention the capabilities and provide the project the much needed advancements which will make it possibly an industry acceptable solution. The designed hardware gives the design in real-time with moderate precision and accuracy.

Use of embedded control system based on ARM kernel not only reduces peripheral devices for the system and improves reliability of the system, but also realizes accurate control over controlled parameters as Automatic Embroidery machine control strategy is employed. Additionally, transplantation of Linux OS greatly facilitates programming, shortens development period of software and improves development efficiency. As practical experience shows, by introducing the control system into the environmental parameter control for X and Y motion control of stitch, the system can meet the overall performance requirements and produce a good control effect.

The QT embedded tool has provided the huge platform to develop the application of embroidery machine control. Due to its capability of GUI frame work on C and C++ programming the labor while developing the application became greatly reduced.

26

INNOVATIVE INCLUSIONS

A. FUTURE SCOPE The future scope of the embedded web server that we can develop this application on internet as web pages and through the internet we can remotely log in to the server. This hardware can also be interfaced with the fast Ethernet by means of master slave concept with other devices as shown in below figure.

Figure- X: The ARM used as Embedded Web Server (taken as reference from webserver application) With the tremendous capability of this SBC board in GUI, this system will provide easy and fast data acquisition and remote login when connected with the internetwork. B. SUGGESTIONS

While working with the hardware of the X Y motion control using stepper motors, we faced the issue of isolation between GPIO ports of SBC board and driver circuit of stepper motor. This is not the serious issue with the ARM processor, because the current design of hardware is demonstration of the application hence the power load on the controlling circuitry is not that much excessive. But her I would like to suggest that we should use isolation between core boards GPIO ports and external peripherals or circuitry. Hence each pins whenever used as GPIO from Single Board Computer like SAM9G45, they has to be isolated by using opto-coupler PC817. This IC will strictly isolate the soft embedded device from external hardware from damaging of processor or any of its function.

27

REFERENCES

[1] Dalheimer M K, Hansen S, Embedded development with QT embedded, Dr.


Dobb's Journal, vol. 27, no. 3, pp. 48-53, 2002.

[2] Junqi Zhao, Hui Li and Longfei Peng, Design of Software Architecture for NC Engraving Machine Based on Embedded Linux, The 2009 IEEE, pp.28942899, Aug 2009.

[3] Chun-yue Bi, Yun-peng Liu, Ren-fang Wang, Research of Key Technologies for Embedded Linux Based on ARM, International Conference on Computer
Application and System Modeling 2010, pp.V8-373 to V8-377, IEEE 2009.

[4] Ping Li, Jian-Ping Li, Embedded Intelligent Home Control System Based on ARM-Linux, University of Electronic science and Technology of China, pp.429-431,
IEEE 2012.

[5] Samuel Ramrajkar, Mehul Shah, Nishant Parekh, Single Board Computer for Application Multitasking, International Journal of Engineering and Innovative
Technology (IJEIT) Vol.2, Issue 6, December 2012.

[6] CoreWind Technology Co. Limited. Hong Kong, http://www.armdevs.com

28

APPENDIX A

Getting Started with SAM9G45


So as just received the SBC-SAM9G45 board and won wondering where to start... This is the right way to get going.

Required Accessories:

One SBC-SAM9G45 Board One LCD Module (4.3"LCD or 7"LCD) One Serial cable One net cable One 12V@2A Power adapter One DVD Hyper terminal interface with computer:

1) Find DNW software under directory CD:\Tools\DNW.exe. Double-click to open it: 2) Click Configuration -> Options, it will open the UART/USB Options dialog. choose '115200' in 'Baud Rate' choose 'COM1' in 'COM Port '(the COM1 means the serial number in PC ) 3) click 'OK' to finish the DNW configuration: 4) Click 'Serial Port->connect' to enable the DNW serial link. Power on the board, then you can enter the Linux system by the HyperTerminal on PC default. Enter the QT system

Boot the board to enter the Linux system command mode in the terminal, then run the follow command to calibrate the touchscreen: # ts_calibrate # ts_test We provide qt 4.6.3 lib on the board, if you want to test it, you can copy the qt demo from CD to the board, and run the follow command to test it. # ./xxxx -qws Then you will see the qt demo system in the picture.

29

Now the Project building settings in QT creator: Config: Release Qt version: Qt Embedded 4.6.3 Tool Chain: GCC

Project building steps in Qt creator: Qmake: qmake xxx.pro r spec qws/linux-arm-g++ Make: make w in build directory

Cleaning step: make clean w in build directory

Now to run the project on the SBC hardware the command has to be written as : [root dir]# ./xxxx qws

For Linux System Update go to uboot terminal and then insert the USB drive with rootfs file and uImage then follow the below steps: Uboot> usbloader Uboot> run program_kernal_usb Uboot> run_program_rootfs_usb

Hence finally we can get the updated Linux as modified by our self of any other new OS we need to install on the same hardware. To develop the applications based on same hardware or other similar hardware please refer to [6]. Now next shown the demo project developed in QT Embedded Tool.
30

DEMO PROJECT: #include <QtGui> #include "calculator.h" #include "button.h" #include "imagecomposer.h" static const QSize resultSize(200, 200); ImageComposer::ImageComposer() { this->setContextMenuPolicy(Qt::NoContextMenu); sourceButton = new QToolButton; sourceButton->setIconSize(resultSize); operatorComboBox = new QComboBox; addOp(QPainter::CompositionMode_SourceOver, tr("SourceOver")); addOp(QPainter::CompositionMode_DestinationOver, tr("DestinationOver")); addOp(QPainter::CompositionMode_Clear, tr("Clear")); addOp(QPainter::CompositionMode_Source, tr("Source")); addOp(QPainter::CompositionMode_Destination, tr("Destination")); addOp(QPainter::CompositionMode_SourceIn, tr("SourceIn")); addOp(QPainter::CompositionMode_DestinationIn, tr("DestinationIn")); addOp(QPainter::CompositionMode_SourceOut, tr("SourceOut")); addOp(QPainter::CompositionMode_DestinationOut, tr("DestinationOut")); addOp(QPainter::CompositionMode_SourceAtop, tr("SourceAtop")); addOp(QPainter::CompositionMode_DestinationAtop, tr("DestinationAtop")); addOp(QPainter::CompositionMode_Xor, tr("Xor")); addOp(QPainter::CompositionMode_Plus, tr("Plus")); addOp(QPainter::CompositionMode_Multiply, tr("Multiply")); addOp(QPainter::CompositionMode_Screen, tr("Screen")); addOp(QPainter::CompositionMode_Overlay, tr("Overlay")); addOp(QPainter::CompositionMode_Darken, tr("Darken")); addOp(QPainter::CompositionMode_Lighten, tr("Lighten")); addOp(QPainter::CompositionMode_ColorDodge, tr("ColorDodge")); addOp(QPainter::CompositionMode_ColorBurn, tr("ColorBurn")); addOp(QPainter::CompositionMode_HardLight, tr("HardLight")); addOp(QPainter::CompositionMode_SoftLight, tr("SoftLight")); addOp(QPainter::CompositionMode_Difference, tr("Difference")); addOp(QPainter::CompositionMode_Exclusion, tr("Exclusion")); destinationButton = new QToolButton; destinationButton->setIconSize(resultSize); Button *equalButton = createButton(tr("LOGOUT"), SLOT(equalclicked())); equalLabel = new QLabel(tr("=")); resultLabel = new QLabel; resultLabel->setMinimumWidth(resultSize.width());
31

connect(sourceButton, SIGNAL(clicked()), this, SLOT(chooseSource())); connect(operatorComboBox, SIGNAL(activated(int)), this, SLOT(recalculateResult())); connect(destinationButton, SIGNAL(clicked()), this, SLOT(chooseDestination())); QGridLayout *mainLayout = new QGridLayout; mainLayout->addWidget(sourceButton, 0, 0, 3, 1); mainLayout->addWidget(operatorComboBox, 1, 1); mainLayout->addWidget(destinationButton, 0, 2, 3, 1); mainLayout->addWidget(equalLabel, 1, 3); mainLayout->addWidget(resultLabel, 0, 4, 3, 1); mainLayout->addWidget(equalButton, 2, 1); mainLayout->setSizeConstraint(QLayout::SetFixedSize); setLayout(mainLayout); resultImage = QImage(resultSize, QImage::Format_ARGB32_Premultiplied); loadImage(":/images/butterfly.png", &sourceImage, sourceButton); loadImage(":/images/checker.png", &destinationImage, destinationButton); setWindowTitle(tr("Image Composition")); setWindowIcon(QIcon(":/citc1.jpg"));

Button *button = new Button(text); connect(button, SIGNAL(clicked()), this, member); return button; } SIMULATED RESULT:

Snapshot- A.1 simulation result of demo project image composition


32

APPENDIX B

Company Profile

A. FOURTH DIMENTION INNOVATION


Owner: JAYBHAI SAVANI The company is situated in khodiyarnagar area of Surat, The company has established their business since 2008. With leading the innovative ideas towards the embedded technology. They are specially working on the servomotor control, stepper motor control at industrial area such as stiffly machine of embroidery industries nearby Surat and Bombay. They also provides the hardware and software solutions in automation, manufacturing and production industries.

B. LIMBAD SEWING MACHINES AND SALES EGENCY


Owner: LIMBAD and SONS The company is situated in main bazar of Dhoraji, They are mainly assembles the different kinds of sewing machines by their own and exports to many areas of Gujarat as well as whole India. They are famous for the soft mechanical work in their workshop of assembling and designing the new tools and techniques. Now they have also started the assembling of mini embroidery machines for domestic use.

33

You might also like