User Tools

Site Tools


2016:smart_remote_control

This is an old revision of the document!


Smart Remote Control

Is your remote control collection getting out of control? With a television, cable box, Blu-ray player, and stereo, not only does each remote take up space, but making them work to turn on the right devices and set the right inputs can be very frustrating! You might consider buying a fancy programmable remote control, but they can be expensive and sometimes don’t offer the control or interface you want. This smart remote control project will show you how to build a device that can send and receive remote control codes from a web page. You can program exactly the functionality that you need from any smart phone or computer!

This project uses the Arduino Yún, which is a special Arduino that’s perfect for network-connected devices. The Yún has two processors, one of which runs the Linux operating system and can connect to wired or wireless networks. The second processor is the same as the one used in the Arduino Leonardo. It therefore has great compatibility with Arduino libraries and hardware.



To send and receive remote control signals, this project uses an infrared LED and receiver. Infrared light is invisible to the human eye but easy for electronic sensors to detect. To make the transmission of signals more reliable, devices typically modulate (flash or flicker) infrared light very quickly, so there’s less chance for stray infrared light (like from sunlight) to interfere. An infrared receiver is a small device that can pick up infrared signals modulated at a particular frequency, commonly 38kHz (38,000 times per second). Using an infrared receiver, an Arduino can detect the bits being sent by a remote control. And to play back a remote control signal, the Arduino can flash an infrared LED at 38kHz!

Taking command of your entertainment center is accomplished through a simple web interface which is run locally on the Yún and accessible to most web browsers. The website facilitates basic infrared device control and even allows for multiple commands to be strung together. For example, a ‘Watch Movie’ button might send the control codes to turn on your TV, Blu-ray player, and set the TV to the Blu-ray player input.

This is a moderately difficult project which will require some experience running Arduino sketches and using command line tools. The electronic components for this project are simple and can be easily assembled on a solderless breadboard.

Step #1: Connect Components




  • Connect the infrared LED to the Yún by running a wire from the LED's anode (longer lead on the LED) to the Yún's digital pin 13.
  • Using a 100 ohm resistor, connect to the infrared LED cathode (shorter lead on the LED) to the IR sensor's ground pin (middle lead on the IR sensor).
  • Connect the IR sensor detection pin (left-most lead when looking at front/rounded part of sensor) to digital pin 11 of the Yún.
  • Connect the IR sensor ground (middle lead) to a ground pin on the Yún.
  • Finally, connect the IR sensor voltage (right-most lead when looking at front/rounded part of sensor) to the 5 volt pin on the Yún.

Step #2: Install Software Dependencies


  • With the MicroSD card inserted in the Yún, power on the Yún by connecting the USB Micro B cable to the Yún and a USB power adapter.
  • Make sure your Yún is already setup and connected to your wireless network.
  • Connect to the Yún command line using SSH.
  • After you connect to the Yún's command line, it will show the firmware version. This project has been tested and works with BusyBox v1.19.4 dated 2014-04-10 and later. If you're using an older version, you may need to follow these instructions to update your board.
  • From the command line, execute the following command to update the package manager:
 opkg update
 
* Now install PIP, the Python package manager:\\
 opkg install distribute && opkg install python-openssl && opkg install python-expat && easy_install pip
 

This process may take a few minutes. You may see some warnings; they're safe to ignore.

  • Create a directory on the SD card to store Python packages:
 mkdir /mnt/sda1/python-packages
 
* Install the Flask Python web framework:
 pip install --target /mnt/sda1/python-packages flask
 

You may see some warnings; they're safe to ignore.

  • Update Python's package search path:
 echo "export PYTHONPATH=/mnt/sda1/python-packages" >> /etc/profile
 
* Create the directories where the Arduino IDE will upload the web server files:
 mkdir /mnt/sda1/arduino
 mkdir /mnt/sda1/arduino/www
 
* Restart your Arduino Yún to make sure the Python search path is updated.
2016/smart_remote_control.1462926029.txt.gz · Last modified: 2016/05/10 20:20 by 75.177.137.2