KEMBAR78
Controlling an Arduino with Android | PPTX
Android Communications with Arduino
Two Aspects 
Arduino: 
● Receiving 
commands 
● Switching pins 
on/off 
Android: 
● Send commands
Arduino Equipment 
● Arduino card(s) 
● Arduino WiFi shield(s) 
● USB a-b cable(s) 
o for power and program uploads
Android Equipment 
● Android tablet/phone 
● Android stock USB cable 
o for program uploads
Arduino Software 
● Arduino IDE 
o version 1.0.5 
o for Windows, Mac, and Linux
Android Software I 
There is a choice to be made here: 
● Android Developer Tools (ADT) 
o more accessible to beginners 
o older 
● Android Studio 
o more powerful 
o unstable
Android Software II 
● Portable Wi-Fi hotspot Free 
o Creates wireless hotspot 
 Local, no satellite 
o an app for the Android device 
o by Core Technology 
o available on Google Play
Arduino Programming 
● C syntax 
● Very limited 
● Extended with C++ 
libraries
Android Programming 
● Java programming language 
● Relatively simple 
● Intimidating for beginners
Android: It’s just Java 
● Android is just an 
interface. 
● This code can be 
used wherever 
Java is supported.
Network 
● This is not programmed 
● The Android device is the router 
● The Arduino cards are assigned IP 
addresses 
● Everything over a hotspot 
o Portable Wi-Fi hotspot Free
Hotspot Pros 
● Simple 
● Leave the job up to another app
Hotspot Cons 
● Credentials are hard-coded for Arduino 
cards 
o change source code for new networks 
● Not as reliable as other protocols 
● Extremely roundabout 
● Dependent on another app
UDP 
● User Datagram 
Protocol 
● One-way 
communication 
● Used for sending 
commands
Network: The Right Way 
● Bluetooth 
● mDNS - multicast Domain Name System 
o Used by Google Chromecast
Final Arduino to App Logic 
1. Start Portable Wi-Fi hotspot Free on host 
Android 
2. Turn on Arduino boards 
3. Turn on Android app 
4. Wait for Arduino boards to connect 
5. Send commands
Final Thoughts 
● Arduino boards are simple to program 
● Android programming is the hard part 
● The networking portion can be vastly 
improved
Fork it on GitHub! 
The projects can be found here: 
● Arduino code - 
https://github.com/pori/arduino-udp-client 
● Android code - 
https://github.com/pori/ArduinoControllerExa 
mple
Useful Resources 
● Arduino website for downloads and tutorials - http://arduino.cc/ 
● Android development (choose one): 
o Android Developer Tools - http://developer.android.com/sdk/index.html 
o Android Studio - https://developer.android.com/sdk/installing/studio.html 
● Android source code - https://github.com/pori/ArduinoControllerExample 
● Arduino source code - https://github.com/pori/arduino-udp-client

Controlling an Arduino with Android

  • 1.
  • 2.
    Two Aspects Arduino: ● Receiving commands ● Switching pins on/off Android: ● Send commands
  • 3.
    Arduino Equipment ●Arduino card(s) ● Arduino WiFi shield(s) ● USB a-b cable(s) o for power and program uploads
  • 4.
    Android Equipment ●Android tablet/phone ● Android stock USB cable o for program uploads
  • 5.
    Arduino Software ●Arduino IDE o version 1.0.5 o for Windows, Mac, and Linux
  • 6.
    Android Software I There is a choice to be made here: ● Android Developer Tools (ADT) o more accessible to beginners o older ● Android Studio o more powerful o unstable
  • 7.
    Android Software II ● Portable Wi-Fi hotspot Free o Creates wireless hotspot  Local, no satellite o an app for the Android device o by Core Technology o available on Google Play
  • 8.
    Arduino Programming ●C syntax ● Very limited ● Extended with C++ libraries
  • 9.
    Android Programming ●Java programming language ● Relatively simple ● Intimidating for beginners
  • 10.
    Android: It’s justJava ● Android is just an interface. ● This code can be used wherever Java is supported.
  • 11.
    Network ● Thisis not programmed ● The Android device is the router ● The Arduino cards are assigned IP addresses ● Everything over a hotspot o Portable Wi-Fi hotspot Free
  • 12.
    Hotspot Pros ●Simple ● Leave the job up to another app
  • 13.
    Hotspot Cons ●Credentials are hard-coded for Arduino cards o change source code for new networks ● Not as reliable as other protocols ● Extremely roundabout ● Dependent on another app
  • 14.
    UDP ● UserDatagram Protocol ● One-way communication ● Used for sending commands
  • 15.
    Network: The RightWay ● Bluetooth ● mDNS - multicast Domain Name System o Used by Google Chromecast
  • 16.
    Final Arduino toApp Logic 1. Start Portable Wi-Fi hotspot Free on host Android 2. Turn on Arduino boards 3. Turn on Android app 4. Wait for Arduino boards to connect 5. Send commands
  • 17.
    Final Thoughts ●Arduino boards are simple to program ● Android programming is the hard part ● The networking portion can be vastly improved
  • 18.
    Fork it onGitHub! The projects can be found here: ● Arduino code - https://github.com/pori/arduino-udp-client ● Android code - https://github.com/pori/ArduinoControllerExa mple
  • 19.
    Useful Resources ●Arduino website for downloads and tutorials - http://arduino.cc/ ● Android development (choose one): o Android Developer Tools - http://developer.android.com/sdk/index.html o Android Studio - https://developer.android.com/sdk/installing/studio.html ● Android source code - https://github.com/pori/ArduinoControllerExample ● Arduino source code - https://github.com/pori/arduino-udp-client