Giter VIP home page Giter VIP logo

android-ble-to-arduino's Introduction

Android-BLE-to-Arduino

This code can be used to communicate with an Arduino and is based on sample code from Google and another githubber.

Google : http://developer.android.com/reference/android/app/Service.html

GitHub : https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html

Introduction

The easiest, least expensive way to add Bluetooth Low Energy communication capabilities to an Arduino is to use one of the HM-10 modules which are readily avaailable on Ebay. These modules are great because they wrap all the BLE communication code in their firmware so on the Arduino side you're simply reading the serial port.

Suppose you want to control an Arduino powered robot or a string of RGB LEDs from an Android device. Define a simple serial protocal so that 'r' means turn right, 'l' means turn left or 'b' means turn the lights blue, 'g' means turn the lights green and so on. Use the app to send the proper characters from Android and read the serial port in Arduino to get commands. Remeber that there is a 20 character limit when sending data via BLE.

Becuase this app is based on the Google sample of a chat program you will see in the attached screen shot the text imput interface with a "Send" button. That UI would work well for testing then you could add an interface with whatever buttons or controls you wish knowing that the lower level code to send commands is working.

Images

Screenshot Screenshot Screenshot

Setup

This project builds on my computer using Android Studio 2.3.1.

The CC2541 chip on a HM-10 module runs at 3.3v. The module on the photo allows 5v input, so the wiring is Arduino 5V => HM-10 5V, Arduino GND => HM-10 GND and Arduino RX => HM-10 TX (pink, green and yellow wires, respectivley, in the photo). This setup only sends in one direction, be aware that you probably want to do level shifting for two way communication.

See the BLE_echo directory for the Arduino code used to test the app.

android-ble-to-arduino's People

Contributors

richhowley 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.