Coder Social home page Coder Social logo

chungyenlai / android-arduino-bluetooth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hmartiro/android-arduino-bluetooth

0.0 1.0 0.0 260 KB

Demo of a clear and simple way to interface Android and Arduino over a Bluetooth connection

License: MIT License

Java 78.94% C++ 21.06%

android-arduino-bluetooth's Introduction

android-arduino-bluetooth

Demo of a clean and robust way to interface Android and Arduino devices over a Bluetooth connection.

Features:

  • Bluetooth using SoftwareSerial on Arduino
  • Separate thread for Bluetooth RX/TX in Android
  • Basic UI for connecting, disconnecting, reading, and writing
  • Exception handling for failed connections
  • Parsing of complete messages using a delimiter character
  • Forwarding of messages from USB serial to bluetooth on Arduino
  • Lots of comments

Requirements:

  • Android device with Bluetooth enabled.
  • Arduino with a Bluetooth module (BlueSMiRF Silver tested), wired to digital input pins.
  • Android Studio and an Arduino IDE.

Usage:

  • For Android, set the MAC address of your Bluetooth module in BluetoothActivity.java.
  • For Arduino, set the RX and TX pin numbers you wired up.
  • Load the Android app, the Arduino sketch, and hit Connect.
  • Open the Arduino Serial Monitor, set the baudrate to 19200, and use Newlines.
  • Enter a message into the serial monitor, hit enter, and it will show up next to "Read:" in the app.
  • Enter a message and hit Write in the app and it will show up in the Serial monitor.

Files to look at:

  • BluetoothThread.java
  • BluetoothActivity.java
  • activity_bluetooth.xml
  • bluetooth_demo.ino

Issues:

  • Bluetooth socket still fails to connect once in a while (my hardware?)
  • Can't seem to get higher than 19200 bps with SoftwareSerial
  • Connected/disconnected events in Android should have their own message types
  • Handle arbitrary data (delimiter) by implementing escaping (possibly overkill)

android-arduino-bluetooth's People

Contributors

hmartiro avatar

Watchers

James Cloos 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.