Wireless Communication between Android Application and Sensors

Slides:



Advertisements
Similar presentations
Bluetooth. Wireless networking technology Limited broadcast range (< 10 meters) Example uses include Connecting headsets to phones, keyboard/mouse to.
Advertisements

1 Working with the Bluetooth radio Nilanjan Banerjee Mobile Systems Programming University of Arkansas Fayetteville, AR
MM Player Supervised by: Dr. Luai Malhis. Prepared by: Mustafa Assaf & Mahmoud Musa.
BEYOND SMARTPHONES WITH RASPBERRY PI BY - ASHISH KSHIRSAGAR.
Controlling Robot Car via Smartphone Supervisor: Dr. Jamal Kharousheh Prepared by : Hamza Qaddara Esmat Hedariya Hareth Hanani Faculty of Engineering Telecommunication.
A CHAT CLIENT-SERVER MODULE IN JAVA BY MAHTAB M HUSSAIN MAYANK MOHAN ISE 582 FALL 2003 PROJECT.
Remote Surveillance Vehicle Design Review By: Bill Burgdorf Tom Fisher Eleni Binopolus-Rumayor.
Installing software on personal computer
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
Building an Application Server for Home Network based on Android Platform Yi-hsien Liao Supervised by : Dr. Chao-huang Wei Department of Electrical Engineering.
Bluetooth. Bluetooth is an open, wireless protocol for exchanging data between devices over a short distance. –managed by the Bluetooth Special Interest.
CS378 - Mobile Computing Connecting Devices. How to pass data between devices? – Chat – Games – Driving Options: – Use the cloud and a service such as.
Home controlling system based on Galileo Final Semester Presentation Started at: Winter 2015 Project supervised by: Mony Orbach Project performed by: Khalid.
ANDROID Presented By Mastan Vali.SK. © artesis 2008 | 2 1. Introduction 2. Platform 3. Software development 4. Advantages Main topics.
NATIONAL INSTITUTE OF SCIENCE & TECHNOLOGY Presented by: Santosh kumar Swain Technical Seminar Presentation by SANTOSH KUMAR SWAIN Roll # CS
IBM - CVUT Student Research Projects Remote Control of a Furby Toy with BlueTooth Tomáš Kunc
MobileMAN Internal meetingHelsinki, June 8 th 2004 NETikos activity in MobileMAN project Veronica Vanni NETikos S.p.A.
Saahithi Chillara Radhika Goyal ECE Fall Senior Design Project.
OIC Open Source Work Group. 1 Architecture IoTivity v1.0 CA API CA Control Network Config. Network Config. CoAP Protocol CoAP Protocol Interface Controller.
1. 2 Android location services Determining a device’s current location Tracking device movements Proximity alerts.
1. Presentation Agenda  Identify Java Card Technology  Identify Elements of Java Card applications  Communicating with a Java Card Applet  Java Card.
BLUETOOTH LOW ENERGY Kieon Seong. Introduction  Chap 1. What is Bluetooth Low Energy? Difference Between Classic Bluetooth Device Types Design Goals.
Tutorial on Bluetooth Low Energy(BLE)
Presenter: Tyler Newsome
Voice Controlled Robot by Cell Phone with Android App
Agenda BLE in IoT devices Bluetooth Low Energy Protocol Stack
Michael Rahaim, PhD Candidate Multimedia Communications Lab
Smart Parking Application
<Add team picture or relevant project picture here>
Quick services Wala Amjad Faqeh. Computer engineering
I/O SYSTEMS MANAGEMENT Krishna Kumar Ahirwar ( )
Bluetooth.
Bluetooth connection & GAIA protocol
Connected world in android
Enable Talk Prepared By: Alaa Mayyaleh Shurouq Abu salhiah.
Bluetooth History and Uses.
Bluetooth Low Energy Overview.
Cloud Architecture Internet of Everything Meetup
Atoll Solutions PVT LTD
Instructor: Mazhar Hussain
Arduino & its hardware interfacing
Outline Introduction Standards Project General Idea
IzoT™ Device Stacks March 2014.
Smart Bandage Wound Monitoring Through a Connected Smart Bandage
Monitoring Robot Prepared by: Hanin Mizyed ,Abdalla Melhem
Chapter 3 Internet Applications and Network Programming
Bluetooth Low Energy Bluetooth Smart Nenad Četić – Makers NS.
Activities and Intents
Arduino Part 1 Topics: Microcontrollers Programming Basics
Programming with Arduinos and Rapsberry Pi
Lecture 12: Bluetooth LE Topics: BLE Basics, code example.
Remote Controlled Smart Socket
Insights into designing short range communication interface for IOT
Chapter 3: Windows7 Part 4.
Roller Coaster Design Project
Understanding Wi-Fi Direct in Windows 8
FeMaidens Programming
Serial Data Hub (Proj Dec13-13).
Intro to the Arduino Topics: The Arduino Digital IO
Networked Door Locking System
Software models - Software Architecture Design Patterns
Enable Talk Prepared By: Alaa Mayyaleh Shurouq Abu salhiah.
Short-Range Radio Frequency Networking
Tareq Khan, Ph.D. Assistant Professor,
Short-Range Radio Frequency Networking
Wireless networking Rytis Garbauskas.
Lecture 12: Bluetooth LE Topics: BLE Basics, code example.
Mobile Programming Dr. Mohsin Ali Memon.
PAN1740 Beacon.
Network programming Lecture 1 Prepared by: Dr. Osama Mokhtar.
Presentation transcript:

