You are on page 1of 125

MINISTRY OF EDUCATION AND TRAINING

FPT UNIVERSITY
Capstone Project Document
Wireless Module and Applications
DIGISKY GROUP
Thi Thanh Tng 00668 TungTT00668 Trn Xun t 00607 DatTX00607

Group Members

Bi Vn Thi 00714 ThaiBV00714 Nguyn B Thun 00701 ThuanNB00701 Trn Hi Linh 00312 LinhTH00312 Nguyn Anh Qun 00663 QuanNA00663

Supervisor Dr. Phan Duy Hng Project code WMA

Hanoi, August/2011

Table of Contents

Contents
INTRODUCTION...................................................................................................................................... 4
1.1. 1.2. The Group ................................................................................................................................................. 5 The Idea .................................................................................................................................................... 5

1.3. Business Aspects ....................................................................................................................................... 6 1.3.1. Business Outline ......................................................................................................................................6 1.3.2. Limitations of existing system ..................................................................................................................6 1.3.3. Improvement objectives ..........................................................................................................................6 1.3.4. Benefits of expected system ....................................................................................................................6

PROJECT MANAGEMENT ..................................................................................................................... 8


2.1 Problem Definition .................................................................................................................................... 9 2.1.1 Name of this Capstone Project.....................................................................................................................9 2.1.2 Problem Abstraction ....................................................................................................................................9 2.1.3 Project Review .............................................................................................................................................9 2.2. Project Organization ............................................................................................................................... 10 2.2.1. Development Process ............................................................................................................................10 2.2.2. Roles and Responsibilities ......................................................................................................................11 2.2.3. Tools and Technique ..............................................................................................................................11 2.3. Project Management Plan ....................................................................................................................... 12 2.3.1. Tasks ......................................................................................................................................................12 2.3.2. Task Sheet: Assignments and Timetable ...............................................................................................14

REQUIREMENTS ................................................................................................................................... 18
3.1 User Requirement Specification .............................................................................................................. 19 3.1.1 User Requirement ......................................................................................................................................19 3.1.2 Content editor requirement.......................................................................................................................19 3.1.3 Led Board Controller requirement .............................................................................................................19 3.2 System Requirement Specification .......................................................................................................... 20 3.2.1 External Interface Requirements ...............................................................................................................20 3.2.2 System Features .........................................................................................................................................23

IMPLEMENTATION.............................................................................................................................. 66
4.1 System Architecture ................................................................................................................................ 67

Wireless Module and Applications

4.1.1 4.1.2 4.1.3

Proposed System Architecture ...................................................................................................................67 System Interfaces .......................................................................................................................................68 Component Diagram ..................................................................................................................................69

4.2 Detailed Description of Components ....................................................................................................... 70 4.2.1 System Class & Block Diagram ...................................................................................................................70 4.2.2 System Sequence Diagram .........................................................................................................................74 4.3 Analysis and selection of tools, devices ................................................................................................... 95 4.3.1 Devices .......................................................................................................................................................95 4.3.2 Tools ...........................................................................................................................................................96 4.4 Circuit Design .......................................................................................................................................... 97 4.4.1 Wireless Module Evolution Board ..............................................................................................................97 4.4.2 Controller Board .......................................................................................................................................100 4.5 Interface Design .................................................................................................................................... 101 4.5.1 PC Commander ........................................................................................................................................101 4.5.2 Mobile Commander .................................................................................................................................103 4.5.3 GPRS Server ..............................................................................................................................................108 4.5.4 GPS Client .................................................................................................................................................109 4.6 Database Design .................................................................................................................................... 110 4.6.1 Mobile Commander DB Design ................................................................................................................110 4.7 Protocol Design ..................................................................................................................................... 111 4.7.1 Wireless Module Message Format (WMMF) ...........................................................................................111 4.7.2 Wireless Module Communication Protocol (WMMC) .............................................................................114

RESULTS .............................................................................................................................................. 120


5.1 5.2 5.3 5.4 Achievements ....................................................................................................................................... 121 Risk/limitations of the system ............................................................................................................... 121 Strategies or solution for reducing limitations ...................................................................................... 121 Perspectives ...................................................................................................Error! Bookmark not defined.

CONCLUSIONS .................................................................................................................................... 122 APPENDIX............................................................................................................................................ 124

Introduction

Wireless Module and Applications

1.1. The Group


We chose the name Digisky for our group, which came from an idea of digitalizing the life with the help of technologies. Digisky group has 6 members. Roles and responsibilities of each are in the following table: No Full Name 1 2 3 4 5 6 Thi Thanh Tng Trn Xun t Bi Vn Thi Nguyn B Thun Nguyn Anh Qun Trn Hi Linh Roll Number 00668 00607 00714 00701 00663 00312 Role Leader Member Member Member Member Member Responsibilitiy Manage Project, Develop, Test PTL, Develop, Test Develop, Test Develop, Test Develop, Test Develop, Test

1.2. The Idea


Nowadays, wireless has become one of the most important factors in almost every field of technologies. It exists in everything that we can think of. Wireless encompasses various types of fixed, mobile, cellular telephones, laptop, and wireless networking, so its applications are extremely huge, especially in the areas of communicating and transmitting. The idea came when we questioned ourselves about the capabilities of wireless, how it improves things. We decided to make a device that includes some wireless components such as WIFI/GPS/GSM and develop applications based on that device. Those applications are: Led message board controlling over WIFI/GSM Traditional led message board requires operator to change board message manually and it takes a lot of time when the board is hang on wall or bound to the wall. So we are going to make it easier by using a laptop or a mobile phone to control, manipulate its content over WIFI or SMS. GPS locator We will develop a GPS locating software on pc/mobile for tracking purpose. This application is actually very useful. It can be used for tracking stolen things or simply used by parents who want to monitor their children.

Table of Contents

1.3. Business Aspects


1.3.1. Business Outline
Our main business is to create a device that is capable of communicating with other devices such as PC, Laptop, mobile phones over wireless signals. The device is built based on wireless components (WIFI module, GPS/GPRS/GSM module), microcontroller and some other miscellaneous parts. The applications of this device can be extremely huge and we are going to make applications that can best express the devices functions.

1.3.2. Limitations of existing system


Have limited or only one function/module. Inflexible LED changing solution.

1.3.3. Improvement objectives


Well-developed software interface. Well-developed hardware package. Optimization in size, quality, durability.

1.3.4. Benefits of expected system


Provide a multi-purpose device that can be used or integrated with other devices such as computer, mobile phone Be able to be mass produced and to sell the products/solution to customers.

Wireless Module and Applications

Project Management

Wireless Module and Applications

2.1

Problem Definition

2.1.1 Name of this Capstone Project


The name of this project is Wireless Module and Applications (or WMA in abbreviation). The main purpose of this project is all in its name: to develop an electronic board that includes wireless components and to make applications base of that board.

2.1.2 Problem Abstraction


We, as a group of students, realized that in the future, everything will be wireless. It is the essence of the evolution of technologies. We all want the technologies powerful, comfortable, and portable and even more. The Wireless has them all, and many other great properties. In Vietnam, wireless has been applied in many fields such as telecommunications, wireless networking, wireless controlling But the potentiality of wireless is still enormous. The applications of it can be used in communicating, controlling and many other things that we can think of. A lot of works that we have to do manually can be done extremely quickly and automatically with the help of wireless controlling. On the other hand, wireless makes wired device less interesting: Who wants to use cord-and-string devices compare to a delicate and portable wireless device? So we decided to do this project in order to create a general solution for those kinds of applications. The project has two main parts: the hardware is a electronic board that includes a microcontroller, wireless components and is made for general purpose, the software is the applications we make for the board: controlling led message board over GSM and GPS locator. The project has no customer, but we expect once the project is finished, we can sell its applications as solutions or completed products. When finished, the product must have following properties: Be able to compatible with other devices. Can be manipulated for any purposes. Have a good quality, durability. Can be mass produced (Optional).

2.1.3 Project Review


2.1.3.1 The Current System We make the circuit board independently, so there is no current system. But there are several solutions provided in the market for controlling led message board using WIFI. 2.1.3.2 The Proposed System The proposed system involves two main components: Hardware includes microcontroller, GSM/GPS module and Led message board.

Project Management

10

Software includes PC and mobile applications.

