Main | Penguins | Projects | Travel | Photos | Publications | SensorWiki

Making Android apps that control an ArduinoBT

The combination of the Java-based programming language Processing with the Arduino microcontroller platform enables quick and easy prototyping for interactive products with a computer involved. As of the latest versions of Processing, there is Android cross-platform compilation included as well: this means that we can develop "Apps" or "sketches" in the Processing environment, and run them on an Android phone or tablet.

Android phones and tablets have Bluetooth interfaces, and so has the ArduinoBT. Would it not be interesting to control hardware with your Android phone or tablet? Below I explain how to organise and install the platforms to control an ArduinoBT from an Android application.

Install Processing with the Android SDK

Installing processing and the Andrioid SDK is explained at The most critical step here is to open the "Android SDK Manager" in Processing and to make sure the Android 2.2 API and the Google APIs are installed. I had to upgrade to Processing version 2.0a4 to make it work. The examples of Processing for Android should now work. Enable "Applications - Development - USB Debugging" in the Setting app of your Android tablet or phone. Upload is via the USB cable and not via Bluetooth. So, now you can create Android apps and run them on a mobile device.

Install SweetBlue in Processing

The process to install the SweetBlue bluetooth platform in Processing is explained at It comes down to downloading the SweetBlue package and place it as a folder in your Processing/libraries folder. I used the sweetblue-0.1.5 version. You will now have the folders

  • libraries/sweetblue-0.1.5/sweetblue/examples
  • libraries/sweetblue-0.1.5/sweetblue/library
  • libraries/sweetblue-0.1.5/sweetblue/reference
  • libraries/sweetblue-0.1.5/sweetblue/src

Upload the sketch _1s1_Glue_min_0_1 to the ArduinoBT

The Arduino firmware (a special Arduino sketch for SweetBlue bluetooth communication) can be downloaded from as well. In the version I found, the sketch has to be updated to Arduno IDE 1.0 first:

  • I did not have the NewSoftSerial library, so I replaced
    #include <NewSoftSerial.h>
    #include <SoftwareSerial.h>
  • The Serial.print command has changed, so
    Serial.print(data, BYTE);
Uploading to an ArduinoBT is always a litle bit tricky. You have to pair the baord first with your computer. Next, in the uploading process, you have to press the reset button first to place the board in the upload mode. Details can be found on here:

Open an example sketch in Processing, upload and run

The examples "connecting", "analogRead", "analogWrite", "digitalRead", and "digitalWrite" were installed with the SweetBlue package, but can also be found at the Wiki site.

  • The MAC address of the ArduinoBT has to be added in this form:
    bt.connect( "00:07:80:90:8C:11" /* ArduinoBT MAC */ );
    I could find the MAC address after pairing with a computer and then reading the address under my bluetooth settings.
  • Make a link to the library by "Sketch - Add fileā€¦" and then refer to sweetblue.jar.
  • Now first pair the phone or tablet with the ArduinoBT and run the app.
  • Don't forget to connect your phone or tablet with the computer with a USB cable and enable USB debugging in the Android settings