SlideShare a Scribd company logo
android
                arduino
          and             mixed with
                                   breakout.js




                                @musart
Who am I?

• Embedded System Software Engineer
• Android & Hybrid Application Developer
• PhoneGap Book Author
• twitter : @musart
Today Demo

Turn LED on/off




     ?
Get Button status
Way 1. using Android ADK

                     USB host




• Pros : The simplest way
• Cons : Wired connection
Way 2. using Amarino


                       Bluetooth




• Pros : Wireless connection
• Cons : Bluetooth shield needed
Way 3. breakout.js
             USB
              to
            Serial
                                  WiFi




• Pros : Wireless connection, No more shield
• Cons : Server PC needed
Arduino
         digital
                      • Open Hardware
 usb
serial
                      • 13 digital pin, 6 analog pin
                      • It works standalone with
power                   Power
             analog   • Sketch Tool
breakout.js

      Physical Input

                                     WebApp


     Physical Output


                                     MobileApp




• Connect physical I/O to Web based on Javascript
• Using WebSocket
PhoneGap
             & PhoneGap Plugin


• PhoneGap is HTML5 app platform.
• WebView in Android is not support WebSocket.
• PhoneGap also uses WebView.
• WebSocket is able to be implemented as
  PhoneGap plugin.
Software



       Firmata          Breakout.js Server Breakout.js Client
-C                     - Java                 - Javascript
- use Standard Firmata - webbit, rxtx library - jQuery library
void setup()                  bridge = new SerialBridge    ...
{                               (netPort, this, webRoot,   var IOBoard = BO.IOBoard;
  ...                           isMultiClientEnabled);     var IOBoardEvent =
  Firmata.                    bridge.begin(serialPort,       BO.IOBoardEvent;
    attach(ANALOG_MESSAGE,      57600);                    var LED = BO.io.LED;
    analogWriteCallback);     connectBtn.                  var Button = BO.io.Button;
  Firmata.                      setText("Disconnect");     var ButtonEvent =
    attach(DIGITAL_MESSAGE,   connectBtn.                    BO.io.ButtonEvent;
    digitalWriteCallback);      setActionCommand
  ...                           ("disconnect");            var arduino = new
  Firmata.begin(57600);       if (timer != null) {           IOBoard("192.168.1.2",
  systemResetCallback();        stopPortListTimer();              8890);
}                             }                            var led;
Breakout Javascript API
• Initialize
<script type="text/javascript" src="Breakout.js"></script>

var IOBoard = BO.IOBoard;
var LED = BO.io.LED;
var Button = BO.io.Button;

var arduino = new IOBoard("192.168.1.2", 8890);
var led;

arduino.addEventListener(IOBoardEvent.READY, onReady);

function onReady(event) {
  arduino.removeEventListener(IOBoardEvent.READY, onReady);

    led = new LED(arduino, arduino.getDigitalPin(11));
    var button = new Button(arduino, arduino.getDigitalPin(2));

    button.addEventListener(ButtonEvent.PRESS, onPress);
    button.addEventListener(ButtonEvent.RELEASE, onRelease);
}
Breakout Javascript API
• LED
// led = new LED(arduino, arduino.getDigitalPin(11));
function turnLedOn(evt) {
  led.on();
}
function turnLedOff(evt) {
  led.off();
}


• Button
// var button = new Button(arduino, arduino.getDigitalPin(2));
// button.addEventListener(ButtonEvent.PRESS, onPress);
// button.addEventListener(ButtonEvent.RELEASE, onRelease);
function onPress(evt) {
  var btn = evt.target;
  $('#state').html("Button "+ btn.pinNumber +" state: Pressed");
}
function onRelease(evt) {
  var btn = evt.target;
  $('#state').html("Button "+ btn.pinNumber +" state:Released");
}
Demo
Many Combinations available


   Firmata          Breakout.js Server   Breakout.js Client
                                            PhoneGap App

                                          Web App, Hybrid App




  Arduino Nano
                        Raspberry Pi




Arduino Mega 2560       Baegle Board
Reference Sites

•   Breakout.js : http://breakoutjs.com/

•   PhoneGap : http://phonegap.com/

•   PhoneGap Plugin : https://github.com/anismiles/websocket-
    android-phonegap

•   Firmata : http://firmata.org/wiki/Main_Page

•   Amernio : http://www.amarino-toolkit.net/

•   Android ADK : http://developer.android.com/guide/topics/
    usb/adk.html

•   Funnel : http://funnel.cc/
Thanks
@musart

More Related Content