The hardware interface can be compatible with any GSM or WIFI (Optional) device. Users can use the device for any purpose. The software part is actually applications that are built upon the hardware to demonstrate its function. The application is controlling LED message board over SMS. Any user can modify the LED board content from distance using the application. Another application of the device is GPS locator: the mobile phone software will show the position of the LED board on map. An option that we consider is controlling the LED board over WIFI, but this option will depends on the project status. 2.1.3.3 Boundaries of the system The boundaries of the system under-developed include: A complete circuit board Completed LED board controlling solution. GPS locating solution.

2.2. Project Organization


2.2.1. Development Process
Since the system involves both software and hardware components, we decided to use the incremental model of software development process to apply to our development process. The model is modified so that it can meet the needs that both software and hardware are being designed in parallel.

Figure 2-1: Incremental development process

11

Wireless Module and Applications

2.2.2. Roles and Responsibilities


No 1 Full name Thi Thanh Tng Role Project Manager, Developer Responsibilities Managing Creating documents Coding Testing 2 Trn Xun t Project Technical Leader, Developer Managing documents. Coding Testing 3 Bi Vn Thi Developer, Business Analyst Coding Requirement Elicitation, Clarifying. Testing 4 Nguyn B Thun Developer, Quality Coding Assurance Creating Test Plan, Test Case Testing 5 Nguyn Anh Qun Developer, designer Designing Coding Testing 6 Trn Hi Linh Developer, Designer Designing Coding Testing

2.2.3. Tools and Technique


Microcontroller programming tool: MPLAB IDE, CCS Emulation tool: Proteus Printed circuit design tool: Altium Mobile Phone Application development tool: Eclipse IDE/ Android 2.2 PC Software development tool: Microsoft Visual C#

Project Management

12

2.3. Project Management Plan


2.3.1. Tasks
2.3.1.1. Project Kick-off

Description Officially start the project. Forming the team and appoint members to the team. Deliverables Project Charter Resources Needed All team members and Supervisor / 1 day Dependencies and Constraints N/A Risks N/A 2.3.1.2. Create System Requirements Specification

Description Create System requirements specification (Hardware/Software) Deliverables System Requirement Specification (SRS) document Resources Needed All team members/ 1 week Dependencies and Constraints N/A Risks Conflicted requirements from all team members 2.3.1.3. Circuit Designing and Making

Description Design the circuit and hire a company for making it Deliverables Printed circuit design & the electronic board Resources Needed All team member for 1 week

13

Wireless Module and Applications

Dependencies and Constraints SRS document Risks The welded circuit may not operate well as the intended design 2.3.1.4. Create Software Design Description

Description Design the software system Deliverables Software Design Description Resources Needed 6 people/1 week Dependencies and Constraints SRS document Risks Designing the software relies so much in the hardware design, so the designed software system may not be able to adapt to the hardware system. 2.3.1.5. Coding

Description Implement the software system based on the design document Deliverables PC/Mobile/embedded applications & source codes Resources Needed 6 people/6 weeks Dependencies and Constraints SRS, SDD document, Circuit board Risks 2.3.1.6. Lacking of requirements. Testing applications of embedded system may cause many problems. Hardware does not operate well as intended design. System Test

Description Perform system test for the system

Project Management

14

Deliverables System Test Document Resources Needed 6 people/ 1 week Dependencies and Constraints Task 2.3.1.5 is finished. Risks 2.3.1.7. Lack of experience in testing embedded system. Developers are also testers so it could cause lacking of test cases. Closing Project

Description Officially close the project. Deliverables Lesson learned document Resources Needed All team member/ 1 day Dependencies and Constraints Task 2.3.1.6 is finished Risks None

2.3.2. Task Sheet: Assignments and Timetable


No Task Name Duration Start Finish Predecessors Resource Names

1 2 3 4 5 6

WIA Project Initiating Register Capstone Project Kick-off Meeting Planning Develop Project Plan

60 days 1 day 0 days 1 day 2 days 2 days

Mon 5/9/11 Mon 5/9/11 Mon 5/9/11 Mon 5/9/11 Tue 5/10/11 Tue

Fri 8/5/11 Mon 5/9/11 Mon 5/9/11 Mon 5/9/11 Wed 5/11/11 Wed 4 TungTT TungTT DIGISKY TEAM

15

Wireless Module and Applications

5/10/11 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Plan Approved Executing Definition Stage 0 days 55 days 8 days Wed 5/11/11 Thu 5/12/11 Thu 5/12/11 Thu 5/12/11 Fri 5/20/11 Mon 5/23/11 Tue 5/24/11 Tue 5/24/11 Fri 5/27/11 Tue 6/7/11 Wed 6/8/11 Wed 6/8/11 Wed 6/8/11 Fri 7/22/11 Mon 7/25/11 Mon 7/25/11 Wed 7/27/11 Wed 8/3/11 Wed 8/3/11

5/11/11 Wed 5/11/11 Wed 8/3/11 Mon 5/23/11 Thu 5/19/11 Mon 5/23/11 Mon 5/23/11 Tue 6/7/11 Thu 5/26/11 Tue 6/7/11 Tue 6/7/11 Fri 7/22/11 Thu 6/16/11 Fri 7/22/11 Fri 7/22/11 Wed 8/3/11 Tue 7/26/11 Tue 8/2/11 Wed 8/3/11 Wed 8/3/11 20 22 23 24 ThUANNB DIGISKY TEAM ThUANNB,LinhTH 16 16 18,19 ThaiBV DIGISKY TEAM 11 14 14,15 DIGISKY TEAM DIGISKY TEAM 7 10 11 DIGISKY TEAM TungTT,DATTX 6 DIGISKY TEAM

Brainstorming Requirements 6 days Writing System Requirement 2 days Specification (SRS) SRS Completed Solution Stage Circuit Design Create Software Design Description Design completed Implementation Order circuit board Coding 0 days 11 days 3 days 8 days 0 days 28 days 7 days 28 days

Implementation Completed 0 days Testing Writnig System Test Case Executing Test Create System Test Document System Test Completed 8 days 2 days 5 days 1 day 0 days

Project Management

16

26 27 28

Closing Conducting Project Postmortem Closing Project

2 days 1 day 1 day

Thu 8/4/11 Thu 8/4/11

Fri 8/5/11 Thu 8/4/11 25 DIGISKY TEAM

Fri 8/5/11 Fri 8/5/11 27

17

Wireless Module and Applications

Requirements

18

19

Wireless Module and Applications

3.1

User Requirement Specification


User can use PC to control the central controller via RS232. User can use PC to control the central controller via GSM/GPS module. User can use Mobile Phone to control the central controller via GSM network. User can use PC software to input text for manipulating led board content. User can use PC software to input image for manipulating led board content. User can use Mobile software to input text for manipulating led board content. Users can use pc software to add/remove/apply effects to the led board content. Users can use mobile software to add/remove/apply effects to the led board content. User can save/load led board configuration on pc software. User can save/load led board configuration on mobile software. User can see the GPS module position using a map on pc software. User can see the GPS module position using a map on mobile software. User can manage device list using pc software. User can manage device list using mobile software. User can choose whether the device will response to the commander or not. User can change the physical connection from RS232 to GSM/GPS or vice versa.

3.1.1 User Requirement

3.1.2 Content editor requirement


Allows change led board size/colors. Allows changing message font/size/position. Be able to convert image (color, grayscale) to binary image. Be able to apply effects to the content. Be able to convert led board content to corresponding hex code.

3.1.3 Led Board Controller requirement


Well designed to be minimized in size/cost and maximized in quality. Compatible with other GSM/GPS module interface. Has long durability in a constant period of time.

Requirements

20

3.2

System Requirement Specification

3.2.1 External Interface Requirements


3.2.1.1 User Interfaces 3.2.1.1.1 PC Commander

Main Screen of PC Commander Program

Figure 3-1: Draft main screen of PC Commander

21

Wireless Module and Applications

The Locating tool User can use this tool to keep track of LED boards positions.

Figure 3-2: Draft screen of locating tool 3.2.1.1.2 Mobile Commander The Mobile Commander helps users locating the led board devices and inputting text message, as well as adding effects to the text.

Figure 3-3: Draft screen of Mobile commander

Requirements

22

3.2.1.2 Hardware Interfaces The PC Commander communicates with the central controller via RS232 or using a GSM/GPS Module. The Central Controller communicates with the GSM/GPS Module and the led message board via RS232. The Mobile Phone Commander and GSM/GPS modules communicate with the central controller via GSM/GPS network.

