Sending and Receiving Data Between Mobile and Data Logger
Total Page:16
File Type:pdf, Size:1020Kb
Sending and Receiving Data between Mobile and Data Logger Nanda Kishore Abbaraju ELECTRICAL ENGINEERING Informationsutbyte/överföring från datalogger till mobiltelefon (via bluetooth) Nanda Kishore Abbaraju Detta examensarbete är utfört vid Tekniska Högskolan i Jönköping inom ämnesområdet elektroteknik . Arbetet är ett led i teknologie magisterutbildningen med inriktning inbyggda elektronik- och datorsystem. Författarna svarar själva för framförda åsikter, slutsatser och resultat. Handledare : Joakim Staberg Examinator: Youzhi-Xu Omfattning: 20 poäng (D-nivå) Datum: Arkiveringsnummer: Postadress: Besöksadress: Telefon: Box 1026 Gjuterigatan 5 036-10 10 00 (vx) 551 11 Jönköping Abstract The goal of this project is to develop Mobile application using Bluetooth API to communicate with Data Logger and to receive the data and display on the screen. Special option should be created for the user to send the received data to web server. Main issue of using Bluetooth is to replace cables and low cost. The results show the temperature values for every received byte from Data Logger on mobile screen. This thesis explains about Bluetooth, J2ME, java API for Bluetooth and necessary infrastructure to develop mobile applications using Bluetooth for communicating with Data Logger. i Sammanfattning Sammanfattning Målet med detta examensarbete är att utveckla en mobil applikation där en handburen enhet, i detta fall en mobiltelefon, använder ett Bluetooth API som kommunicerar med en datalogger för att hämta temperaturdata och visualisera på mobiltelefonens skärm. Från telefonen skall möjligheten finnas att publicera informationen på en webbserver. Orsaken till att Bluetooth används är dess möjligheter att skapa ett trådlöst system till en låg kostnad. Informationen som visas på telefonens skärm är all temperaturdata som hämtats från dataloggern vid ett tillfälle. Examensarbetet behandlar; Bluetooth, J2ME, java, Bluetooth API och övriga gränssnitt som krävs för att skapa denna typ av applikation. ii Acknowledgements Acknowledgements I find myself overwhelmed in offering my parents all my thanks in dedicating this thesis to them. First of all I would like to thank Joakim Staberg for giving me the opportunity to work with this thesis. I would like to thank to my brother Praveen who has been a great support all through this work. Also I would like to thank my parents Satyanarayana and Kameswari for their patience, moral support and understanding allowed me to complete this thesis. Thanks to Joakim Staberg and Evgueni rabotchi who helped me all the time of this thesis. Thanks to all my friends who were far away from me, still providing me the confidence, encouragement throughout the thesis. To each of the above I extend my deepest appreciation. Thank you for all your support and guidance. iii Key words Key words Data Logger, Bluetooth, MIDlet, J2ME, RFCOMM. iv Contents Contents 1 Introduction ................................................................................ 1 1.1 PURPOSE /O BJECTIVES ................................................................................................................. 3 1.2 THESIS OUTLINE .......................................................................................................................... 3 2 A brief introduction to Bluetooth ................................................. 4 2.1 BACKGROUND ............................................................................................................................. 4 2.2 BLUETOOTH ARCHITECTURE ....................................................................................................... 5 2.3 PICONET ...................................................................................................................................... 6 2.4 L2CAP (LOGICAL LINK CONTROL AND ADAPTATION PROTOCOL ) LAYER .................................... 7 2.5 RFCOMM ..................................................................................................................................... 8 2.5.2 MULTIPLE EMULATED SERIAL PORTS ........................................................................................... 9 2.5.3 LIMITATIONS OF USING RFCOMM ............................................................................................ 10 2.5.4 CLIENT CONNECTIONS USING RFCOMM PROFILE ..................................................................... 10 2.6 DEVICE DISCOVERY ..................................................................................................................... 10 2.7 SERVICE DISCOVERY .................................................................................................................... 11 2.8 BLUETOOTH PROFILES .................................................................................................................. 12 3 Development tools .................................................................... 15 3.1 J2ME ........................................................................................................................................... 16 3.1.1 CONFIGURATIONS AND PROFILES ............................................................................................... 17 3.1.2 CONNECTED LIMITED DEVICE CONFIGURATION (CLDC) .......................................................... 17 3.3 MID LET .................................................................................. ERROR ! BOOKMARK OT DEFIED . 3.3.1 MID LETS DEPLOYMENT ............................................................................................................. 21 3.3.2 LOCAL DEPLOYMENT ................................................................................................................. 21 3.3.3 REMOTE DEPLOYMENT .............................................................................................................. 21 3.3.4 OTA OVER THE AIR .................................................................................................................... 22 4 Implementation ........................................................................ 22 4.1 SOFTWARE TOOL ........................................................................................................................... 22 4.2 DATALOGGER ARCHITECTURE ....................................................................................................... 23 4.3 SMARTPHONES .............................................................................................................................. 23 4.4 SENDING DATA TO WEB SERVER FROM MID LETS ......................................................................... 37 5 Demonstration and some test results ............................................ 38 5.1 DEMOSTRATION ............................................................................................................................ 38 5.2 NETWORKING DISTANCE ............................................................................................................... 40 5.3 CO -CHANNEL INTERFERENCE ....................................................................................................... 43 6 Conclusion and discussions ...................................................... 45 References ...................................................................................... 46 Appendix 1 ...................................................................................... 47 Appendix 2 ...................................................................................... 48 v List of Figures List of Figures Figure 1.1 System construction and scenario of applications Figure 2.1 Bluetooth protocol stack Figure2.2 Pico net Figure 2.3 Scatter net Figure 2.4 L2CAP with protocol layers Figure 2.5 RFCOMM Reference model Figure 2.6 Multi Emulated serial Ports Figure 3.1 Shows the J2ME architecture Figure 3.2 CLDC position in J2ME architecture Figure 3.3 Midlet architecture overview Figure 3.4 Message Frame Figure 4.1 Nokia N73 Figure 4.2 Screen displaying menu buttons Figure 4.3 Mobile screen displaying stop command. Figure 4.4 Screen displaying discovered devices Figure 4.5 Waiting for permission to requests from Data Logger Figure 4.6 Receiving communication connect with Data logger Figure 4.7 Message Frame Figure 4.8 Sequence diagram for communicating with data logger. Figure 4.9 Screen displaying no of bytes Received from data logger Figure 4.10 Mobile screen displaying permission to Temperature Figure 4.11 Waiting for user connect to web server. Figure 5.1 Received data from Data Logger Table 2.1 List of Bluetooth Profiles Table 4.1 List of mobile manufactures providing Bluetooth facality Table 4.2 Requests and Feedbacks of Data logger Table 5.1 Temperature values after converting input readout bytes Table 5.2 Results when Data Logger is placed in box. Table 5.3 Results when Data Logger placed in Fridge. Table 5.4 Results when Data Logger placed in open environment. vi List of Abbreviations List of Abbreviations CLDC Connected Limited Device Configuration GCF Generic Connection Framework J2ME Java 2 Micro Edition L2CAP Logical Link Control and Adaption Protocol MIDP Mobile Information Device Profile SDDB Service Discovery Database GAP Generic Access Profile JABWT Java APIs for Bluetooth Wireless Technology MID Mobile Information Device RFCOMM Radio Frequency Communication SPP Serial Port Profile SDP Service Discovery Protocol UUID Universally Unique Identifier WTKs Wireless Toolkits HCL Host controller interface vii introduction 1 Introduction Wireless technologies are