Introduction: IAndroidRemote - Control Android Mobile Using an Apple Remote
I love to integrate devices which are not supposed to be integrated and this guide shows you how you can control an Android mobile using Apple’s Remote. (Who said Apple devices work only with Apple products ;) )
Also this is my entry to the Sparkfun microcontroller context. If you like this guide, please do vote for me. (Voting starts from Feb 14th)
Basic Architecture
This is the basic architecture of how we will be setting up different pieces so that they can talk to each other.
Apple Remote -> IR Receiver -> Arduino -> Bluetooth Shield -> Amarino -> Android
Step 1: What Do You Need
Step 2: Arduino
Arduino - Connecting the IR Receiver
The first step is to connect the IR Receiver to Arduino. The IR Receiver has three legs (Vcc, Gnd and signal).
Connect the Vcc pin of IR Receiver to Arduino’s Vcc pin
Connect Gnd pin of IR Receiver to Gnd pin in Arduino
Connect the signal pin of IR Receiver to Arduino digital pin 11
Arduino - Code
The next step is to write the code in Arduino called as sketch. The code should do the following
Read the signal from IR Receiver
Identify the button that was pressed
Send the button code using Bluetooth
Arduino - Libraries
In order to do the above steps, we will be using the following two libraries.
IR Remote
This library allows us to identify which button was pressed by reading the signal from IR Receiver. Download the library from its home page and copy it to your Arduino library folder.
Amarino
This library allows us to connect Arduino and Android using Bluetooth. Download the library from its home page and copy it to your Arduino library folder.
Create a new Arduino sketch and copy the below code. You can also download the code from the github page .
#include <IRremote.h>
#include <IRremoteInt.h>
#include <MeetAndroid.h>
int IR_PIN = 11; // IR Receiver Pin
const long Plus = 2011254788;
const long Next = 2011258884;
const long Minus = 2011246596;
const long Prev = 2011271172;
const long Center = 2011275268;
const long Menu = 2011283460;
MeetAndroid meetAndroid;
IRrecv irrecv(IR_PIN);
decode_results results;
void setup () {
Serial.begin(115200);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
meetAndroid.receive(); // you need to keep this in your loop() to receive events
if (irrecv.decode(&results)) { // if an IR signal is obtained from IR receiver
if (results.value == Plus) {
meetAndroid.send("Plus");
}
if (results.value == Minus) {
meetAndroid.send("Minus");
}
if (results.value == Next) {
meetAndroid.send("Next");
}
if (results.value == Prev) {
meetAndroid.send("Prev");
}
if (results.value == 2011275268) {
meetAndroid.send("Center");
}
if (results.value == Menu) {
meetAndroid.send("Menu");
}
irrecv.resume(); // Receive the next value
}
}
After creating the Arduino sketch compile and upload it to your board. Once it is uploaded you should disconnect the USB to serial cable which connects the Arduino to the computer.
Arduino - Connecting Bluetooth shield
The next setup is to connect the Bluetooth shield to Arduino.
Please note that before you connect the Bluetooth you should disconnect the computer USB to Arduino cable, otherwise it will not work.
The Bluetooth shield has 6 pins and it should be connected like how it is explained below.
Connect the Vcc Pin of Bluetooth shield to Arduino’s Vcc pin
Connect the Gnd Pin of Bluetooth shield to Arduino’s Gnd
Connect the Rx (Receiver) pin of Bluetooth shield to Tx (Transmitter) pin of Arduino.
Connect the Tx (Transmitter) pin of Bluetooth shield to Rx (Receiver) pin of Arduino.
Short the CTS -1 and RTS -0 Pin of Bluetooth shield.
Step 3: Android
Install Amarino app
The first step is to install the Amarino app in your Android phone. You can download the Amarino app apk file from its homepage .
Create the control app
The next step is to create the Android app that will listen for the events from Amarino and control the music player. You can create a new Android project in Eclipse and copy the code. Please note that you should add the Amarino library jar file to the project’s class path.
The entire source code for the Android app can be downloaded from the project’s github page.After creating the app install it on your phone.
Step 4: Make Everything Talk
Now power up your Arduino using a battery or a DC power source. The Red LED in the Bluetooth shield will blink indicating that it is ready to receive connections. Now open up your Amarino app installed in your phone and connect it to the Bluetooth shield. Once connected the Red LED will stop blinking.
Now open up the default Music player in your Android phone and start playing some music. Now try to press the volume buttons in your Apple Remote by pointing it towards the IR Receiver. The volume of the music playing in your phone should vary accordingly.
Also try pressing the next, previous and play/pause button in your Apple Remote and enjoy controlling your Android phone through your Apple Remote :)
Links
Homepage of the project
Project Source code

Participated in the
3rd Epilog Challenge

Participated in the
Microcontroller Contest
Comments
12 years ago on Introduction
very good!