Figure 3-4: Hardware Interface 3.2.1.3 Software Interface WMA consists of three components: The PC Commander software will be built using C# on Microsoft Visual Studio .NET framework. The Mobile Commander software will be built using Android framework with Eclipse IDE tool. The Embedded software lies on the microcontroller inside the central controller will be built using c/c++ on MPLab IDE of Microchip. 3.2.1.4 Communications Protocol PC commander and Central Controller control the GSM/GPS Module via AT Command Set. GSM/GPS Module and Mobile Phone communicates via GSM/GPS communication Protocols. PC Commander, mobile commander and GPRS Server communicates via TCP/IP over the Internet.

23

Wireless Module and Applications

3.2.2 System Features


3.2.2.1 PC Commander 3.2.2.1.1 Overall Diagram

PC commader
Connect

uses Manage LED's list uses uses uses uses uses Manage a specific LED

Users

Prepare display content to send

Load/Save configurations

Use GPS communication

USE CASE-1 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User Summary: UC0001 Use-case Version <1.0>

Connect PC commander to board ThuanNB 27/05/2011 Priority Normal

Requirements

24

Goal: -

Connect PC commander to board.

Connect PC commander to board

Triggers User starts PC Commander and chooses a communication option

Preconditions: PC Commander is started successfully

Post Conditions: N/A Main Success Scenario: A successful message box appears

Alternative Scenario: An error message box appears to remind user to try again

Exceptions: Connection is successful but is interrupted while user is using PC commander

Relationships: <> Business Rules: N/A

25

Wireless Module and Applications

3.2.2.1.2

Manage LED list Diagram

PC commader
View All LED list uses

uses Manage LED list Users

uses Add new

uses

Delete

USE CASE-2 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User Summary: Goal: View a selected Leds display content UC0002 View LED ThuanNB 27/05/2011 Priority Normal Use-case Version <1.0>

Requirements

26

Check a selected Leds display content before updating it

Triggers User starts PC Commander User selects a communication option User selects a specific LED from LED list

Preconditions: PC Commander is started successfully Connection is OK LED list is not empty

Post Conditions: N/A Main Success Scenario: Display LEDs content

Alternative Scenario: An error message box appears due to network problem

Exceptions: No LED is selected

Relationships: US1 Business Rules: N/A

USE CASE-3 SPECIFICATION Use-case No. Use-case Name UC003 Add new device to device list Use-case Version <1.0>

27

Wireless Module and Applications

Author Date Actor: User Summary:

DatTX 27/05/2011 Priority Normal

After showing all the device list to the user, PC commander allows user to add new device to the device list Goal: Allow user to add new device, extends out system. Triggers The user start PC Commander User chose manage devices option in menu User chose add new device in option menu

Preconditions: N/A Post Conditions: A new input form is show to the user Add the new device to the database

Main Success Scenario: PC commander show the input form to user User must put the mobile number for new device, position can be null When user finish the input process, new device data will be add to the database New update request can be send if user want to update the position of the device immediately

Alternative Scenario: None Exceptions: Adding new data to database error

Requirements

28

Relationships: UC004 Business Rules: N/A

USE CASE-4 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User Summary: After showing all the device list to the user, PC commander allow user to remove specific devices from the device list Goal: Allow user to remove devices, reduce out system. Triggers The user start PC Commander User chose manage devices option in menu User chose remove device in option menu UC004 Use-case Version <1.0>

Remove a device from device list DatTX 27/05/2011 Priority Normal

Preconditions: N/A Post Conditions: A new input form is show to the user

29

Wireless Module and Applications

Remove selected devices from the database

Main Success Scenario: User can chose multiple devices to remove When user finish the process, all selected devices will be remove from database

Alternative Scenario: None Exceptions: Remove data from database error

Relationships: UC004 Business Rules: N/A

Requirements

30

3.2.2.1.3

Manage a selected LED

PC commader

View a selected LED's display content uses

uses

Manage a specific LED

uses Clear the selected LED's display content

Users uses

Update the selected LEd's display content

USE CASE-05 SPECIFICATION Use-case No. Use-case Name Author Date Actor: UC0005 View the device list DatTX 27/05/2011 Priority Normal Use-case Version <1.0>

31

Wireless Module and Applications

User Summary: After user start PC Commander, user want to show the device list and manage it Goal: Show user where all of the devices are in a list view with some control. Triggers The user start PC Commander User choose manage device in main menu

Preconditions: The device list is loaded before

Post Conditions: All device with its attribute contains: position(longitude, latitude), mobile number will be show in a list view

Main Success Scenario: PC commander load the device list from database PC commander show also controls for user to manage the device like update position, update mobile number, add/remove device from the list.

Alternative Scenario: If there is no device is loaded before, a message dialog will be show

Exceptions: Loading database error Relationships: UC005,UC006,UC007,UC008 Business Rules: N/A

Requirements

32

USE CASE-6 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User Summary: Goal: Clear LEDs content to update new one if needed Clear Leds content UC0006 Clear LED content ThuanNB 27/05/2011 Priority Normal Use-case Version <1.0>

Triggers User starts PC Commander User selects a communication option User selects a specific LED User choose to delete its display content

Preconditions: PC Commander is started successfully Connection is OK LED list is not empty

Post Conditions: N/A Main Success Scenario: A warning message appears to warn user if he really wants to clear the LEDs display content If the user agrees, the LEDs content no longer exists

33

Wireless Module and Applications

Alternative Scenario: An error message appears due to network problems

Exceptions: No

Relationships: UC1, UC05 Business Rules: N/A

USE CASE-7 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User Summary: This case allows the user to update content of current LED, when they finish to input Text, Image and choose effect. Goal: Update content of current LED. Triggers Click on Update button UC07 Use-case Version <1.0>

Update content of current LED LinhTH 27/05/2011 Priority Normal

Preconditions:

Requirements

34

Choose Led in the list Led Input text and choose effect Input image and choose effect

Post Conditions: Text and image will display in simulation Led.

Main Success Scenario: When User click Update button, Text which is in text editor and image will load in simulation Led

Alternative Scenario: Everything doesnt change.

Exceptions: Text is empty and Image is not chosen

Relationships: U1- U6

Business Rules: N/A

35

Wireless Module and Applications

3.2.2.1.4

Prepare display content to send

PC commader
Input customized text

uses uses uses uses Prepare display content to send uses

Input an customized image

Text alignment on LEDs

Image alignment on LEDs uses

Users uses Preview uses

Set LED size

Send

USE CASE-8 SPECIFICATION Use-case No. Use-case Name UC0008 Input text Use-case Version <1.0>

Requirements

36

Author Date Actor: User Summary: Goal: -

ThuanNB 27/05/2011 Priority Normal

Input text to send to LEDs

Allow user to customize text input

Triggers User starts PC Commander User selects a communication option User selects text input option User enters text content and customize it

Preconditions: PC Commander is started successfully Connection is OK Text is not empty

Post Conditions: N/A Main Success Scenario: Customized text is created

Alternative Scenario: N/A

Exceptions: No

Relationships:

37

Wireless Module and Applications

UC1 Business Rules: N/A

USE CASE-9 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User Summary: Goal: Allow user to customize Image input Input image to send to LEDs UC0009 Input Image ThuanNB 27/05/2011 Priority Normal Use-case Version <1.0>

Triggers User starts PC Commander User selects a communication option User selects image input option User loads an image and customize it

Preconditions: PC Commander is started successfully Connection is OK Image is not empty

Post Conditions:

Requirements

38

N/A Main Success Scenario: Customized Image is created

Alternative Scenario: User loads an unsupported Image type. A warning message appears

Exceptions: No

Relationships: UC1 Business Rules: N/A

USE CASE-10 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User Summary: Goal: Allow user to select a suitable position Choose texts position to display on LEDs UC0010 Text alignment ThuanNB 27/05/2011 Priority Normal Use-case Version <1.0>

39

Wireless Module and Applications

Triggers User starts PC Commander User selects a communication option User selects text input option User enters text and customize it User uses arrow buttons to change texts position

Preconditions: PC Commander is started successfully Connection is OK Text is not empty

Post Conditions: N/A Main Success Scenario: Texts position changed as expected

Alternative Scenario: No

