This tutorial is for novices who have never made any Android application or worked with Amarino. If you have never done any experiment with Android and Arduino, please start with this experiment.

You don’t need to have previous knowledge of Android for doing this experiment. Simply download any Android serial emulator and upload the Arduino code and send/receive between Arduino and Android. For that experiment, you can use any kind of Bluetooth adapter, for example, BlueSMiRF or general Bluetooth adapter. If you are not confident, start with a cheap Bluetooth moduleBUY HERE.

After doing this experiment, go for Amarino, because the core of Amarino is based on the experiment stated above. I strongly recommend you to work with SensorGraph project before you start doing the Multicolor lamp project. For doing SensorGraph project, please click on the following link: How to make SensorGraph


We need the following components for Multicolor lamp experiment:

a. Android Smart Phone- I used ZTE Blade. Any kind of Android phone should work.

b. Arduino Duemilanova ATmega 328

c. Eclipse IDE for Java EE Developers

d. Androidsdk

e. Amarino Toolkit

f. Bluetooth Modem – BlueSMiRF from sparkfun or any other Bluetooth Adapter. BUY ONE

BT adaptor
g. Three LEDs- Colors: RED, BLUE and GREEN, OR one RGB LED.


Step 1 Install Amarino

Go to http://www.amarino-toolkit.net/ and download the following applications on your mobile phone

a. Amarino – Android Application– to be installed on phone.

b. Amarino Plug-in Bundle– to be installed on phone.

c. Amarino Library– To be installed for Android programming. It is needed while installing the application on phone using Eclipse.


Step 2 Download Meet Arduino Library

Download the MeetAndroid Library and place it into the libraries folder of Arduino.

After placing the folder into the libraries folder, you should be able to access all the Amarino files through the Arduino programming environment.

You can see the picture below (Click on the image to enlarge it):


Step 3 Set up Bluetooth adapter

For this experiment, you can either use BlueSMiRF Bluetooth module (from sparkfun) or a general Bluetooth module from buildcircuit.net

Amarino is perfectly compatible with both of these modules. BlueSMiRF adapter is expensive than the general one, so, I recommend to buy the general one. BUY HERE

Connect the Bluetooth adapter in the following way:

VCC — 5V
GND — GND
TX — RX (digital pin 0 of Arduino)
RX — TX (digital pin 1 of Arduino)
NOTE: The BlueSMiRF bluetooth module should work at 9600bps and 57600bps. If it does not work at 9600bps, you can change the baud rate and try again. Here’s a tutorial for checking and altering the actual baud rate of your module.
Please remember that the given procedure does not work for general Bluetooth adapter. Its default baud rate is 9600bps and it works with that.

Step 4 Test the communication between Bluetooth adapter and Arduino


Step 5 Set up Eclipse

It is the most complicated part of this experiment.
The basic idea is to install the Eclipse first(follow the system requirements), then install the android SDK, then install ADT plugin for Eclipse IDE. I strongly recommend you to follow the instructions seriously.

Step 6 Download the Multicolor Lamp folder

Download the Multicolor Lamp example from http://www.amarino-toolkit.net/index.php/download.html and place it in a folder(anywhere). DIRECT DOWNLOAD

Step 7 Work with Multicolor Lamp

Go to Eclipse and right click your project panel, and select new android project. In the picture below, you can see that I have selected Android 2.1 because my ZTE phone has Android 2.1 API 7.

NOTE: you need to have Androidsdk plugin installed.

– Select ‘create from existing source’.
– Use the browse button to find your Multicolor Lamp folder that you just downloaded.
– Select android 2.1 OR any other versions as the targeted device from the list. It depends upon the phone you use.
Click Finish.

*You might get yellow exclamation warnings next to your MulticolorLamp project, it doesnot affect your project, so, just ignore it.

*If you have a red “X” you might need to make you have your “AmarinoLibrary_v0_55.jar ” file is included. Download it from http://www.amarino-toolkit.net/index.php/download.html

*To include the file, right click on your Multicolor Lamp folder and click build path > configure build path > libraries > add external jar > and browse for the AmarinoLibrary_v0_55.jar file. > ok


**Very very Important- Open the MultiColorLamp.java file in Eclipse and place your bluesmirf device number inside this line of code ( private static final String DEVICE_ADDRESS = “YOUR BLUE TOOTH DEVICE NUMBER”;)

** Changing AndroidManifest.xml file. Go to Application and set Debuggable as ‘True’.


Phone side (HOW TO INSTALL THE APPLICATION)

Your phone should already be connected via usb to your computer, In your phone settings, developer debug mode, and install from unknown sources checked.

In my phone, it was in settings>applications>USB debugging.

 Next, right click on your MultiColorLamp folder and > Run as Android Application.

When the dialog box of the AVD manager launches select your phone as the targeted device. It will be the one that does not say emulator and probably have some device number to it.
Launch
This will install the Multicolor Lamp app to your phone and run it.

NOTE: If your application does not install on the phone, then there is a possibility that your phone’s device driver is not installed on computer. Go to Device manager and install the driver for your phone. If you have internet connection, it searches automatically for the driver. You can get more information from here: http://developer.android.com/guide/developing/device.html


Arduino Side

You can get Arduino code file on one of the folders of MultiColor Lamp. Set the same baud rate that you have in Bluetooth adapter.

While uploading the sketch to Arduino, remove the RX and TX connections of Bluetooth module.

The Arduino set up is very easy. You just need to connect 3 LEDs across DIG 9- GND, DIG 10- GND and DIG 11-GND.

If you have never done this kind of experiment before, I recommend you to do this experiment first:http://arduino.cc/en/Tutorial/Fade


– After uploading the sketch and fixing the circuit, connect the Bluetooth module. Connection of Bluetooth module has been described earlier in this tutorial.

If you follow the instructions carefully, your experiment will work. Please write me if you have any problem. You can watch the project in action on the following video:


Check your experiment

1. Did you edit the MAC address?

2. Did you set ‘Debuggable’ as True in AndroidManifest.xml ?



3. Did you see if the baud rate written in your Arduino program is same as baud rate of Bluetooth adapter. If you are not sure about the baud rate, you can check it, see the following tutorial.

http://www.buildcircuit.com/how-to-change-baud-rate-of-bluetooth-modem-bluesmirf-gold-using-arduino-terminal/

Please note that the baud rate of general bluetooth adapter is always 9600bps.

4. Did you connect the bluetooth module in the correct way?

VCC — 5V
GND — GND
TX — RX (digital pin 0 of arduino)
RX — TX (digital pin 1 of arduino)
5. Did you remove Bluetooth connection from Arduino board while uploading the Arduino Sketch?
You should remove it while uploading the sketch and reconnect it while you run the MulticolorLamp application.

THIS PROJECT WORKS PERFECTLY WELL. ONE OF THE VISITORS HAS SENT THIS PICTURE.

READ ABOUT MULTICOLOR LAMP WITH CUSTOM BLUETOOTH ID.

BUILDCIRCUIT.COM HAS RELEASED A DIY SHIELD FOR AMARINO, CHECK THIS OUT.

Amarino shield in use (2)

try this also