Connecting outsideworld with Android and Arduino

30
Godfrey Nolan

description

Using arduino and bluetooth to connect Android tablets to the outside world. Shows a number of demo apps we built in the summer of 2012.

Transcript of Connecting outsideworld with Android and Arduino

Page 1: Connecting outsideworld with Android and Arduino

Godfrey Nolan

Page 2: Connecting outsideworld with Android and Arduino

History Getting Started Connecting to the outside world Barcode scanner eBay app demo Other apps Q&A

Page 3: Connecting outsideworld with Android and Arduino

Using Classic Bluetooth

Serial Port Profile

Take advantage of the Arduino community

Limited by your own imagination

Increase shields

Easier to get up and running than iOS

Page 4: Connecting outsideworld with Android and Arduino

Bluetooth History

Android 1.5 – Bluetooth APIs

Android 2.3.3 - Security Enhancements

Android 3.0 - Bluetooth Profiles

Android 4.0 - Bluetooth Health Device Profile

Page 5: Connecting outsideworld with Android and Arduino

The following tools were used

Arduino Mega ADK Board

Arduino Bluetooth Shield

Asus Eee Pad

Eclilpse, Android SDK, Arduino IDE

Page 6: Connecting outsideworld with Android and Arduino
Page 7: Connecting outsideworld with Android and Arduino
Page 8: Connecting outsideworld with Android and Arduino

Hello World

Page 9: Connecting outsideworld with Android and Arduino

Traffic Lights

Press Buttons on Android

Toggle LEDs

Page 10: Connecting outsideworld with Android and Arduino

Android code in Eclipse Arduino sketch in Arduino IDE Put it all together Demo app

Page 11: Connecting outsideworld with Android and Arduino

Bluetooth API calls

Enable Shield

Pairing with device

Connect to Bluetooth socket

Communicate on Input and Output streams

Send and Receive Messages

Connection Management

Page 12: Connecting outsideworld with Android and Arduino

Bluetooth shield operates on serial interface. Enable shield commands

Page 13: Connecting outsideworld with Android and Arduino

Make sure the Arduino is paired with device

Page 14: Connecting outsideworld with Android and Arduino

Create and connect a BluetoothSocket Get Bluetooth Input and OutputStreams

Page 15: Connecting outsideworld with Android and Arduino

Communication is handled through streams

Page 16: Connecting outsideworld with Android and Arduino

Once connection has been established, sending and receiving messages is simple

Page 17: Connecting outsideworld with Android and Arduino

Connection Management

Page 18: Connecting outsideworld with Android and Arduino

Connection management is problematic Data coming from Bluetooth shield needs to be monitored for

connection status messages

Messages mixed in with other data from the device

Making a robust Bluetooth connection can involve a lot of computational overhead.

Arduino has no control over … Shutting the connection down

Trying to (re)establish a new connection

Page 19: Connecting outsideworld with Android and Arduino

Android device and Arduino board connected via Bluetooth

Arduino connected to barcode scanner over RS232

Barcode scanned

Info sent to the Android device

Device searches google shops for item

Upload info to eBay for sale

Page 20: Connecting outsideworld with Android and Arduino

http://www.youtube.com/watch?v=xMvZqGYFVfk

Page 21: Connecting outsideworld with Android and Arduino
Page 22: Connecting outsideworld with Android and Arduino
Page 23: Connecting outsideworld with Android and Arduino

Android code in Eclipse Arduino sketch in Arduino IDE Put it all together Demo app

Page 24: Connecting outsideworld with Android and Arduino

Credit Card Reader Breathalyzer Virtual Dashboard

Page 25: Connecting outsideworld with Android and Arduino

Credit Card Reader

http://www.youtube.com/watch?v=QVFPJnVbAao

Page 26: Connecting outsideworld with Android and Arduino

Breathalyzer

http://www.youtube.com/watch?v=WMhcQNvoJ9Y

Page 27: Connecting outsideworld with Android and Arduino

Virtual Dashboard

http://www.youtube.com/watch?v=kAjhYzEjzsg

Page 28: Connecting outsideworld with Android and Arduino

Code is relatively simple Boards are problematic Bluetooth works over 10-20ft USB for closer work Future Plans

Raspberry Pi (demo)

Page 29: Connecting outsideworld with Android and Arduino

https://github.com/riis/AndroidArduino http://shieldlist.org