Exceptions: Text s position is outside Leds boarders

Relationships: UC1, UC8 Business Rules: N/A

USE CASE-11 SPECIFICATION Use-case No. UC0011 Use-case Version <1.0>

Requirements

40

Use-case Name Author Date Actor: User Summary: Goal: -

Image alignment ThuanNB 27/05/2011 Priority Normal

Choose images position to display on LEDs

Allow user to select a suitable position

Triggers User starts PC Commander User selects a communication option User selects image input option User enters an image and customize it User uses arrow buttons to change the images position

Preconditions: PC Commander is started successfully Connection is OK Image is not empty

Post Conditions: N/A Main Success Scenario: Images position changed as expected

Alternative Scenario: No

Exceptions:

41

Wireless Module and Applications

Image size is too large image s position is outside Leds boarders

Relationships: UC1, UC9 Business Rules: N/A

USE CASE-12 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User Summary: This case allows the user to know how current Led works in simulation Led table. Goal: Show current LED works in simulation Led table. Triggers Click on Preview button UC012 Use-case Version <1.0>

Run to preview in simulation Led table LinhTH 27/05/2011 Priority Normal

Preconditions: Choose Led in the list Led Input text and choose effect Input image and choose effect Update content of Current Led

Requirements

42

Post Conditions: Simulation Led work with text and images effect. Main Success Scenario: When User click Preview button, text and image with its effect will be repented in simulation Led table.

Alternative Scenario: Simulation Led table doesnt change.

Exceptions: Cant convert image and text s effect to hex code

Relationships: U1-U10

Business Rules: N/A

USE CASE-13 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User Summary: UC013 Set size for Led table LinhTH 27/05/2011 Priority Normal Use-case Version <1.0>

43

Wireless Module and Applications

This case allows the user to set size for Led table. Goal: Show Set size for Led table Triggers Click on View Size

Preconditions: Connect to device successfully

Post Conditions: Size of Simulation Led will change.

Main Success Scenario: When User click Size, and input height and weight, the simulation led table will change follow this size

Alternative Scenario:

Exceptions: The input height and weight is too small or big

Relationships: U1

Business Rules: + N/A

Requirements

44

3.2.2.1.5

Use GPS communication

PC commader
Update LEDs' postions uses

uses

Use GPS communication

uses Display LEDs' positions on Google map

Users uses

Zoom in/out Google Map

USE CASE-0014 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User <UC0014> Use-case Version <1.0>

Send request update device position DatTX 27/05/2011 Priority Normal

45

Wireless Module and Applications

Summary: When user want to update all device position, PC commander will sent update request to all specific device to get information via connected board. Goal: Keep the device position up-to-date Triggers User connect PC commander to device User view the Google map User choose update command from menu option

Preconditions: PC commander is connected to the mobile network PC commander is connected to device The device is connected to mobile network

Post Conditions: N/A Main Success Scenario: PC commander send tracking request to the specific LED board LED board send request the position information to the satellite via GPS and send it to the device that connected with PC commander. The device send data to PC commander to resolve. PC commander receive the information from the device and update it on the Google map

Alternative Scenario: If device cannot connect to the Mobile network to send tracking request, a dialog will be displayed to notice user When request is send successful, an dialog will be display to tell user complete the task

Exceptions: Device cannot send message to LED board to request update PC Commander is not connected to control device

Requirements

46

Relationships:

Business Rules: N/A USE CASE-15 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User Summary: After user start PC Commander, it load all the device positions in the last update to display on the Google map. Goal: Show user where all of the devices are in Google Map. Triggers The user start PC Commander <UC0015> Use-case Version <1.0>

View Google map on PC Commander DatTX 27/05/2011 Priority Normal

Preconditions: PC is connected to the Internet Device is sent position data to the server before.

Post Conditions: N/A Main Success Scenario:

47

Wireless Module and Applications

PC Commander load the Map from the internet PC commander load the data from database to display to the Google map

Alternative Scenario: If PC commander cannot connect to the internet to load the Map, a error dialog will be displayed If there is no device data, an notification dialog will be displayed

Exceptions: Loading Google map has interrupted by the network problem Relationships: <..> Business Rules: N/A USE CASE 0016 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User Summary: Zoom in or zoom out when user tap or zoom in the Map. Goal: To help user to view the device position in details place Triggers User view the Google map UC0016 Zoom the Google map DatTX 27/05/2011 Priority Normal Use-case Version <1.0>

Requirements

48

Zoom in or Zoom out the map in touch screen

Preconditions: The Google map is loaded before

Post Conditions: The Google map is displayed in suitable size.

Main Success Scenario: The map is loaded successful The mobile is connected to the Internet

Alternative Scenario: If the map is zoom in or zoom out in maximum or minimum, the map can not zoom in/ out anymore If the loading map is interrupted because of mobile network problem, the dialog message will be showed

Exceptions: The device position is different from before zoom-ing Relationships:

Business Rules: N/A

49

Wireless Module and Applications

3.2.2.1.6

Load/Save configuration

PC commader
Load text/Image configuration uses uses Load/Save configuration for next times uses Users Save text/image configuration

USE CASE-17 SPECIFICATION Use-case No. Use-case Name Author Date Actor: UC017 Load configuration LinhTH 27/05/2011 Priority Normal Use-case Version <1.0>

Requirements

50

User Summary: Goal: Triggers Choose Led and Click on Load configuration button Load configuration of Led on device This case allows the user to load configuration of each Led on device.

Preconditions: Connect to device successfully Choose Led which need to load

Post Conditions: Content of current led will save and display in simulation. Text will display in text editor

Main Success Scenario: When User click Load configuration ,content of match device will get to PC and saved

Alternative Scenario:

Exceptions: Connection error and cant get configuration of Led on device

Relationships: U1,U2

Business Rules: N/A

51

Wireless Module and Applications

USE CASE-18 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User Summary: Goal: Triggers Click on Save configuration button Save configuration for next time This case allows the user save configuration for current Led. UC018 Use-case Version <1.0>

Save configuration for next time LinhTH 27/05/2011 Priority Normal

Preconditions: Connect to device successfully Choose Led which need to load Update and preview successful

Post Conditions: Display dialog to report success or fail

Main Success Scenario: When User click save configuration ,content of match Led will be saved on PC

Alternative Scenario:

Exceptions:

Requirements

52

Cant save configuration of Led.

Relationships: U1,U2

Business Rules: N/A

3.2.2.2 Mobile Commander 3.2.2.2.1 Use Case Using Google Map Diagram

USE CASE01 SPECIFICATION

53

Wireless Module and Applications

Use-case No. Use-case Name Author Date Actor: User Summary:

<UC001>

Use-case Version

<1.0>

View Google map on Mobile Commander DatTX 27/05/2011 Priority Normal

After user start Mobile Commander, it load all the device positions in the last update to display on the Google map. Goal: Show user where all of the devices are in Google Map. Triggers The user start Mobile Commander Preconditions: Mobile is connected to the Internet Device is sent position data to the server before.

Post Conditions: N/A Main Success Scenario: Mobile Commander load the Map from the internet Mobile commander load the data from database to display to the Google map

Alternative Scenario: If Mobile commander cannot connect to the internet to load the Map, a error dialog will be displayed If there is no device data, an notification dialog will be displayed

Exceptions:

Requirements

54

Loading Google map has interrupted by the network problem Relationships: UC002, UC003 Business Rules: N/A

USE CASE002 SPECIFICATION

Use-case No. Use-case Name Author Date Actor: User Summary:

<UC002>

Use-case Version

<1.0>

Request update device position DatTX 27/05/2011 Priority Normal

When user want to update all device position, Mobile commander will sent update request to all specific device to get information Goal: Keep the device position up-to-date Triggers User view the Google map User choose update command from menu option

Preconditions: Mobile commander is connected to the mobile network

55

Wireless Module and Applications

Post Conditions: N/A Main Success Scenario: Mobile commander send tracking request to the specific LED board LED board send request the position information to the satellite via GPS and send it to the Mobile commander. Mobile commander receive the information from the device and update it on the Google map

Alternative Scenario: If Mobile commander cannot connect to the Mobile network to send tracking request, a dialog will be displayed to notice user When request is send successful, an dialog will be display to tell user complete the task

Exceptions: Mobile commander cannot send message to request update Relationships: UC001 Business Rules: N/A

