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 module, BUY 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.
e. Amarino Toolkit
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:
Step 4 Test the communication between Bluetooth adapter and Arduino
Step 5 Set up Eclipse
Step 6 Download the Multicolor Lamp folder
Step 7 Work with Multicolor Lamp
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.
*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.
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
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.
Please note that the baud rate of general bluetooth adapter is always 9600bps.
4. Did you connect the bluetooth module in the correct way?
THIS PROJECT WORKS PERFECTLY WELL. ONE OF THE VISITORS HAS SENT THIS PICTURE.
READ ABOUT MULTICOLOR LAMP WITH CUSTOM BLUETOOTH ID.