PPTX
Controlling robots using javascript
PPTX
Home sensor prototype on Arduino & Raspberry Pi with Node.JS
PPT
Node.js Cloud deployment
ODP
Javascript robotics
PPTX
Node.js debugging
PDF
Роман Лютиков "Web Apps Performance & JavaScript Compilers"
PDF
Couverture de code
PDF
@arzumy Dev Setup #klxrb
Controlling robots using javascript
Home sensor prototype on Arduino & Raspberry Pi with Node.JS
Node.js Cloud deployment
Javascript robotics
Node.js debugging
Роман Лютиков "Web Apps Performance & JavaScript Compilers"
Couverture de code
@arzumy Dev Setup #klxrb

What's hot (20)

PDF
JavaScript in the Real World
PPTX
Lets make robots
PPTX
Testing nodejs apps
PDF
Asynchronous Module Definition (AMD)
PDF
Build Lifecycle Craftsmanship for the Transylvania JUG
PDF
NodeJS: n00b no more
PPTX
Windows Azure loves OSS
PDF
Detecting headless browsers
PDF
No Hugging, No Learning
PPT
Introducing to node.js
PDF
The SPDY Protocol
PDF
PDF
Let s Enjoy Node.js
PDF
The MetaCPAN VM Part II (Using the VM)
PDF
Vagrant - Version control your dev environment
PDF
CasperJS and PhantomJS for Automated Testing
PDF
Mojolicious lite
PDF
Building websites with Node.ACS
ODP
Mangling
JavaScript in the Real World
Lets make robots
Testing nodejs apps
Asynchronous Module Definition (AMD)
Build Lifecycle Craftsmanship for the Transylvania JUG
NodeJS: n00b no more
Windows Azure loves OSS
Detecting headless browsers
No Hugging, No Learning
Introducing to node.js
The SPDY Protocol
Let s Enjoy Node.js
The MetaCPAN VM Part II (Using the VM)
Vagrant - Version control your dev environment
CasperJS and PhantomJS for Automated Testing
Mojolicious lite
Building websites with Node.ACS
Mangling
Ad

Similar to Android and Arduio mixed with Breakout js (20)

PDF
Html5 game, websocket e arduino
PDF
Html5 game, websocket e arduino
PDF
How To Electrocute Yourself using the Internet
PDF
Home automation with javascript
PPTX
Bare metal Javascript & GPIO programming in Linux
PDF
Arduino Teaching Program
PPTX
CodeRage XI international Conference: Arduino + Delphi Mobile Apps
PDF
Building Droids with JavaScript
PPTX
Hackbright Workshop
PDF
Cold front - bridging the web and the physical world
PDF
Connecting Hardware to Flex (360MAX)
PDF
Arduino: interruptor de encendido controlado por Internet
PPTX
Arduino interfacing with bluetooth.
PDF
Controlling Arduino With PHP
PPTX
Using arduino and raspberry pi for internet of things
PDF
IOTC08 The Arduino Platform
PDF
Presentation for IoT workshop at Sinhagad University (Feb 4, 2016) - 2/2
PPTX
2015 02 28 DotNetSpain IoT Fight
PPTX
Final Presentation - Edan&Itzik
PDF
Abusing phones to make the internet of things - JSConf EU 2014
Html5 game, websocket e arduino
Html5 game, websocket e arduino
How To Electrocute Yourself using the Internet
Home automation with javascript
Bare metal Javascript & GPIO programming in Linux
Arduino Teaching Program
CodeRage XI international Conference: Arduino + Delphi Mobile Apps
Building Droids with JavaScript
Hackbright Workshop
Cold front - bridging the web and the physical world
Connecting Hardware to Flex (360MAX)
Arduino: interruptor de encendido controlado por Internet
Arduino interfacing with bluetooth.
Controlling Arduino With PHP
Using arduino and raspberry pi for internet of things
IOTC08 The Arduino Platform
Presentation for IoT workshop at Sinhagad University (Feb 4, 2016) - 2/2
2015 02 28 DotNetSpain IoT Fight
Final Presentation - Edan&Itzik
Abusing phones to make the internet of things - JSConf EU 2014
Ad

Recently uploaded (20)