Wireless Communication between Android Application and Sensors CS2310 MSE Seminar Android Application Sensors Bluetooth(Bluetooth Low Energy)

Topics Wireless communication among devices in local environment Wireless communication between sensors & Android application Development of Android application Wireless communication between sensors & Android application via Bluetooth

Wireless communication among devices in local environment Devices on the same local network Network Service Discovery (NSD) Server Socket and Client Socket(not exactly local) Peer to peer Near Field Communication (NFC) WiFi-P2P Bluetooth-based communication between devices or sensors Classic Bluetooth Bluetooth Low Energy

Wireless communication between sensors & Android application Bluetooth Low Energy: In contrast to Classic Bluetooth, Bluetooth Low Energy (BLE) is designed to provide significantly lower power consumption. This allows Android apps to communicate with BLE devices that have low power requirements, such as proximity sensors, heart rate monitors, fitness devices, and so on. Classic Bluetooth: A device to wirelessly exchange data with other Bluetooth devices. Classic Bluetooth is the right choice for more battery-intensive operations such as streaming and communicating between Android devices.

Wireless communication between sensors & Android application via Bluetooth What do we need? Sensors Arduino & Arduino IDE(Integrated Development Environment) Alternative platforms: Galileo, Raspberry Pi, Single-chip microcomputers, etc. Arduino is an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board. Bluetooth module Android development environment Java environment & Android IDE

Step 1: Hardware setup Connect the Bluetooth module to Arduino board

Step 2: Communication serial port & pin configuration Choose a serial port to be used as communication port Choose pins on the Arduino to be configured as inputs Choose pins on the Arduino to be configured as outputs

