Instructables

Control Arduino with IR Apple Remote

Picture of Control Arduino with IR Apple Remote
This quick Instructable will show you how to interface Apple's IR Remote to control your Arduino. 

This little project was inspired by the need to have a low cost form of communication for a device embedded with the Arduino Pro Mini board. Although I have been particularly impressed with reliable Xbee RF modules in the past, I had planned for the components contained within the device to be permanently sealed for waterproofing. I therefore felt that I needed a more affordable solution, something that I wouldn't be too disappointed if it got damaged. The proposed device is extremely compact and only requires 'line of sight' operation so infra-red seemed like the perfect solution. 

Why use Infra-red?
  • Much more affordable than other forms of wireless communication e.g. RF
  • Only requires single diode component to receive data
  • Ideal for projects with limited space available
  • Low power consumption
 The sketch and setup will allow you to do the following:
  • Control the brightness of an LED using '+' and '-' buttons
  • Use the 'play/pause' to switch on/off
  • Cycle through modes with 'previous/next' buttons
  • Use 'menu' button to reset device
 
Remove these adsRemove these ads by Signing Up

Step 1: Components & Preparation

Components that you'll need:
  • Arduino ATMEGA Microcontroller
  • Apple IR Remote
  • IR Receiver Diode
  • 5v 5mm LED
  • 220 ohm Resistor
IR Remote Library:
  • You'll need to download the 'IRremote.h' library for the Arduino to make sense of those IR signals.
  • Click on the link and check out Ken Shirriff's blog whilst downloading the IRremote.zip.
  • Extract the file into arduino/hardware/libraries
Ken Shirriff's Blog & IR Remote Library
http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html

Other Preparation
Chances are that if you've got an Apple Remote, you probably have a Mac too. To prevent accidentally flicking through Front Row or your iTunes library, you might want to disable your Mac's IR receiver for a while.This is really easy to do. Just open up System Preferences / Security / 'Disable remote control infrared receiver'.
Thanks for the simple easy to understand tutorial!
aattia1 year ago
i think you only need #include not both
the code compiles fine with me when i press the + - buttons i get the serial monitor to print brightness changes but the led never lights , i tried different pins and the same , i also tested the led and it works fine , what might be the problem ???
hhhh19972 years ago
Keep on getting an error , Yes i have installed the library


C:\Users\Owner\Documents\Arduino\libraries\IRremote/IRremoteInt.h:92: error: 'uint8_t' does not name a type


Alexdlp (author)  hhhh19972 years ago
Apparently the library hasn't been updated for more recent versions of Arduino. In the IRremoteInt.h file, you'll need to change
#include <WProgram.h> so that it correctly reads #include <Arduino.h>
Hope this works out for you :)

arduino man2 years ago
Help I cant find the IRremoteInt.h library.
Alexdlp (author)  arduino man2 years ago
It's definitely in the IRremote.zip on Ken Shirriff's blog, just checked :)
jan-marius2 years ago
I want to use the press and hold gestures on the apple remote. Do you know the codes for those?
Alexdlp (author)  jan-marius2 years ago
Just download from the link in the first step and use the IRrecvDemo.pde - it prints out IR received signals on the serial monitor. For 'gestures' like putting mac to sleep or entering front row etc, it may be the receiver end that is counting the time it takes for you to release the button pressed. In other words, it might not be a separate IR code, rather something in the receiver software :)
x.h2 years ago
Thanks a lot!
Which IR Reveiver Diode did you use? What protocol is used in Apple's IR remote? Can I use that code without Arduino on my Attiny2313 device?
Alexdlp (author)  kotofeiivanovich3 years ago
I think it's possible to use almost any IR receiver diode so long as it outputs a digital signal. (the IR receiver in the pictures here was taken out of another device, I'm not sure of the exact model number).

I've recently used this diode without changing the arduino sketch and it works just the same...
http://www.coolcomponents.co.uk/catalog/product_info.php?products_id=169

You'll need this library mentioned in Step 1 :
Ken Sherriff's Blog & IR Remote Library
http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html

Sorry, I don't really have any experience with Attiny2313 devices.

Hope this helps a little anyway ;)