Friday, January 1, 2010

Android-Arduino Develoment Guide

Android Development
Get the SDK

Arduino Development
Get the developer tools

Lilypad
Information and schematics

Bluetooth
Bluesmirf information and schematics

Amarino Development
Download the amarino tools


Sample Code
Provided is sample code both for Android and Arduino. The zip file contains an Android Eclipse project, as well as Arduino code.

HaptigoExample.zip

Android Application
The Android project is an application that controls three haptic tactors using a two dimensional slider. The x direction of the slider controls the intensities of the three tactors, the "left" tactor, "center" tactor and "right" tactor. The y direction of the slider controls the overall intensity of all the tactors that are active. Its not too important to know about the slider, its just fun :)

Take a close look at the class edu.tamu.haptigo.VestController for an example of sending data over Amarino to the Arduino.

Also look at the class edu.tamu.haptigo.HaptigoTest for an example of how to write your main Android application class (or Activity).

Look at the file res/layout/main.xml for an example user interface layout using existing Android widgets such as TextView, Button and LinearLayout, as well as the custom class SurfaceControlView.

Arduino Application
The Arduino code, found in the arduino/HapticVest directory in the example, takes input from Amarino over bluetooth and uses it to set the intensity of vibration of three haptic tactors. In this example the tactors are attached to the following lilypad or teensy++ pins: 2, 6 and 12. The code reads an array of three ints and uses them as the analog power output (between 0 and 255) for the three tactors.

Note that the baudrate for the serial connection over bluetooth is 57600, the best baudrate for reliable communication for the lilypads. Make sure to keep your baudrate at 57600, as this is also the default setting for all of the bluetooth boards.


If you have any issues or anything is unclear, leave a comment and it will get fixed!

No comments:

Post a Comment