Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Tribhuvan University Institute of Engineering Pulchowk, Campus Report on the Minor project on Entitled “PC Control Using Mobile” Submitted By: Pankaj Ghimire(061/BCT/528) [email protected] 9841727463 Ram Chandra Panday(061/BCT/536) [email protected] 9841657767 Vaskar Gnyawali(061/BCT/546) [email protected] 9841579382 Submitted To: Department of Electronics and Computer Engineering Submitted on: 13 Falgun,2064 Acknowledgement We are greatly indebted to our honorable external Examiner Mr. Daya Sagar Baral and respected teachers Mr. Jayaram Timisina and Mr. Bikash Shrestha, who helped us during the period of project development with their valuable suggestions regarding the availability of the technologies and the present scenario of these types of projects. We are also thankful to our teachers Prof. Timila Yami Thapa and Mr. Nriapa Dhoj Khadka for his precious suggestions. We would like to express our vote of thanks to our seniors Mr. Jwalanta Shrestha and Mr. Shishir Jha for their valuable suggestions. We are also grateful to those friends who gave us their precious time for different purposes and their suggestions regarding our project selection. Pankaj Ghimire (061bct528) Ram Chandra Panday(061bct536) Vaskar Gnyawali(061bct546) 2 Table of Contents Technologies........................................................................................................................5 Bluetooth ...........................................................5 Development Tool ..........................................................................................................7 Programming Language ..................................................................................................7 Java..................................................................................................................................7 Devices Used.................................................................................................................11 Hardware Implemented..................................................................................................11 Platform and Development Environment .........................................................................13 Fig Complete UML diagram of the project.......................................................................19 Installation Process............................................................................................................20 Limitations.........................................................................................................................21 Abbreviations • SMS – Short Messaging Service • API – Applications Programming Interface • J2ME- Java 2 Micro Edition • J2SE – Java 2 Standard Edition • PAN - Personal Area Networks • PDA – Personal Digital Assistant • SDK – Standard Development Kit • GUI – Graphical User Interface • ISM – Industrial, Science and Medical Frequency Band • CLDC- Connectivity Limited Device Configuration • MIDP- Mobile Information Device Profile • JVM-Java Virtual Machine • KVM-Kilobyte virtual Machine • UML- Universal Modeling Language • BIOS-Basic Input Output System • BDA-BIOS data Area 3 List of Tables Table 1 Bluetooth Power Comparison -------------------------------------------5 Table 2 Bluetooth data Rate Comparison----------------------------------------6 Table 3 Parallel Port Statistics----------------------------------------------------12 Table 4 Mobile Platform Scenario-----------------------------------------------14 4 Abstract Mobile is used for different purposes like in communication, sending SMS. It can be extended to perform various tasks as controlling the PC and home appliances. Our project “PC Control Using Mobile” can be used to control the PC and home appliances by sending text message from any Bluetooth enabled mobile, supporting application developed in J2ME. The mobile supporting MIDP2.0 (Mobile Information Device Profile) and CLDC1.1 (Connectivity Limited Device Configuration) can be used as controller mobile in the course of implementation of our project. This configuration, profile and the optional API ( Blucove 2.10 ) are implemented for the well operation of the different applications in the small devices like mobile having limited processing speed ,limited memory and limited resources. Bluetooth networks are formed ad hoc and dynamically, when Bluetooth-enabled devices come into proximity of one another. Technically, a Bluetooth network is called a Pico net. For sending the text message we must keep track of the distance from the PC (having Bluetooth functionality) which is we are going to control. This distance fairly depends on the range of the Bluetooth Dongle used for the establishing the network with mobile .The network is simply the PAN (Personal Area Network) that can handle few to seven client mobiles and a PC server. The text message must be appropriate command that can be executed directly. The receiving message is first interpreted to find whether it is command or not. And if it is appropriate command, it is executed by PC.On exection the Runtiome method is called which runs Windows OS commands. For controlling parallel port devices the Special command calls the thread writing the data bits to the parallel port which makes the devices on and off. It is important to note that the mobile that we use is not fully dedicated for the controlling purpose .It can perform its usual services independent to the configuration for controlling the PC and home appliances 5 Introduction As we see the technology has reduced electronic devices in size and empowered them more and more day by day as a result mobile technology is growing more popular in the world .This project is thought as the result of our desire to control the different electronic devices from remote using the mobile which is available and handy device which just not only can be used to communicate, send SMS(short message services)but also can be used to control other different electronic devices such as desktop PC ,home appliances like TV, micro oven, refrigerator ,rice cooker etc. In this project we are attempting to control our desktop PC along with home appliances that are connected to that PC via parallel port at home, office or any institution from any places (that is at viable range from Bluetooth) by sending the text message. As we send SMS to give information, personal message we can extend this to control the PC by sending the appropriate text command that is recognizable to the computer .That text message is accepted by PC (having appropriate Bluetooth connection and functionalities) which interprets the received message. If the text message is appropriate command message then the PC executes the command. This ultimately reveals that the PC and any devices connected to PC via parallel port are controlled with mobile phone by sending appropriate text message. 6 Technologies In course of development of this application we have implemented different technologies for establishing connection between PC server and Mobile client, for creating the proper interface, reading and writing the text message .They are briefly described as follows. Bluetooth Bluetooth is an industrial specification for wireless personal area networks (PANs). Bluetooth provides a way to connect and exchange information between devices such as mobile phones, laptops, personal computers, printers, digital cameras, and video game consoles over a secure, globally unlicensed short-range radio frequency. The Bluetooth specifications are developed and licensed by the Bluetooth Special Interest Group. Bluetooth is a low-cost, short-range wireless technology that has become popular among those who want to create personal area networks (PANs). Each PAN is a dynamically created network built around an individual, which enables devices such as cellular phones and personal digital assistants to connect automatically and share data immediately. Bluetooth is a radio standard and communications protocol primarily designed for low power consumption, with a short range (power class dependent: 1 meter, 10 meters, 100 meters) based around low-cost transceiver microchips in each device. Bluetooth enables these devices to communicate with each other when they are in range. The devices use a radio communications system, so they do not have to be in line of sight of each other, and can even be in other rooms, as long as the received transmission is powerful enough. Class Class 1 Class 2 Class 3 Maximum Permitted Power mW(dBm) 100 mW (20 dBm) 2.5 mW (4 dBm) 1 mW (0 dBm) Range(approx.) ~100 meters ~10 meters ~1 meter Table 1 It has to be noted that in most cases the effective range of class 2 devices is extended if they connect to a class 1 transceiver, compared to pure class 2 networks. This is 7 accomplished by higher sensitivity and transmitter power of the Class 1 device. The higher transmitter power of Class 1 device allows higher power to be received by the Class 2 device. Furthermore, higher sensitivity of Class 1 device allows reception of much lower transmitted power of the Class 2 devices. Thus, allowing operation of Class 2 devices at much higher distances. Version Version 1.2 Version 2.0 + EDR WiMedia Alliance (proposed) Data Rate 1 Mbit/s 3 Mbit/s 53 - 480 Mbit/s Table 2 More prevalent applications of Bluetooth include: • Wireless control of and communication between a mobile phone and a handsfree headset. This was one of the earliest applications to become popular. • Wireless networking between PCs in a confined space and where little bandwidth is required. • Wireless communications with PC input and output devices, the most common being the mouse, keyboard and printer. • Transfer of files between devices with OBEX. • Transfer of contact details, calendar appointments, and reminders between devices with OBEX. • Replacement of traditional wired serial communications in test equipment, GPS receivers, medical equipment, bar code scanners, and traffic control devices. • For controls where infrared was traditionally used. • Sending small advertisements from Bluetooth enabled advertising hoardings to other, discoverable, Bluetooth devices. • Two seventh-generation game consoles, Nintendo's Wii and Sony's PlayStation 3, use Bluetooth for their respective wireless controllers. • Dial-up internet access on personal computer or PDA using a data-capable mobile phone as a modem. 8 Development Tool IDE We have used NetBeans IDE 6.0(Integrated Development Environment) with inbuilt package Programming Language Java Java is object oriented, easier, platform independent, portable language, so we have selected java as our application developing language. J2SE Java Platform, Standard Edition or Java SE is a widely used platform for programming in the Java language. It is the Java Platform used to deploy portable applications for general use. In practical terms, Java SE consists of a virtual machine, which must be used to run Java programs, together with a set of libraries (or packages) needed to allow the use of file systems, networks, graphical interfaces, and so on, from within those programs. It must be noted that the expressions such as super, this or the return type void and the method main() are not part of the class hierarchy. Instead they are implemented in the JVM architecture. J2ME Java 2 Platform, Micro Edition (J2ME) is the second revolution in Java’s short history. When Java was introduced in 1995, it looked like the future of computing was in applets, small programs that could be downloaded and run on demand. A slow Internet and a restrictive all-or-nothing sandbox security model accounted for the initially slow adoption of applets. Java, as a platform, really took off with the advent of servlets, Java programs that run on a server (offering a modular and efficient replacement for the vulnerable CGI). Java further expanded into the server side of things, eventually picking up the moniker of Java 2 Platform, Enterprise Edition (J2EE). This was the first revolution, the blitz of server-side Java. The second revolution is the explosion of small-device Java, and 9 it’s happening now. The market for small devices is expanding rapidly, and Java is important for two reasons. First, developers can write code and have it run on dozens of small devices, without change. Second, Java has important safety features for downloadable code. J2ME is divided into configurations, profiles, and optional APIs, which provide specific information about APIs and different families of devices. A configuration is designed for a specific kind of device based on memory constraints and processor power. It specifies a Java Virtual Machine (JVM) that can be easily ported to devices supporting the configuration. It also specifies a strict subset of the Java 2 Platform, Standard Edition (J2SE) APIs that will be used on the platform, as well as additional APIs that may be necessary. Device manufacturers are responsible for porting a specific configuration to their devices. Profiles are more specific than configurations. A profile is based on a configuration and provides additional APIs, such as user interface, persistent storage, and whatever else is necessary to develop running applications for the device. Optional APIs define specific additional functionality that may be included in a particular configuration (or profile). The whole caboodle—configuration, profile, and optional APIs— that is implemented on a device is called a stack. For example, a possible future device stack might be CLDC/MIDP + Mobile Media API. Connected, Limited Device Configuration (CLDC) CLDC is the configuration that interests us, because it encompasses mobile phones, pagers, PDAs, and other devices of similar size. CLDC is aimed at smaller devices than those targeted by the CDC. The name CLDC appropriately describes these devices, having limited display, limited memory, limited CPU power, limited display size, limited input, limited battery life, and limited network connection. The CLDC is designed for devices with 160KB to 512KB of total memory, including a minimum of 160KB of ROM and 32KB of RAM available for the Java platform. If you’ve ever watched J2SE gobble up tens of megabytes of memory on your desktop computer, you’ll appreciate the challenge of J2ME. The “Connected” simply refers to a network connection that tends to be intermittent and probably not very fast. (Most mobile telephones, for example, typically achieve data rates of 9.6Kbps.) These connections also tend to be costly, typically billed by the data packets exchanged. Between the high cost and intermittent slow network connection, applications designed in the CLDC space should be very 10 sparing with the use of the network connection. The reference implementation of the CLDC is based around a small JVM called the KVM (J2ME licensees may use this KVM or implement their own as long as it conforms to the CLDC). Its name comes from the fact that it is a JVM whose size is measured in kilobytes rather than megabytes. While the CLDC is a specifications document, the KVM refers to a specific piece of software.1 Because of its small size, the KVM can’t do everything a JVM does in the J2SE world. • Native methods cannot be added at runtime. All native functionality is built into the KVM. • The KVM only includes a subset of the standard byte code verifier. This means that the task of verifying classes is split between the CLDC device and some external mechanism. Most deployed devices implement CLDC 1.0, but CLDC 1.1 devices are making their way onto the market as this is written. CLDC 1.1 includes enhancements to CLDC 1.0, including support for floating-point data types. Mobile Information Device Profile (MIDP) Mobile Information Device Profile (MIDP) 2.0 specification (JSR-118), a Mobile Information Device has the following characteristics: • A minimum of 256KB of ROM for the MIDP implementation (this is in addition to the requirements of the CLDC) • A minimum of 128KB of RAM for the Java runtime heap • A minimum of 8KB of nonvolatile writable memory for persistent data • A screen of at least 96×54 pixels • Some capacity for input, either by keypad, keyboard, or touch screens • Two-way network connection, possibly intermittent JNI The Java platform is relatively new, which means there could be times when you will need to integrate programs written with the Java language with existing non-Java language services, API toolkits, and programs. The Java platform provides the Java Native Interface (JNI) to help ease this type of integration. 11 The JNI defines a standard naming and calling convention so the Java1 virtual machine can locate and invoke native methods. In fact, JNI is built into the Java virtual machine so the Java virtual machine can invoke local system calls to perform input and output, graphics, networking, and threading operations on the host operating system. For the parallel port interface we have used jnpout32.dll Bluecove 2.0.1 API Bluecove is a LGPL licensed JSR-82 implementation on Java Standard Edition (J2SE) that currently interfaces with the Mac OS X, WIDCOMM, BlueSoleil and Microsoft Bluetooth stack. Originally developed by Intel Research and currently maintained by volunteers. The LGPL license allows linking and distributing commercial software with Bluecove. Bluecove provides an implementation of the JSR 82. Applications should use API defined in JSR-82. Requirements • WIDCOMM (Broadcom) BTW Stack software version 1.4.2.10 SP5 or above • BlueSoleil version 1.6.0 or above • Microsoft Bluetooth stack (currently this means Windows XP SP2 or newer and Windows Mobile 2003 or newer) • PowerPC- or Intel-based Mac OS X 10.4 (Bluetooth v1.2) or late (Since v2.0.2) • Linux with BlueZ Bluetooth stack • A Bluetooth device supported by the WIDCOMM, BlueSoleil or Microsoft Bluetooth stack • Java 1.1 or newer for the binary execution, Java 1.4 or newer to compile. • Another Bluetooth device to communicate with. Limitations L2CAP support available only on WIDCOMM Stack and Mac OS X since Bluecove version 2.0.2. 12 Due to the Microsoft Bluetooth stack only supporting RFCOMM connections, Bluecove also only supports RFCOMM connections on this stack. The operating system support is currently limited to Windows XP SP2 and newer, because the Microsoft Bluetooth stack is not available on other operating systems. If someone writes code to support another stack and/or operating system, it will be considered for inclusion. TOSHIBA on Win32 and BlueZ are welcomed! Devices Used Desktop PC It is configured in PAN using Bluetooth Dongle. Mobile For testing and implementation of our project we have used Nokia 6300 mobile. Nokia 6300 PC suite was installed first and the developed MIDlet was installed to the mobile via Bluetooth. Bluetooth Dongle Bluetooth Dongles are the simplest way of adding Bluetooth functionality to any PC .During the development of this project, the Bluetooth connectivity was acquired using a USB Bluetooth Dongol. Fig: Bluetooth Dongle Hardware Implemented Parallel port connecter and extension chord A parallel port is a type of interface found on computers (personal and otherwise) for connecting various peripherals. It is also known as a printer port or Centronics port . The IEEE 1284 standard defines the bi-directional version of the port. fig :DB25 female connector Traditionally IBM PC systems have allocated their first three parallel ports according to the configuration in the table below. PORT NAME Interrupt # Starting I/O Ending I/O LPT1 IRQ 7 0x37f LPT2 IRQ 5 0x378 0x278 LPT3 IRQ 5 0x3bc 13 0x27f 0x3bf Table 3 If there is an unused LPTx slot, the port addresses of the others are moved up. (For example, if a port at 0x3bc does not exist, the port at 0x378 will then become LPT1.) The IRQ lines, however, remain fixed (therefore, 0x378 at LPT1 would use IRQ 7). The port addresses assigned to each LPTs slot can be determined by reading the BIOS Data Area (BDA) • Relay switch driven by 6volt dc • Resistors : 3 resistors each of 1.5 k ohm in series • SL100 power transistor • Ceramics pnp transistor • Diode 14 Platform and Development Environment Platform scenario of the mobile devices programming is shown below Platform Java Symbian Series 60 Linux Window mobile Palm OS Users(in million) 700 70.5 50 11.6 4.5 1.75 Table 4 From the table we observe that the Java Platform is most popular platform, so we have chosen Java as the programming platform for our Project. We have three parts in the development Environment Mobile Part We have Used J2ME to develop MIDlet Application which acts as Client in the PAN. And it sends command to PC server and receives acknowledgement form it. PC Part PC application is developed in J2SE which acts as server in the PAN. It receives command from controller and acknowledge back to it. Parallel Port We have used J2SE and JNI environment for the Parallel Port implementation. When special commands Parallelon and Paralleloff command is received by the PC it write data to the port address 0x378. 15 Methodology As we have more options to develop this project but keeping in mind the ease of development, knowledge of the Programming languages and the software tools available. We have dealt with the different languages and the technologies according to the requirement of the the application on different devices and the modules. The modules msde with their complete information block diagrams are explained below. We have categorized the Application in the following modules • The Controller • The PC Application • Parallel port connection • The GUI The Controller Controller is the remote devices which are supposed to control the PC. The J2ME is the programming Language used to program the application and the IDE used is NetBeans It consists of the mobility package. The MIDlet is developed and the .jar file thus built is installed in the mobile device. It sends the commands in terms of the text message. The text message is the commands of the Windows Xp as well as the other specifically designed for our purpose to control the parallel port. We use Bluetooth as the channel for the data transmission which is the latest technology on wireless technology. The program in the mobile device performs the following procedures. • Work as a client for the PC Application • It stays in hunting condition for the server (PC Application) to get connected. • Connection is served as a Serial Port Service. • Input the command from the keypad of the mobile device. • When the command is encoded and is sent in stream. • The acknowledgement is received after the completion of the command. 16 • Log of the connection is stored in the application. Block diagram of the controller is given below Input decode e Send data Bluetooth System Listen Ack PC Fig controller block diagram PC Application We have used a PC as the server for the Application. The command sent from the remote device, the controller is received by the PC and then it is run on the computer. The commands are received as the test message via Bluetooth Most of the commands is the command used by the Windows command prompt they are run by the help of the runtime class. The special commands are parallelon and paralleloff. These are used to control the parallel port. Receiving the command is done by the help of the Bluetooth. We have used the Bluetooth Dongol as the hardware and the Blucove API as the api to program the Bluetooth connection part. Similar to the mobile device we have received the data using the readUTF() method which decodes the encoded text encoded by the writeUTF() method. The transmission is the Stream transmission. The program in the PC performs the following procedures. • Initializes the Bluetooth device • Starts the server thread and wait for the connection. • When any Bluetooth devices come within the Bluetooth region it connects to it and inquires the services. • If the service is the serial port profile(SPP) service then it waits for the command sent from the controller. • When command is received it runs the command through the runtime method and the command is executed. If the command is related to parallel port it works accordingly. 17 • After the command is completed it sends the acknowledgement back to the controller. And writes the log on the console. • When the client is disconnected it continues searching the other devices in range. The block diagram of the PC program is Inquiry BT devices Inquiry BT services If SP Connect Wait for command Acknowledge Controller Execute Log Fig block diagram of PC application Parallel Port This is the next component of our project which includes the hardware design to operate a relay switch using the parallel port of the PC. The port address used for this is 0x 378. We have programmed this in JAVA using the JNI i.e. Java Native Interface. This is the process where the program written in different language is included in the java and the methods in that file (native program) are called from the java file. For this purpose we have used a .dll file named jnpout.dll as the native file which we downloaded from the internet. As stated earlier the command parallelon and paralleloff are used for the parallel port interfacing. The text message as a command is received and the class PMTS is called which consists of the methods that calls the native methods. Then for the parallelon command we have sent the hex 10 to the hex 378 address and hex 00 for the paralleloff command. The both command operations are included in the separate thread so that they can be handled independently. For the case of the hardware implementation we have used the following circuit 18 Vcc | +-----+------+ Parallel Port D --| 1N4001 / \ Relay coil /---\ | | | +-----+------+ | | R | / | 4.7K B |/ C T1 | Data----------------------\/\/\/\/---| BC547A | |\ E | | V | / | B |/C T2 +----------| sl100 |\E | v | Port GND -----------------------------------------+ external circuit ground Fig circuit diagram of the parallel Port interfacing Fig Hardware implementation The GUI For our purpose we have used two different GUI i.e. for PC part and for the mobile device part. Although we have not much emphasized on the GUI of the PC.For this purpose we have made just a frame which displays the client connection with its name and the connection time. The command sent from the mobile device is also displayed. After the completion of the command execution, acknowledge sent to mobile device is also displayed. 19 Similarly for he case of the mobile part we have made a message area which displays the command sent and the acknowledgement received, and a command area (text area) which takes the input of the commands from the user. The mobile and PC GUI is shown below. Fig mobile GUI Fig PC GUI 20 Implementation The implementation of the complete project is shown in the UML Diagram below Controller .User PC Server Parallel Port Device Start Command Receive Command Send OS command Execute Special command Port Write Relay Operation ACK Send Fig Complete UML diagram of the project 21 Installation Process Any java enabled mobile with the Bluetooth support is required for the installment of the mobile part of the project. For the case of the PC part we need the Java installed PC with Windows Operating system. Mobile part installation process is given below (We can use the PC suite for the installation we used Nokia 6300 PC Suite for our purpose) • Install the PC Suite • Install the mobminor.jar file to the mobile using the PC suite • On the Bluetooth in the device. • Complete the Bluetooth connection process • Start the installed software in the Mobile It is now ready to send the command to control the PC Installation process on PC • Copy the jnpout.dll file to the folder listed in the system path, generally System 32 is included in the System path or you can list the folder containg the file in the system path yourself. • Connect the Bluetooth Dongol to the PC • Connect the parallel port connector to the port on PC • Start the program When the program is started it will automatically search for the devices near it. when the devices found it searches for the Bluetooth services. If the mobminor is ON, it finds the required services and the connection between the server and the client is connected. You are now ready to start the command control. 22 Limitations First we thought to develop the application that can control our PC and home appliances connected to it by parallel port from any where by sending the SMS( Short Message Service).The SMS was supposed to be accepted by the Mobile that is with in the network(Bluetooth range) of the PC and that Mobile was supposed to interpret the simple message and command and sent command to the server PC via Bluetooth . But later we realized that the SMS port reading is not supported in J2ME (Java2 Micro Edition), we decided to confine within the range of Bluetooth Network .So our project cannot be implemented beyond the range of Bluetooth support. Due to the lack of different hardware modules like X10 modules we could not implement our application directly to the home appliances rather we used the Relay for the indicating on and off of the devices. Our GUI part of the application at the PC side is not much attractive since we are concentrated only on the functional part of the application in the PC side. Also our project can be implemented only to those mobiles that support profile MIDP2.0 and configuration CLDC1.1 and those which are Bluetooth enabled. But it is expected to work with in the mobile that support CLDC1.0 since CLDC 1.1 is backward compatible with CLDC1.0 23 Future Enhancement As we have stated our project has some limitations due to the limitation of technology and availability of some hardware. We can overcome some limitations of our project by developing it in the C language and Symbian OS Platform. In which we can send the SMS to the agent Mobile that is readily connected to the Bluetooth enabled PC. The agent Mobile first interprets the incoming message and sends to the PC server if it is command. So we can control the PC and Home appliances like TV, Micro oven, Rice Cooker etc that are connected via parallel port from any where independent of Bluetooth viable distance .It can be further extended to communicate with any body residing in the computer via our mobile phone Basically we can implement our application only in the window platform but we can work further to make our application platform independent. 24 References • Bruce Eckel, Thinking in Java, Prentice Hall India • Deitel And Deitel, How to program Java,Pretience Hall India • Beginning J2ME: From Novice to Professional, Third Edition,Jonathank Knudsen and Sing Li, Apress • S60 Programming A tutorial Guide,Paul Coulton and Reuben Edwards withHelen Clemson,wiley • Forum Nokia, forum.nokia.com] 25