Introduction: Arduino Based Windows PC Volume Remote Control
IR Remotes have been very prominent since 1980’s. In today’s world almost everything is controlled by a remote. This project allows the user to control the Master Volume of the Windows PC using any Remote (TV, Set-Top Box, Home Theater, etc.). The heart of the project is Arduino Uno. There are 2 most common Data Formats for IR – RC5 Coding and NEC Coding.
The RC5 standard uses a bi-phase coding the carrier frequency fixed at 36 kHz. The transmission of a data word begins with two start bits followed by a toggle bit. The toggle bit changes its value at each new key-press. The five address bits represent the address of the device to be controlled. The six command bits contain the information to be transmitted. Each bit in the data word consists of half a bit period with no transmission and half a bit period with a burst of 32 pulses at 36 kHz. The most suitable IR receivers for receiving the RC5 code are those with the “AGC2” setting and a band-pass frequency of 36 kHz. Some examples are: TSOP1236, TSOP4836, TSOP34836, TSOP39236 and TSOP36236.
The NEC code uses bursts at a carrier frequency of 38 kHz. The NEC code starts the transmission using a so called leader code, a burst with a length of 9 ms, followed by a pause of 4.5 ms and then the data word. The original purpose of this leader code was to let the internal control loops in the receiver modules settle. After transmitting the data word, only the leader code and a single bit are transmitted repeatedly for as long as a key is pressed. A special property of this code is a constant word length in combination with pulse distance modulation. Both the address and the data bits are transmitted twice, first as a normal byte followed by an inverted byte. The half period burst portion of each bit contains 22 pulses, each with a width of 8.77 μs and a period of 26.3 μs. A “0” is represented by a pulse distance of 1.125 ms and a “1” by a pulse distance of 2.25 ms. 8 address bits are used to identify the device to be controlled. A further 8 bits are used for the transmission of the command data. As mentioned above, the words are always followed, without a pause, by the inverted words. E.g., the transmission of the address word “00110111” and the command data word “00011010” is performed by sending the bits:
In a special version of the NEC code, the pre-burst, including all of the address and data bits, is repeated in each 108 ms time slot for as long as the key is pressed. The most suitable IR receivers for receiving the NEC code are those with the “AGC4” setting as they have the best noise suppression while still supporting this data format. Some examples are: TSOP4438, TSOP58438 and TSOP75438.
Step 1: Software
The software used to program the Arduino Uno is Arduino IDE which can be downloaded free of cost from https://www.arduino.cc/en/Main/Software. The open-source Arduino Software (IDE) makes it easy to write code and upload it to the board. It runs on Windows, Mac OS X, and Linux. The environment is written in Java and based on Processing and other open-source software. The library used in this project is IRremote library. This allows Arduino Uno to decode IR signals coming from the Remote. To install the library, just copy the IRremote folder and Paste it in location: Documents>Arduino>libraries folder.
To communicate between Arduino Uno and PC, the mode of communication used is Serial Communication. User needs to install software called Remote Volume Control on the targeted PC which communicates with Arduino Uno and accordingly performs the task. This software runs in background and automatically starts when the PC boots.
Step 2: Circuit and Working
The components required are Arduino Uno, TSOP1738 (IR Sensor), breadboard and some Male-to-Male Jumper Wires. The working of the project is fairly simple. The Arduino Uno Decodes the Key of the Remote and then compares it with predefined variables to figure out which key is pressed, if it finds a match, it sends the signal to PC which is interpreted by the Remote Volume Control Software which further performs the required task. The most important step is to configure the desired remote with the Arduino Uno.
To configure your desired Remote, first install the library and open up the code – IR_Key_Test.ino and upload it to Arduino. After uploading the code, open Serial Monitor in Arduino IDE. Now point the desired Remote to the Sensor and Press the Key continuously that you want to assign for VOLUME UP function. Note the Key Code Number which will be that one which repeats again and again when the key is pressed.
The Key Code for VOLUME UP Function as per Current Serial Data will be 45135. Note that some Remotes send value 65535 or FFFF after sending the Key Code. Sometimes there might be abrupt values due to ambient light or interference, so take at-least 5-6 readings before assign the Key Code. Similarly repeat the above listed procedure to find Key Codes for VOLUME DOWN and MUTE functions. After noting down the Key Codes for all functions, open program – IR_Final.ino and replace the given Key Codes with your Key Codes.
Step 3: Construction and Testing
Now it’s time to test our little project. After uploading the code to the Arduino Uno, Connect it to your PC and Open Device Manager. Note the COM port assigned to Arduino Uno.
Here Arduino Uno is assigned COM3. Now install Remote Volume Control software and start the software. Select COM3 in COM Ports Menu and Select 9600 Baud Rate in Baud Rate Menu. Click on Connect and all goes well, the Volume of the PC will be controlled by your desired Remote!