USE CASE 003 SPECIFICATION

Use-case No. Use-case Name Author Date

UC003 Zoom the Google map DatTX 27/05/2011

Use-case Version

<1.0>

Priority

Normal

Requirements

56

Actor: User Summary: Zoom in or zoom out when user tap or zoom in the Map. Goal: To help user to view the device position in details place Triggers User view the Google map Zoom in or Zoom out the map in touch screen

Preconditions: The Google map is loaded before

Post Conditions: The Google map is displayed in suitable size.

Main Success Scenario: The map is loaded successful The mobile is connected to the Internet

Alternative Scenario: If the map is zoom in or zoom out in maximum or minimum, the map cannot zoom in/ out anymore If the loading map is interrupted because of mobile network problem, the dialog message will be showed

Exceptions: The device position is different from before zooming Relationships: UC001 Business Rules: N/A

57

Wireless Module and Applications

3.2.2.2.2

Use Case Manage Device List Diagram

USE CASE04 SPECIFICATION

Use-case No. Use-case Name Author Date Actor: User Summary:

UC004 View the device list DatTX 27/05/2011

Use-case Version

<1.0>

Priority

Normal

Requirements

58

After user start Mobile Commander, user want to show the device list and manage it Goal: Show user where all of the devices are in a list view with some control. Triggers The user start Mobile Commander User choose manage device in main menu

Preconditions: The device list is loaded before

Post Conditions: All device with its attribute contains: position(longitude, latitude), mobile number will be show in a list view

Main Success Scenario: Mobile commander load the device list from database Mobile commander show also controls for user to manage the device like update position, update mobile number , add/remove device from the list.

Alternative Scenario: If there is no device is loaded before, a message dialog will be show

Exceptions: Loading database error Relationships: UC005,UC006,UC007,UC008 Business Rules: N/A

USE CASE05 SPECIFICATION

59

Wireless Module and Applications

Use-case No. Use-case Name Author Date Actor: User Summary:

UC005 Add new device to device list DatTX 27/05/2011

Use-case Version

<1.0>

Priority

Normal

After showing all the device list to the user, Mobile commander allow user to add new device to the device list Goal: Allow user to add new device, extends out system. Triggers User started Mobile Commander User chose manage devices option in menu User chose add new device in option menu

Preconditions: N/A Post Conditions: A new input form is show to the user Add the new device to the database

Main Success Scenario: Mobile commander show the input form to user User must put the mobile number for new device, position can be null When user finish the input process, new device data will be add to the database New update request can be send if user want to update the position of the device immediately

Requirements

60

Alternative Scenario: None Exceptions: Adding new data to database error

Relationships: UC004 Business Rules: N/A

USE CASE06 SPECIFICATION

Use-case No. Use-case Name Author Date Actor: User Summary:

UC006

Use-case Version

<1.0>

Remove a device from device list DatTX 27/05/2011 Priority Normal

After showing all the device list to the user, Mobile commander allow user to remove specific devices from the device list Goal: Allow user to remove devices, reduce out system. Triggers

61

Wireless Module and Applications

The user start Mobile Commander User chose manage devices option in menu User chose remove device in option menu

Preconditions: N/A Post Conditions: A new input form is show to the user Remove selected devices from the database

Main Success Scenario: User can chose multiple devices to remove When user finish the process, all selected devices will be remove from database

Alternative Scenario: None Exceptions: Remove data from database error

Relationships: UC004 Business Rules: N/A

USE CASE07 SPECIFICATION

Use-case No. Use-case Name

UC007 Edit the message to send

Use-case Version

<1.0>

Requirements

62

Author Date Actor: User Summary:

DatTX 27/05/2011 Priority Normal

This function is to prepare message when user want to send message to device. Its allow user to add text include configure font, size and effect of the texture and also chose device to send. Goal: Show the editor to user for editing the message to send. Triggers User start Mobile Commander User choose send message from main menu or from option menu when viewing a device. Message editor is show to user Allow user to input text, font, size, effect of string to send Allow user to input the device ID or device mobile number to send

Preconditions: Device list is listed before and has at least one device

Post Conditions: N/A Main Success Scenario: Mobile Commander load the device list from database and has at least one device

Alternative Scenario: N/A Exceptions: If there is no device in device list, an warning message will be show to user

Relationships:

63

Wireless Module and Applications

UC004,UC008 Business Rules: Any message is not more than 1000 characters.

USE CASE08 SPECIFICATION

Use-case No. Use-case Name Author Date Actor: User Summary:

UC008 Send message to device list DatTX 27/05/2011

Use-case Version

<1.0>

Priority

Normal

This function allow user to send message that edited in editor form to specific devices. Goal: Send message to device list. Show status of deliverable message when finish sending Triggers User start Mobile Commander User choose send message from main menu or from option menu when viewing a device. Message editor is show to user Allow user to input text, font, size, effect of string to send Allow user to input the device ID or device mobile number to send User chose send command to send message to devices

Preconditions: Mobile commander is connected to mobile network.

Requirements

64

Device list is not empty Message is not empty

Post Conditions: N/A Main Success Scenario: Mobile Commander load the device list from database and has at least one device User choose device to send message from device list Message will be send to all of device in selected list Delivery message is show after user send message to tell user about the status of the message) delivered or not)

Alternative Scenario: If no device is selected before, an warning message is showed

Exceptions: If mobile commander is not connected to mobile network or cannot send message because of any problem, an warning message is showed. If message is empty, an warning message is showed.

Relationships: UC004, UC007 Business Rules: N/A

65

Wireless Module and Applications

3.2.2.3 Central Controller 3.2.2.3.1 Functions Send SMS to the commander to provide information Expected output User send SMS to GSM/GPS Module to get information Extract SMS contents. Processing the content. Wrap the processed content into SMS format Send SMS to the user successfully

Input Processing involved

Authenticate user User sends SMS to GSM/GPS Module Extract SMS contents. Processing the content. Validate the mobile number and password provided in the SMS Reject if the mobile number is not authorized.

Input Processing involved

Expected output

Modify LED message board User sends SMS to GSM/GPS Module Extract SMS contents. Processing the content. Send data to the led board Content of the LED message board changed.

Input Processing involved

Expected output

Implementation

66

67

Wireless Module and Applications

4.1

System Architecture

4.1.1 Proposed System Architecture

TCP/IP

TCP/IP

Server

Satellite

GSM TCP/IP

GPS

Mobile

I/O Pins

RS232

GSM

RS232 Wireless Module Controller

PC

Wireless Module

Figure 4-1: System Architecture The architecture of WMA consists of two main components: The commander, which is developed on PC and Mobile and the controller, which is developed on the microcontroller, wireless module and Led module. These two components are almost separated except that they communicated through GSM network and the Internet. The communication between them is as follows. Both the commander and the Controller are joined to the GSM network. When the commander sends an SMS to the controller, the microcontroller handles it and manipulates the LED Module. The Controller also connects to the Internet via GPRS core network. There would be a GPRS server which serves as a data collector (in this case, the data is GPS information) from microcontrollers and provides them to the client the commanders. The proposed architecture make the system easy to be implemented and also very convenient for debugging, maintaining the system.

Implementation

68

UI

Commander and GPRS Server

C# XML Base Classes SQLite

Java Core Libraries

.NET Framework

Android Framework

Wireless Module AT COMMANDS SET UART Microcontroller

Led Module

Controller

I/O Pins

Figure 4-2: Components Architecture

4.1.2 System Interfaces


4.1.2.1 Hardware Interface The wireless module that consists of GSM module and GPS module provides two UART ports for external connection with the microcontroller. The Microcontroller connects to the LED module via I/O pins. 4.1.2.2 Software Interface The wireless module provides AT Commands set for external device for manipulating purpose. The Commanders (both on PC and Mobile) and the microcontroller communicate based on the WMMF protocol (See 4.7.1 for details). The commanders (both on PC and Mobile), the GPRS Server and the microcontroller communicate based on WMCP protocol (See 4.7.2 for details).

69

Wireless Module and Applications

4.1.3 Component Diagram

Figure 4-3: Component Diagram

Implementation

70

4.2

Detailed Description of Components

4.2.1 System Class & Block Diagram


4.2.1.1 PC Commander Class Diagram

