2016:smart_remote_control
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
2016:smart_remote_control [2016/05/10 20:12] – [Step #1: Connect Components] 75.177.137.2 | 2016:smart_remote_control [2016/05/10 20:45] (current) – [Step #2: Install Software Dependencies] 75.177.137.2 | ||
---|---|---|---|
Line 24: | Line 24: | ||
==== Step #2: Install Software Dependencies ==== | ==== 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. | * 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. | * Make sure your Yún is already setup and connected to your wireless network. | ||
* Connect to the Yún command line using SSH. | * Connect to the Yún command line using SSH. | ||
- | * Unordered List ItemAfter | + | * 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. |
- | * Unordered List ItemFrom | + | * From the command line, execute the following command to update the package manager: |
- | | + | < |
- | Now install PIP, the Python package manager: | + | opkg update |
- | opkg install distribute && opkg install python-openssl && opkg install python-expat && easy_install pip | + | </ |
+ | * 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' | This process may take a few minutes. You may see some warnings; they' | ||
- | Create a directory on the SD card to store Python packages: | + | * Create a directory on the SD card to store Python packages: |
- | mkdir / | + | < |
- | Install the Flask Python web framework: | + | mkdir / |
- | pip install --target / | + | </ |
+ | * Install the Flask Python web framework: | ||
+ | < | ||
+ | pip install --target / | ||
+ | </ | ||
You may see some warnings; they' | You may see some warnings; they' | ||
- | Update Python' | + | * Update Python' |
- | echo " | + | < |
- | Create the directories where the Arduino IDE will upload the web server files: | + | echo " |
- | mkdir / | + | </ |
+ | * Create the directories where the Arduino IDE will upload the web server files: | ||
+ | < | ||
+ | mkdir / | ||
+ | mkdir / | ||
+ | </ | ||
+ | * Restart your Arduino Yún to make sure the Python search path is updated. | ||
+ | ==== Step #3: Load Arduino Sketch ==== | ||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | Download the the IR library. (This library is a fork I created of the excellent Arduino IRremote library created by Ken Shirriff.) | ||
+ | |||
+ | Unzip the archive, rename the folder from Arduino_IRremote-master to Arduino_IRremote, | ||
+ | Download the Smart Remote Control Arduino sketch by grabbing the zip file from this location. | ||
+ | |||
+ | Uncompress the archive and drag the SmartRemoteControl folder into your Arduino sketchbook folder. Open the sketch in the Arduino IDE. | ||
+ | |||
+ | Compile the sketch and upload it to the Yún over WiFi by selecting the ' | ||
+ | |||
+ | Aim a remote control at the IR sensor and press a few buttons on the remote. You should see IR code information displayed in the Serial Monitor. If you don't see codes displayed, double check your sensor wiring. | ||
+ | |||
+ | ==== Step #4: Configure Remote Control Codes ==== | ||
+ | |||
+ | {{: | ||
+ | * You can now configure the activities and remote control codes associated with them by editing an XML configuration file. Using a text editor, open the activities.xml file in the www subdirectory of the sketch' | ||
+ | * Notice the format of the example activities in the file. Each activity node defines a name attribute which will be displayed as a button on the remote web page. Within each activity, the codes node contains a sequence of IR codes to execute. The example activity will first execute a Sony A90 command (power on/off) to turn on the TV, and then a Panasonic command (power on/off) to turn on the Blu-ray player. Each code has a string value which is the direct output of the detected remote code from the Arduino sketch. | ||
+ | * Add your own activities to the file by copying the example and changing the name and codes. While your remote is aimed at the IR sensor, press buttons and carefully record the detected IR code string. Copy the string into the activity code configuration. | ||
+ | * Once you're happy with the activity configuration, | ||
+ | |||
+ | ==== Step #5: Start Web Interface Server ==== | ||
+ | {{: | ||
+ | * To run the server, connect to the Yún over SSH. Execute the following command to start the server: | ||
+ | < | ||
+ | python / | ||
+ | </ | ||
+ | * If the server starts successfully you should see the following text: | ||
+ | < | ||
+ | Running on http:// | ||
+ | Restarting with reloader | ||
+ | </ | ||
+ | * If you see an error, check that all the required dependencies were installed in the previous steps. | ||
+ | * In a web browser, navigate to the URL http:// | ||
+ | * Once the page is loaded, you should see a list of the configured activities as buttons. If you see an error, check that dependencies were installed properly, the sketch was uploaded, and the server is running without errors. | ||
+ | * To stop the server, press Ctrl-C in the command window where you started running the server. | ||
+ | ==== Step #6: Use Web Interface ==== | ||
+ | {{: | ||
+ | {{: | ||
+ | {{: | ||
+ | * To use your smart remote control, aim the LED at your electronic devices and press one of the activity buttons. If you don't see all your expected devices turn on, try moving the LED closer to the devices. The range of the LED can be somewhat small, around 6 feet of distance. You can consider adding a transistor to increase the LED range as well. | ||
+ | * You can also test IR codes by opening the Yún Serial Monitor in the Arduino IDE and sending the IR code as a command. For example, sending "SONY: C A90" (without quotes) would cause the hardware to send a Sony A90 power command. (The " | ||
+ | * To make the server automatically start on boot, edit the file / | ||
+ | |||
+ | | ||
+ | |||
+ | * To use speech recognition, | ||
- | mkdir / | ||
- | Restart your Arduino Yún to make sure the Python search path is updated. |
2016/smart_remote_control.1462925552.txt.gz · Last modified: 2016/05/10 20:12 by 75.177.137.2