Control your Arduino using an Infrared Remote and the IK38khz sensor
In this article we’ll send data from a classic IR remote controller (I used my Creative Speaker IR remote control) to turn on/off a LED in our Arduino board, using an IK38khz sensor and the IRemote library.
Naturally you could use your IR Remote for everything: to manage motors, servo and other devices or you could also create a cheap network between two Arduino: one board will send data from a IK38khz Sensor (receiver) and the other one will receive them using an infrared Led (sender)
So, first of all, create your prototype circuit getting inspiration from the next image
1) LED is connected to pin 13.
2) IK38khz on pin 9
NOTE: be sure to connect Ground and Power to the right pins otherwise you could destroy your sensor (i have a lot of experience about this ; )
Copy following sketch to your microcontroller:
#include <IRremote.h> int RECV_PIN = 9; int ledPin = 13; IRrecv irrecv(RECV_PIN); decode_results results; void setup() { Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver pinMode(ledPin, OUTPUT); } void loop() { if (irrecv.decode(&results)) { Serial.println(results.value, DEC); if(results.value == -2094865891) digitalWrite(ledPin, LOW); // set the LED on else digitalWrite(ledPin, HIGH); // set the LED on irrecv.resume(); // Receive the next value } }
In the IF condition I have simply turned off the LED on pin13 when the result is -2094865891 (the value I get when I click the VOLUME button on my remote control). Instead, when another button is clicked the Led is turned off.
You can get your IR remote button values checking the Serial Monitor, thanks to the Serial.println().
NOTE: I’m a Flash/Flex developer and i’m not so inside electronic stuff to be sure this is the best way to proceed.
It’s just a cheap and quick way : )
ISSUES: I have tested this script with 3 remote controllers:
1) the Creative one is what I use to write this article and it works.
2) My TV controller (SHARP LCD) return 0 from every button, so i couldn’t use it.
3) My ALICE TV remote control (an italian internet provider) return nothing for every button, so it doesn’t work too.
I got inspiration from following article, where you can download the IRemote Libray and get more details about this stuff:
http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.html .












I’ve extended my IRremote library to work with more types of remote controls. The details are here. Hopefully this will work with your TV controllers; let me know.
Leave your response!