DataToString -imagePath : string -scanDirection : int -text : string -height : int -width : int -horizontalOffSet : int -verticalOffSet : int -objBitmap : Bitmap -turnID : int -isBorder : bool -isReverse : bool -isUpset : bool +DataToString(in ledMatrix : LedMatrixTable) +ConvertToStringData() : string -ConvertBitmapToLastArray() : int[,] -ConvertBitmapToArray() : int[,] -CreateBitmapImage(in strConvert : string, in fName : string, in fSize : int, in fStyle : FontStyle) : Bitmap -MakeGrayscale(in original : Bitmap) : Bitmap AlignEffect +GetEffect(in int[,] inputArray, int turnID, bool isBorder, bool isReverse, bool isUpset) : int[,] -ConvertArrayBorder(in objArray : int[,]) : int[,] -ConvertArrayReverse(in objArray : int[,]) : int[,] -ConvertArrayTurnLeft(in objArray : int[,]) : int[,] -ConvertArrayTurnRight(in objArray : int[,]) : int[,] -ConvertArrayUpset(in objArray : int[,]) : int[,] MotionEffect EffectItem -rowsOfOnOffMatrix : int -name : string -columnsOfOnOffMatrix : int -value : int -onOffMatrix : int +EffectItem(in name : string, in value : int) +GetEffect(in int effectID, int[,] inputMatrix) : int -GetDataEffect(in int effectID) : string -Effect_None(in int[,] inputMatrix) : void -Effect_RightToLeft(in int[,] inputMatrix) : void -Effect_LeftToRight(in int[,] inputMatrix) : void -Effect_UpToDown(in int[,] inputMatrix) : void -Effect_DownToUp(in int[,] inputMatrix) : void RS232 ByteStringConverter +ConvertBitsToBytes(in stringData01 : string) : byte +ConvertByteToString(in byteArray : byte) : string +ConvertStringToByte(in stringEnconding : string) : byte +ConvertByteToBits(in byteArray : byte) : string

StringToLEDMatrix -scanDirection : int -stringBytes : string -height : int -width : int -speed : int -autoHeight : int -autoWidth : int +StringToLEDMatrix(in ledMatrix) : void +ConvertStringToArray() : int

PCCommander -currentLedMatrix : LedMatrixTable -XMLPath_ListLedTable : string -XMLPath_ListEffectName : string -XMLPath_Account : string -isEdit : bool -fixHeight : int -fixWidth : int -onOffMatrix : int[,] -initialMatrix : int[,] +SetEnabled(in isTrue : bool, in isEdit : bool) : void +GetDataFromXmlFile(in nodeName : string, in nodeID : string) : void +GetDataFromForm() : void +LoadTreeView() : void +LoadDataToComboEffect() : void +LoadFontToComboxFont() : void +ResetForm() : void LedMatrixTable -dataType : int -textFormat : TextFormat -text : string -imagePath : string -stringBytes : string -height : int -width : int -speed : int -effect : int -scanDirection : int -name : string -id : string +LedMatrixTable()

About

ChangePassWord -isOK : bool

LedMatrixProperties -ledMatrix : LedMatrixTable -strXMLpath : string Connection -typeConnection : string -isOK : bool AddNewLedTable -width : int -height : int -ledTableName : string -ledTableCardID : string -isOk : bool

FileReaderWriter -strFilePath : string +FileReaderWriter(in path : string) +GetDataFromXmlFile(in ledTableName : string, in ledTableCardID : string) : LedMatrixTable +CreateNewLedTable(in ledMatrix : LedMatrixTable) : void +SaveLedTableToXML(in ledMatrix : LedMatrixTable, in name : string, in cardID : string) : bool +SaveLedTableName(in newLedTableName : string, in ledTableCardID : string) : bool +DeleteLedTableInXML(in ledTableName : string, in ledTableCardID : string) : bool +CheckLedTableCardID(in ledTableCardID : bool) : bool +ChangePassWord(in oldPass : string, in newPass : string) : bool +SaveLedTableToXML(in ledMatrix : LedMatrixTable, in newName : string, in newID : string, in hight : string, in width : string) : bool TextFormat -fontName : string -fontSize : int -fontStyle : object -horizontalOffSet : int -verticalOffSet : int -turnID : int -isBorder : bool -isReverse : bool -isUpset : bool +TextFormat() +GetFormatString() : string +AnalyserFormatString(in strFormat : string) : void

LedMatrixControl. dll

71

Wireless Module and Applications

4.2.1.2 Mobile Commander Class Diagram

Implementation

72

4.2.1.3 GPRS Server Class Diagram

4.2.1.4 GPS Client

73

Wireless Module and Applications

4.2.1.5 Controller Block Diagram 4.2.1.5.1 Block diagram 1: Get GPS data
GPS Module

UART

Microcontroller

UART

UART

GSM/GPRS Module

UART
GPRS Server

4.2.1.5.2

Block Diagram 2: Control LED board via SMS message

PC/Mobile Commander
GSM GSM

GPS/GPRS Module
UART UART
I/O Pins

Microcontroller

Led Board

TCP/IP

Implementation

74

4.2.2 System Sequence Diagram


4.2.2.1 PC Commander Sequences 4.2.2.1.1 Get and display Matrix from file

75

Wireless Module and Applications

4.2.2.1.2

Input Data

Implementation

76

4.2.2.1.3

Clear Data

4.2.2.1.4

Save current LED matrix

77

Wireless Module and Applications

4.2.2.1.5

Add new LED matrix

Implementation

78

4.2.2.1.6

Delete current LED matrix

79

Wireless Module and Applications

4.2.2.1.7

Preview LED Matrix

4.2.2.1.8

Pause animation

Implementation

80

4.2.2.1.9

Reset LED matrix

4.2.2.2 Mobile Commander Sequences 4.2.2.2.1 Display map with the device position list on the mobile

81

Wireless Module and Applications

4.2.2.2.2

Set Led content for specified modules by sending SMS command

Implementation

82

4.2.2.2.3

Send SMS command to get current content of the module

83

Wireless Module and Applications

4.2.2.2.4

Add new devices to device list

Implementation

84

4.2.2.2.5

Send Data to Device in Mobile Soft

85

Wireless Module and Applications

4.2.2.2.6

Display all modules list with its name, phone number

4.2.2.2.7

Display the map with the device position list on the mobile

Implementation

86

4.2.2.2.8

Send SMS command to change Module password

87

Wireless Module and Applications

4.2.2.2.9

Connect to GPS Server and get devices position

Implementation

88

4.2.2.3 Microcontroller Sequences 4.2.2.3.1 Get GPS data and send to GPRS server by Micro controller

89

Wireless Module and Applications

4.2.2.3.2

Control LED board via SMS message by Micro controller

Implementation

90

4.2.2.4 GPRS Server 4.2.2.4.1 Accept a version sent from a client

91

Wireless Module and Applications

4.2.2.4.2

Accept Phone Number sent from GSM module

Implementation

92

4.2.2.4.3

Accept and convert GPS data sent from a GSM module

93

Wireless Module and Applications

4.2.2.4.4

Accept a password sent from a mobile

Implementation

94

4.2.2.4.5

Accept a phone No list request sent from a mobile

95

Wireless Module and Applications

4.2.2.4.6

Accept GPS data requests and send GPS data to mobiles

4.3

Analysis and selection of tools, devices

4.3.1 Devices
4.3.1.1 SIMCOM SIM548C module The SIM548 module suits all the requirement of WMA. The module integrates both GSM/GPRS module and GPS module, so the two main functions of the system could be implemented using only the SIM548 module instead of using two separated GSM and GPS modules. Besides, we chose the SIM548 module for following advantages: The GSM module operates at 4 bands: 850/900/18001900MHz. So it would be easier for the system to be compatible with any telecommunication network infrastructure.

Implementation

96

The GSM module is controlled using AT commands set which is very well-documented and easy to understand. The module operates at a supply voltage range from 3.4 to 4.5 V and it is also very low power consumption. The normal operation temperature is from -30 C to +80C, so it would be able to work at almost every condition. The GSM module supports both Text and PDU mode, which is suitable for send binary data over GSM network. Regular SMS is limited to 160 septets (7bits) or 140 octets (8 bits). The LED data required 8-bit-data-type so the PDU mode would be perfect for such purposes. The transfer speed of the module is up to 85.6 kbps (downlink) and 42.8 kbps (uplink). The GSM module integrates TCP/IP stack. Two separated antenna connectors. The GPS module has high accuracy and quick acquisition rate. The GPS module Has 4Mb flash memory and 1Mb SRAM.