Step 3: Developement on Arduino side void setup() { // initialize serial communications Serial.begin(9600); ... // set pin to input pinMode(inputPinNumber, INPUT); // set pin to output pinMode(outputPinNumber, OUTPUT); }

Step 3: Developement on Arduino side void loop() { //write data to the serial port Serial.println(“”); //read data from the serial port if(Serial.available()) { data = Serial.read(); } //read data from an input pin inputValue = analogRead(inputPinNumber); //Write data to the output stream digitalWrite(outputPinNumber, OUTPUT_STATUS);

Step 4: Developement on Android side - Get prepared Android IDE Android Studio(IntelliJ,Alternative: Eclipse)

Step 4: Developement on Android side - Get prepared Android components - Activities An activity represents a single screen with a user interface. An activity is implemented as a subclass of Activity.

Step 4: Developement on Android side - Get prepared - BLE Types Length limit of a characteristic: 20 bytes long. Think of a Bluetooth LE peripheral device(server) as a bulletin board and central devices(clients) as viewers of the board. Central devices view the services, get the data, then move on. Each transaction is quick (a few milliseconds), so multiple central devices can get data from one peripheral.

Step 4: Developement on Android side - Get prepared Generic Attribute Profile (GATT): The GATT profile is a general specification for sending and receiving short pieces of data known as "attributes" over a BLE link. All current Low Energy application profiles are based on GATT. Attribute Protocol (ATT)—GATT is built on top of the Attribute Protocol (ATT). This is also referred to as GATT/ATT. ATT is optimized to run on BLE devices. To this end, it uses as few bytes as possible. Each attribute is uniquely identified by a Universally Unique Identifier (UUID), which is a standardized 128-bit format for a string ID used to uniquely identify information. The attributes transported by ATT are formatted as characteristics and services. GATT is the layer that defines services and characteristics and enables read/write/notify/indicate operations on them.

Step 4: Developement on Android side - Bluetooth APIs BLE Permissions In order to use Bluetooth features in the application, we must declare the Bluetooth permission BLUETOOTH. we need this permission to perform any Bluetooth communication, such as requesting a connection, accepting a connection, and transferring data. Declare the Bluetooth permission(s) in the application manifest file. For example: <uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

Step 4: Developement on Android side - Bluetooth APIs Setting up BLE Get the BluetoothAdapter // Initializes Bluetooth adapter. final BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE); mBluetoothAdapter = bluetoothManager.getAdapter(); Enable Bluetooth // Ensures Bluetooth is available on the device and it is enabled. If not, // displays a dialog requesting user permission to enable Bluetooth. if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()) { Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT); }

Step 4: Developement on Android side - Bluetooth APIs Finding BLE services // Device scan callback. private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() { public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) { runOnUiThread(new Runnable() { @Override public void run() { //find a device } }); };

Step 4: Developement on Android side - A simple demo

Step 4: Developement on Android side - Bluetooth APIs Connecting to a GATT server The first step in interacting with a BLE device is connecting to it— more specifically, connecting to the GATT server on the device. mBluetoothGatt = device.connectGatt(this, false, mGattCallback); private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() { @Override public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { String intentAction; if (newState == BluetoothProfile.STATE_CONNECTED) { } else if (newState == BluetoothProfile.STATE_DISCONNECTED) { } public void onServicesDiscovered(BluetoothGatt gatt, int status) { if (status == BluetoothGatt.GATT_SUCCESS) { } else { public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic,int status) { ... };

Step 4: Developement on Android side - A simple demo

Step 4: Developement on Android side - Bluetooth APIs Reading BLE attributes Once the Android application has connected to a GATT server and discovered services, it can read and write attributes, where supported. Reading BLE services Once your Android app has connected to a GATT server and discovered services, it can read and write attributes, where supported. Closing the application Once the application has finished using a BLE device, it should call close() so the system can release resources appropriately.

Step 4: Developement on Android side Uniform & Bluetooth-form independent solution Bluetooth signal can come from different forms: Classic Bluetooth: PC or mobile devices. Bluetooth Low Energy (BLE): Arduino, Single-chip microcomputers, etc. A general communication interface could be utilized: public class TDRCommunicationInterface { //get sensor name String getSensorName(); //read data from the serial port Boolean connectToSensor(); String collectData(); Boolean stopSensor(); } We can also utilize the Java Reflection Technology for dynamically loading Bluetooth drivers if needed by using the interface above. In that case, we won't have to update the application version whenever a new sensor comes in. https://developer.android.com/reference/android/bluetooth/BluetoothHealthCallback.html

REFERENCES https://publications.theseus.fi/bitstream/handle/10024/78079/Patanen_Marko.pdf?sequence=1 http://mips.lrdc.pitt.edu/courses/cs2610/restricted/HW2.pdf http://ieeexplore.ieee.org/document/6196980/?reload=true&arnumber=6196980 https://developer.android.com/guide/topics/connectivity/bluetooth.html https://developer.android.com/guide/topics/connectivity/bluetooth-le.html#read https://www.arduino.cc/en/Reference/CurieBLE

Thank you!