Showing posts with label ltr301. Show all posts
Showing posts with label ltr301. Show all posts


Using a TV remote to control an Arduino

I had bought a couple of pairs of these IR emitters/receivers and wondered if the wavelength of the light would be the same as for standard IR remote controllers for TV sets.

So instead of trying to hook up the emitters, I went straight for the TV remote. I had two available; one universal remote and one Panasonic DVD/TV remote.

The red one is the LTR301 (reciever) and the yellow one is the emitter. (LTR302).

Using IRremote.h, I was able to collect the raw IR codes from the remote control. This required me to remove the file Tone.cpp from the Arduino IDE's /cores folder. The reason for this was that IRremote.h library was implementing the same interrupt handlers. I am not using the tone generation functions in this library, so I just moved it outside the root folder and then IRremote.h would compile eventually :)

Having no use for the actual functions of the remote, I don't bother to translate them. I just made a lookup-table of what to do for each code, and drew out a sketch on paper what button produces what code. An obvious use of some buttons, like the 'center joystick-like pad', usually consisting of four identical left-right and up-down buttons for channel and volume, respectively, was ideal for forward-backward and turning control.

I hooked the IR sensor up with a 10k resistor, this gave me a detection range of about 50cm, straight angeled on the side of the sensor. Not very practical for a remote controlled device, but some modificationm of this could extend the range.

On the other hand, I do have the both the IO shield and the Mega ADK and a spare Android phone, so this could be controlled over BlueTooth or Wifi too. This could be a low level fail-safe input channel, in case the robot has to be shut down at a moments notice, regardless of the potential fickles of BT and WiFi reliability on an Arduino system.