4.3.1.2 MICROCHIP dsPIC30F4013 The dsPIC30F4013 has two separated UART ports, which are suitable for controlling the SIM548 module. Those two ports could be used at the same time for listening on the GPS port and send appropriate data through GSM port. 4.3.1.3 MICROCHIP PIC18F46K20 The PIC18F46k20 is appropriate for manipulating LED Matrix and it also has UART ports which are used for controlling GSM/GPRS module. 4.3.1.4 LED Module (P10 outdoor 16x32x2) The Led module is single-color and could be use for displaying text, image, simple logo and even animations. Pixel size: 10 mm. Module size: 16 x 32. Expectation of life: 100,000 hours. High stability and luminosity. Could be put outdoor and is waterproof.

4.3.2 Tools
4.3.2.1 Microsoft Visual Studio 2008 SP1 Visual Studio is one of the most powerful IDE for developing software, both on software system and embedded system. There is no doubt that VS is the best choice for those who want to develop software application. 4.3.2.2 Eclipse 3.6 (Helios) Eclipse was chose because of its huge community. For the past three years. Eclipse has been used as a replacement for Development Tool of many hardware and software manufacture all over

97

Wireless Module and Applications

the world. Besides, The Mobile commander is developed on Android 2.2 (Froyo), which is fully compatible with Eclipse. 4.3.2.3 MPLAB IDE 8.43 MPLAB IDE is a graphical, integrated debugging, programming tool for all kinds of Microchip Microcontroller. The IDE also supports many third-party tools and it is also compatible with other IDE. Besides, the programming guide for MPLAB is very well-documented and is very popular. 4.3.2.4 Microsoft Visio 2010 Visio was used to visualize system diagram, components diagram and class diagram of WMA project. 4.3.2.5 Astah UML Pro Astah was used to draw sequence diagram of system components. The tool makes the drawing easier because It provides source code importing, which is very useful for auto generating class diagram. 4.3.2.6 Tortoise SVN Client Tortoise SVN client is an open project which is used as a project file-server. This tool is free and team members can easily add/update all project files/documents to the server. It helps us to synchronize all project file/documents. It also help us manage the version of the documents and users are able to show log and revert to any version if current version contains error. The server address is place at URL: https://cpro-wia.googlecode.com/svn/trunk

4.4

Circuit Design

4.4.1 Wireless Module Evolution Board

Implementation

98

99

Wireless Module and Applications

4.4.1.1 Evolution Board Top Layer Top layer design of Evolution Board:

4.4.1.2 Evolution Board Bottom Layer Bottom layer design of Evolution Board:

Implementationtation

100

4.4.2 Controller Board

4.4.2.1 Controller Board Layer

101

Wireless Module and Applications

4.5

Interface Design

4.5.1 PC Commander
Main Screen

PC Commander main screen is divided into 6 regions: toolbar, preview screen, setting & zooming panel, editing panel, input panel, managing panel. Toolbar

The strip menu contains following buttons (from left to right respectively): Add button: Add new LED matrix. Save button: Save current configuration to XML file. Play button: Run the animation if the effect of LED matrix was enabled. Stop button: Stop the animation. Refresh button: Refresh the LED matrix content to default Clear button: Clear LED matrix content. Delete button: Delete selected LED matrix on Treeview. Send button: Send current LED matrix content to selected LED matrices on Treeview. Managing panel

Implementationtation

102

Managing panel display LED matrices that were saved in the XML file. Those LEDs are displayed in a tree structure. Preview Screen

The preview screen displays visually the LED contents and all settings that were applied to it. Input Panel

User can input text or image in this panel. The commander also allows user to choose size, font, and style. Setting & zooming panel

The panel contains two text boxes for width and height settings, a checkbox for auto setting the LED size, and a zooming slide for zooming in/out the LED matrix.

103

Wireless Module and Applications

Editing Panel

The panel contains a dropdown list box that contains available effects, a text box for inputting the LED moving speed, for buttons that moves the LED matrix in for directions, and a sub panel. The sub panel consists of 5 buttons with 5 editing effect for LED static content.

4.5.2 Mobile Commander


4.5.2.1 Screen flow PC commander contains 8 screens as following:

Implementationtation

104

4.5.2.2 Detailed screens Main screen

Main screen of mobile commander contains three buttons: View Map Button: Manage Devices: About us Button: Go to [View map screen]. Go to [All devices screen]. Go to [About us screen].

View map screen

View map screen displays a Google Map and all devices position in the database

105

Wireless Module and Applications

All devices screen

The All devices screen show all devices in the database as a list. There is a checkbox on the right side of each device. When user hits the menu button on themobile, the popup menus shows with 3 buttons: Add button: Go to [Add device screen]. Update Button: Showing popup menu that contains update operations. Delete Button: Delete selected devices. When pushing updat button, a popup menu shows with 4 options: Set content: Go to [Set content Screen]. Get content screen: Get content of LED board. Get position: Get current position of devices. Change password: Go to [Change password screen]. Add device screen

Implementationtation

106

The add device screen contains following controls: Device name text box: Input device name. PhoneNum text box: Input device phone number. Longitude text box: Input device longitude. Latitude text box: Input device latitude. Password text box: Input device password. Add button: Create new device, add it to the database and go back to [All devices screen] Back button: Go back to [All devices screen] without applying any changes. Edit device screen

Edit device screen contains following controls: Device name text box: Input device name Phone number text box: Input phone number Latitude textbox: Input latitude. Longitude textbox: Input longitude. Led board View: Displaying LED content. Save button: Save changes to database, go back to [All devices screen]. Back button: Go back to [All devices screen] without applying any changes.

107

Wireless Module and Applications

Change password screen

The screen contains following controls: Old password text box: New password text box: Retype password text box: Send Command button: Back button: Set content screen

Input old password. Input new password. Input new password. Send set password command and go back to [All devices screen] Go back to [All devices screen] without applying any changes.

Implementationtation

108

The screen contains following controls: Device list text box: disabled text box that displays devices list. Content text box: Input LED content. Size text box: Input LED size. Effect list box: List of effects. Speed text box Input LED effect speed. Preview button Show LED content on the Led board View. Key arrows button: Move LED content in four directions. Led board View: Display LED content. About Screen

4.5.3 GPRS Server

109

Wireless Module and Applications

The GPRS Server contains following controls: Port Number Text box: Input port number Connected Clients List box: Displaying connected clients. Start button: Start server. Stop button: Stop server. Log text box: Display logging information.

4.5.4 GPS Client


Login Screen

Screen controls: Server address textbox: Input GPRS Server address. Port text box: Input GPRS Server port. Password textbox: Input GPRS Server login password. Connect button: Start connecting to GPRS Server. Exit button: Exit the application.

Main Screen

Implementationtation

110

4.6

Database Design

4.6.1 Mobile Commander DB Design


The WMA application used DB to stored icon information about devices. There in formations are kept while power OFF terminal DB storage place (each DB commonness) /data/data/ digisky.cpro.wma/database/... The list of database for home application: DB file name device.db devices Table name Description for table Contains information about device such as device name, phone number, longitude, latitude

Devices table Column name

Type

Primary key

Description

_id device_name phone_number Latitude Longitude Password Led_content

INTEGER TEXT TEXT NUMERIC NUMERIC TEXT BLOB

yes

Id of the device Name of the module device Phone number of the module Latitude value of the module Longitude value of the module Password of the module Contains LED board data

111

Wireless Module and Applications

4.7

Protocol Design

4.7.1 Wireless Module Message Format (WMMF)


4.7.1.1 Overview This Format is defined for the communication between the commander (PC/Mobile) and the GSM Module via SMS. 4.7.1.2 SMS Format 4.7.1.2.1 SMS from commander to GSM Module

4.7.1.2.1.1 Set content format

1 RT

2 3 4 5 6 7 PWD

10

11

12

DT EF SPD LEN

RT (1 byte): A 8 bits integer that represents the request type. This field must be 0x00. PWD (6 bytes): A 6 bytes string in ASCII format that represents password. DT (1 byte): A 8 bits integer that represents data type. This field can be 0x00 for text and 0x01 for image. EF (1 byte): A 8 bits integer that represents effect ID. SPD (1 byte): A 8 bits integer that represents effect speed. LEN (1 byte): A 8 bits integer that represents length of LED data. Following are number of bytes whose size is defined in LEN field.