PDF
NewMind AI Monthly Chronicles - July 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
cuic standard and advanced reporting.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPT
Teaching material agriculture food technology
PDF
Empathic Computing: Creating Shared Understanding
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Understanding_Digital_Forensics_Presentation.pptx
NewMind AI Monthly Chronicles - July 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
cuic standard and advanced reporting.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Building Integrated photovoltaic BIPV_UPV.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Review of recent advances in non-invasive hemoglobin estimation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Big Data Technologies - Introduction.pptx
Chapter 3 Spatial Domain Image Processing.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Teaching material agriculture food technology
Empathic Computing: Creating Shared Understanding
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Spectral efficient network and resource selection model in 5G networks
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Understanding_Digital_Forensics_Presentation.pptx

Android and Arduio mixed with Breakout js

  • 1. android arduino and mixed with breakout.js @musart
  • 2. Who am I? • Embedded System Software Engineer • Android & Hybrid Application Developer • PhoneGap Book Author • twitter : @musart
  • 3. Today Demo Turn LED on/off ? Get Button status
  • 4. Way 1. using Android ADK USB host • Pros : The simplest way • Cons : Wired connection
  • 5. Way 2. using Amarino Bluetooth • Pros : Wireless connection • Cons : Bluetooth shield needed
  • 6. Way 3. breakout.js USB to Serial WiFi • Pros : Wireless connection, No more shield • Cons : Server PC needed
  • 7. Arduino digital • Open Hardware usb serial • 13 digital pin, 6 analog pin • It works standalone with power Power analog • Sketch Tool
  • 8. breakout.js Physical Input WebApp Physical Output MobileApp • Connect physical I/O to Web based on Javascript • Using WebSocket
  • 9. PhoneGap & PhoneGap Plugin • PhoneGap is HTML5 app platform. • WebView in Android is not support WebSocket. • PhoneGap also uses WebView. • WebSocket is able to be implemented as PhoneGap plugin.
  • 10. Software Firmata Breakout.js Server Breakout.js Client -C - Java - Javascript - use Standard Firmata - webbit, rxtx library - jQuery library void setup() bridge = new SerialBridge ... { (netPort, this, webRoot, var IOBoard = BO.IOBoard; ... isMultiClientEnabled); var IOBoardEvent = Firmata. bridge.begin(serialPort, BO.IOBoardEvent; attach(ANALOG_MESSAGE, 57600); var LED = BO.io.LED; analogWriteCallback); connectBtn. var Button = BO.io.Button; Firmata. setText("Disconnect"); var ButtonEvent = attach(DIGITAL_MESSAGE, connectBtn. BO.io.ButtonEvent; digitalWriteCallback); setActionCommand ... ("disconnect"); var arduino = new Firmata.begin(57600); if (timer != null) { IOBoard("192.168.1.2", systemResetCallback(); stopPortListTimer(); 8890); } } var led;
  • 11. Breakout Javascript API • Initialize <script type="text/javascript" src="Breakout.js"></script> var IOBoard = BO.IOBoard; var LED = BO.io.LED; var Button = BO.io.Button; var arduino = new IOBoard("192.168.1.2", 8890); var led; arduino.addEventListener(IOBoardEvent.READY, onReady); function onReady(event) { arduino.removeEventListener(IOBoardEvent.READY, onReady); led = new LED(arduino, arduino.getDigitalPin(11)); var button = new Button(arduino, arduino.getDigitalPin(2)); button.addEventListener(ButtonEvent.PRESS, onPress); button.addEventListener(ButtonEvent.RELEASE, onRelease); }
  • 12. Breakout Javascript API • LED // led = new LED(arduino, arduino.getDigitalPin(11)); function turnLedOn(evt) { led.on(); } function turnLedOff(evt) { led.off(); } • Button // var button = new Button(arduino, arduino.getDigitalPin(2)); // button.addEventListener(ButtonEvent.PRESS, onPress); // button.addEventListener(ButtonEvent.RELEASE, onRelease); function onPress(evt) { var btn = evt.target; $('#state').html("Button "+ btn.pinNumber +" state: Pressed"); } function onRelease(evt) { var btn = evt.target; $('#state').html("Button "+ btn.pinNumber +" state:Released"); }
  • 13. Demo
  • 14. Many Combinations available Firmata Breakout.js Server Breakout.js Client PhoneGap App Web App, Hybrid App Arduino Nano Raspberry Pi Arduino Mega 2560 Baegle Board
  • 15. Reference Sites • Breakout.js : http://breakoutjs.com/ • PhoneGap : http://phonegap.com/ • PhoneGap Plugin : https://github.com/anismiles/websocket- android-phonegap • Firmata : http://firmata.org/wiki/Main_Page • Amernio : http://www.amarino-toolkit.net/ • Android ADK : http://developer.android.com/guide/topics/ usb/adk.html • Funnel : http://funnel.cc/

Editor's Notes