Professional Documents
Culture Documents
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
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
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
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
Introduction
Table of Contents
Project Management
2.1
Problem Definition
Project Management
10
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.
11
Project Management
12
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
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
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
1 2 3 4 5 6
WIA Project Initiating Register Capstone Project Kick-off Meeting Planning Develop Project Plan
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
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
17
Requirements
18
19
3.1
Requirements
20
3.2
21
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.
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
PC commader
Connect
uses Manage LED's list uses uses uses uses uses Manage a specific LED
Users
Load/Save configurations
USE CASE-1 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User Summary: UC0001 Use-case Version <1.0>
Requirements
24
Goal: -
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
25
3.2.2.1.2
PC commader
View All LED list uses
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
Triggers User starts PC Commander User selects a communication option User selects a specific LED from LED list
USE CASE-3 SPECIFICATION Use-case No. Use-case Name UC003 Add new device to device list Use-case Version <1.0>
27
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
Requirements
28
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>
Preconditions: N/A Post Conditions: A new input form is show to the user
29
Main Success Scenario: User can chose multiple devices to remove When user finish the process, all selected devices will be remove from database
Requirements
30
3.2.2.1.3
PC commader
uses
Users uses
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
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
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
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
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
Exceptions: No
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>
Preconditions:
Requirements
34
Choose Led in the list Led Input text and choose effect Input image and choose effect
Main Success Scenario: When User click Update button, Text which is in text editor and image will load in simulation Led
Relationships: U1- U6
35
3.2.2.1.4
PC commader
Input customized text
Send
USE CASE-8 SPECIFICATION Use-case No. Use-case Name UC0008 Input text Use-case Version <1.0>
Requirements
36
Triggers User starts PC Commander User selects a communication option User selects text input option User enters text content and customize it
Exceptions: No
Relationships:
37
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
Post Conditions:
Requirements
38
Alternative Scenario: User loads an unsupported Image type. A warning message appears
Exceptions: No
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
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
Post Conditions: N/A Main Success Scenario: Texts position changed as expected
Alternative Scenario: No
Requirements
40
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
Post Conditions: N/A Main Success Scenario: Images position changed as expected
Alternative Scenario: No
Exceptions:
41
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>
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.
Relationships: U1-U10
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
This case allows the user to set size for Led table. Goal: Show Set size for Led table Triggers Click on View Size
Main Success Scenario: When User click Size, and input height and weight, the simulation led table will change follow this size
Alternative Scenario:
Relationships: U1
Requirements
44
3.2.2.1.5
PC commader
Update LEDs' postions uses
uses
Users uses
USE CASE-0014 SPECIFICATION Use-case No. Use-case Name Author Date Actor: User <UC0014> Use-case Version <1.0>
45
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>
Preconditions: PC is connected to the Internet Device is sent position data to the server before.
47
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
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
49
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.
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:
Relationships: U1,U2
51
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>
Preconditions: Connect to device successfully Choose Led which need to load Update and preview successful
Main Success Scenario: When User click save configuration ,content of match Led will be saved on PC
Alternative Scenario:
Exceptions:
Requirements
52
Relationships: U1,U2
3.2.2.2 Mobile Commander 3.2.2.2.1 Use Case Using Google Map Diagram
53
<UC001>
Use-case Version
<1.0>
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
<UC002>
Use-case Version
<1.0>
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
55
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 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
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
3.2.2.2.2
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
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
59
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
UC006
Use-case Version
<1.0>
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
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
Use-case Version
<1.0>
Requirements
62
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
UC004,UC008 Business Rules: Any message is not more than 1000 characters.
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
Requirements
64
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)
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.
65
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
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.
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.
Expected output
Implementation
66
67
4.1
System Architecture
TCP/IP
TCP/IP
Server
Satellite
GSM TCP/IP
GPS
Mobile
I/O Pins
RS232
GSM
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
.NET Framework
Android Framework
Led Module
Controller
I/O Pins
69
Implementation
70
4.2
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
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
Implementation
72
73
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
PC/Mobile Commander
GSM GSM
GPS/GPRS Module
UART UART
I/O Pins
Microcontroller
Led Board
TCP/IP
Implementation
74
75
4.2.2.1.2
Input Data
Implementation
76
4.2.2.1.3
Clear Data
4.2.2.1.4
77
4.2.2.1.5
Implementation
78
4.2.2.1.6
79
4.2.2.1.7
4.2.2.1.8
Pause animation
Implementation
80
4.2.2.1.9
4.2.2.2 Mobile Commander Sequences 4.2.2.2.1 Display map with the device position list on the mobile
81
4.2.2.2.2
Implementation
82
4.2.2.2.3
83
4.2.2.2.4
Implementation
84
4.2.2.2.5
85
4.2.2.2.6
4.2.2.2.7
Display the map with the device position list on the mobile
Implementation
86
4.2.2.2.8
87
4.2.2.2.9
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
4.2.2.3.2
Implementation
90
91
4.2.2.4.2
Implementation
92
4.2.2.4.3
93
4.2.2.4.4
Implementation
94
4.2.2.4.5
95
4.2.2.4.6
4.3
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
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
Implementation
98
99
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
101
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
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.
Implementationtation
104
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 displays a Google Map and all devices position in the database
105
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
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
109
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.
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
Type
Primary key
Description
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
4.7
Protocol Design
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.
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
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
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.
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
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
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
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
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
Authentication
Mobile
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.
Implementationtation
118
Mobile
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
Server Send request GPS data for specific phone numbers Send numbers data Send GPS data header Send GPS data . Send GPS data header
Mobile
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
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
5.3
Conclusions
122
123
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
Product Image