4.7.1.2.1.2 Get Content format

1 RT

2 3 4 5 6 7 PWD

8 CS

RT (1 byte): A 8 bits integer that represents the request type. This field must be 0x01. PWD (6 bytes): A 6 bytes string in ASCII format that represents password.

Implementationtation

112

CS (1 byte): A 8 bits integer that checksum data. This field is optional.

4.7.1.2.1.3 Set password format

1 RT

2 3 4 5 6 7 8 9 10 11 12 13 OLDPWD NEWPWD

RT (1 byte): A 8 bits integer that represents the request type. This field must be 0x02. OLDPWD (6 bytes): A 6 bytes string in ASCII format that represents old password. NEWPWD (6 bytes): A 6 bytes string in ASCII format that represents new password. SMS from GSM module to Commander

4.7.1.2.2

4.7.1.2.2.1 Get Content Format

RT DT LEN

RT (1 byte): A 8 bits integer that represents the request type. This field must be 0x00. LEN (1 byte): A 8 bits integer that represents length of LED data. Following are number of bytes whose size is defined in LEN field.

4.7.1.2.2.2 Set Content response

RT RC

RT (1 byte): A 8 bits integer that represents the request type. This field must be 0x01. RC (1 byte): A 8 bits integer that represents the request type. This field could be 0x00 for successfully or 0x01for failed.

113

Wireless Module and Applications

4.7.1.2.2.3 Change password response

RT RC

RT (1 byte): A 8 bits integer that represents the request type. This field must be 0x02. RC (1 byte): A 8 bits integer that represents the request type. This field could be 0x00 for successfully or 0x01for wrong password or 0x02 for unauthorized phone number.

Implementationtation

114

4.7.2 Wireless Module Communication Protocol (WMMC)


4.7.2.1 Overview This protocol is designed for the communication between GPRS Server, GPSa Client (on PC/ Mobile) and the GSM/GPRS Module. The protocol is lightweight in order to make the communication faster and also provides necessary security. 4.7.2.2 Packet Format The format of packets that come between server and client consists two parts: The header and The Data. The header is in 4-bytes fixed size and the data length is defined in the header.

Client Data header

Server Data header

Client Data Block 1

Server Data Block 1

Client Data Block 2

Server Data Block 2

Client Data Block n

Server Data Block n

Figure 4-4: Client & Server Packet Format Pseudo-code of WMADATAHEADER Struct WMADATAHEADER { byte stx; (1 byte)

byte command; (1 byte) short dataLength; (2 bytes) } STX is the source of packet. Types of STX are in the following table:

115

Wireless Module and Applications

Value 0x01 0x02 0x03

Meaning Packets from GPRS Server Packets from GPS Client Packets from GSM Module

Command is the type of intention of the packet. Types of Commands are in the following table: Value 0x10 0x11 0x12 0x13 0x14 0x15 0x00 0x01 Meaning Version of sending application Request and Response for Password Request and Response for Phone number list Request for GPS data of specific devices GPS Data Phone Number Registration Acknowledgment Not Acknowledgment

Datalen is the length of the data that comes after the header. The data can be sent and received in blocks but must be equaled to the Datalen field in the header. For request packet, the datalen must be 0 and for answering packet, the datalen is different from 0 or may be 0. 4.7.2.3 Connection Sequence 4.7.2.3.1 Connection between GSM Module and GPRS Server

Implementationtation

116

Connection between server and GSM Module


Server Send client version GSM Module

Send server version

Send Phone Number Send ACK or NACK Send GPS Data

... Send GPS Data

Figure 4-5: Connections between GPRS Server and GSM Module The flow of the connection between GPRS server and GSM Module consists of following steps: The GSM Module sendss its version to the server. The GPRS Server receive GSM Module version and sends its version to the module. The GSM Module sends the phone number (SIM Card ID) to the server for registration purpose. The GPRS Check for the validity of the phone number and registers it to the table of available phone numbers. Then sends the acknowledgment Packet to the server. If GSM Module received ACK Packet, it would be run into the loop of waiting for appropriate GPS data and sends it to the module. Connections between GPS Client and GPRS Server

4.7.2.3.2

4.7.2.3.2.1 Authentication

117

Wireless Module and Applications

Authentication

Server Send client version

Mobile

Send server version

Send request password command

Send password packet header

Send password data Send ACK or NACK

Figure 4-6: Authentication The flow of the connection between GPRS server and GPS Client consists of following steps: The GPS Client sends its version to the server. The GPRS Server receive GSM Module version and sends its version to the client. The GPRS Server sends password request packet to the client. The GPS Client sends password to the server. The GPRS Server Check for the validity of the password and sends the acknowledgment Packet to the Client.

4.7.2.3.2.2 Send Phone number List

Implementationtation

118

Send Phone Number List

Server Send request for phone number list

Mobile

Send number list header

Send number list data

Figure 4-7: Send Phone Number List The flow of the connection between GPRS server and GPS Client consists of following steps: The GPS Client request for specific phone numbers. The GPRS Server sends phone number list to the client.

119

Wireless Module and Applications

4.7.2.3.2.3 Send GPS Data

Send GPS data

Server Send request GPS data for specific phone numbers Send numbers data Send GPS data header Send GPS data . Send GPS data header

Mobile

Send GPS data

Figure 4-8: Send GPS Data The flow of Sending GPS data from server to GPS Client consists of following steps: The GPS Client request for specific phone numbers. The GPRS Server sends ACK or NACK to the Client. The Client waits for GPS data from server and displays them on the map.

Results

120

121

Wireless Module and Applications

5.1

Achievements

The WMA project is finished in-time and all main functions of the system are done. However, we couldnt be able to integrate WIFI module into our system due to the limitation of time and resources. The project could be reused as a completed controlling solution over GSM/GPRS for other projects in the future.

5.2

Risk/limitations of the system


The system works based on the GSM network, so the outcome of the system depends a lot on the network. If the ISPs stopped providing the GSM/GPRS service, running the system would be impossible. The Led Controlling function is limited to 16x32x2 Led board because of the limitation of SMS. The regular SMS length is 160 septets, which need 7 bit per character for displaying English alphabet. When using the PDU mode as we described, the length is limited to 140 bytes. So for larger board, the commander has to sends a plural number of SMSs. The effects of the LED board are limited to some simple ones due to the limitation of the power of the controller. Even for the current chose board size, the power of the controller is just enough. The commander applications are not multi-platform. User must install Microsoft Windows and .NET Framework or uses an android phone in order to use the system. The GPS signals are extremely low or impossible to be detected when put indoor. This limitation can be explained as the intention of creating GPS is NOT for indoor uses. The security of the system is not assured. When put the system outdoor, the system could be threatened by many factors such as environments, thieves

5.3

Strategies or solution for reducing limitations


For those limitations that we described on section 5.1, we proposed followings strategies for reducing them: The Led board controlling function would be changed from using SMS to GPRS for the communication between the commander and the controller. The TCP/IP packet maximum size is much bigger than that of SMS. For the current system, the microchip PIC18F46k20 is used for controlling the LED. For the next version of the system, the dsPIC30F4013 would be used. The commanders would be developed as applications on website, so the environment for running them would be independent of OS or framework. The Circuit would be re designed for optimizing size, so it would be able to be put in a secured box, which would lead to the reduction of threats to the system.

Conclusions

122

123

Wireless Module and Applications

From the beginning, the WMA project was established as an open project. Our expectation is to expand it as much as we can but the actual outcome is not as good as we hoped. The system lacks some requirements due to the limitation of time and resources. However, throughout the project, we have learnt a lot of useful things. We have never done a project that includes an embedded system before, which involves a lot of risk, technical problems, and hardware problems. We also learnt the skills of working in a group, how to communicate among each member, how to solve problems, resolve risks and many other things. The project may be finished, but the needs for such kinds of system are still enormous. We will continue expanding the project to other kinds of wireless modules and many other applications. We hope that the project would be supported or be sponsored by people who are interested in WMA goals. Finally, we want to thank to people who supported us finishing the project. Thank Dr. Phan Duy Hung for guiding us through the project. We also want to say thank a friend of us who helped us designing the electronic circuit.

Appendix

124

125

Wireless Module and Applications

Product Image