To use the project with a bluetooth connection you will need an Android 3.0 or greater device with bluetooth support. You will need to pair your Android device with your Bluefruit EZ-link before you run the Smart Shaker application. If you aren't sure how to pair with a bluetooth device, follow these instructions.

Once your Bluefruit is paired with your Android device, make sure the hardware is powered up and run the Smart Shaker application that was downloaded in the previous step. Watch the first half of the video from the overview for an example of using the project with a bluetooth connection.

Android Bluetooth Development

If you want to use bluetooth to communicate with a Bluefruit EZ-link in your own project, here are some tips I found while developing this project:
  • Limit your Arduino sketch Serial communication speed to 9600 baud. This step is very important, if you try other baud rates the Android device will not be able to communicate with the Bluefruit EZ-link. Communication issues with Android and Bluefruit are still being investigated, but for now stick with 9600 baud to prevent issues.
  • Follow Android bluetooth best practices and perform all bluetooth communication outside the main UI thread. The Android bluetooth APIs are blocking and can take a few seconds to run so attempting to call them in an activity UI thread will hang your application. The smart shaker application uses a Timer to run device communication on a separate thread (and a Handler to send updates back to the UI thread). An AsyncTask is another option for offloading bluetooth communication to a separate thread.
The Android bluetooth documentation is a good resource for learning more about bluetooth development.

This guide was first published on Mar 07, 2014. It was last updated on Mar 07, 2014.

This page (Bluetooth Communication) was last updated on Mar 03, 2014.

Text editor powered by tinymce.