Giter Club home page Giter Club logo

sphero-bluemix-android's Introduction

sphero-bluemix-android

This project is a simple Android app that demonstrates how to steer a Sphero ball via URL commands using IBM Bluemix, the MQTT protocol and the IBM Internet of Things service. Watch the video and read the slides to learn more.

<iframe src="//www.slideshare.net/slideshow/embed_code/key/GojsUXfMPU2Aty" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe>

For the communication between the Android app and IBM Bluemix the MQTT client Paho from Eclipse is used that comes with the project. For the communication between the Android app and the ball over bluetooth the Sphero Android SDK is used. Since the SDK is not available under an open source license three files need to be downloaded and copied into the Android project.

Author: Niklas Heidloff @nheidloff

Import of the Android Project

Download these files from the Sphero SDK.

In the easiest case copy the files to the directories as documented in the screenshots before importing the project in Android Studio.

After this open Android Studio and import the project. This should result in the following project structure - Project, Android.

Setup of the Bluemix Application and the Node-RED Flow

In order to send commands to the Android app a Node-RED flow in IBM Bluemix is used in combination with the IBM Internet of Things Foundation.

Log in to Bluemix and create a new application, e.g. MySphero, based on the Internet of Things Foundation Starter. Additionally add the Internet of Things service to it.

In the next step you have to register your own device. Open the dashboard of the Internet of Things service and navigate to 'Add Device'. As device type choose 'and' (for Android) and an unique device id - screenshot. As result you'll get an org id and password - screenshot.

In order to import the flow open your newly created Bluemix application and open the Node-RED editor, e.g. http://mysphero.mybluemix.net/red, and choose [import from clipboard]((https://raw.githubusercontent.com/IBM-Bluemix/sphero-bluemix-android/master/images/nodered4.png). You find the flow in the sub-directory 'noderedflow'. In the outgoing IoT node select your unique device id and deploy the application.

Run the Android App and invoke URLs

Before running the app you need to enter the Internet of Things configuration from the previous step in the Java class net.bluemix.sphero.MainActivity: org, device id and password.

The app can not be run via the emulator but only actual Android devices. Make sure that both Wifi and Bluetooth are enabled.

Launch the app 'Sphero Bluemix' on your Android device and select your Sphero ball. Once the ball is connect, press the 'Connect' button to also connect to Bluemix. After this you can see the connected device in the IoT dashboard. You can now invoke the following URL commands to steer the Sphero ball.

alt text

sphero-bluemix-android's People

Contributors

nheidloff avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.