The Computer IR Remote Controlling

Introduction: The Computer IR Remote Controlling

About: Electronics.

Beside the lots of other purposes I am using my PC as the multimedia center. There are times I am relaxing on the sofa listening to the music or watching a movie or a TV and do not feel like getting up to adjust the volume or change the TV channel each time stupid commercials appear or I am getting asleep and wish for the silence. So I have decided to make my PC remote controlled with a standard IR remote control so I could just instantly press the button instead of furiously grabbing for the mouse or the mute key on the keyboard.

The project consists of the several parts:

  1. Remote control
  2. PC software
  3. IR receiver module

Step 1: The Remote Control

The first item - the remote control - is trivial to get done with. Just use any IR control that you like. I used the one that is for sale as the set together with IR receiver - see the picture. The only reason I have decided for this type is just because I already had it at home.

Step 2: Software

I have created the program for the GNU/Linux OS that runs in a terminal. The source code is free to download/use/share/modify. To compile the code just issue the command like gcc -o remotePC remotePC.c in the terminal. To run the program type ./remotePC.

The following information in this step is addressed to those who are interested how the things work.

The program description

The program first checks whether the file /dev/ttyACM0 or ttyACM1 exists. If so the group ID of the file is checked to be different from zero. This means that the serial port can be read from and written to by the common user. Two bytes with values 0xAA 0x55 are then written to the port to signal that the program is ready to receive the data.The incoming data is compared to the stored values. If the match is found the predefined action is executed.

The volume control

The program is able to turn on/off the sound, increase/decrease volume level on the system level. This is achieved with the use of the pactl program. The commands then look like this:

pactl set-sink-mute 0 toggle
pactl set-sink-volume 0 +10%
pactl set-sink-volume 0 -10%

If necessary install the demanded packages.

The VLC Media Player control

The program can also start/pause the audio/video and change the track to the previous/next in the playlist of the VLC Media Player. The Desktop Bus is used in this case. The commands:

dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc \
/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc \
/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc \
/org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous

Step 3: IR Receiver Module

The third part of the project is the most complex one yet pretty simple still. The idea is that the IR receiver will output the signal to the MCU that will transform it to the unique number. This number will be then transmitted to the PC over the USB.

The module is intended to be mounted inside the PC case and connected to the USB slot on the motherboard with the cable. In case you prefer the external connection to the USB you will have to make minor adjustments.


I have built the module on the PIC16F1829 microcontroller. The choice of the MCU is not critical, you can use any other MCU if you are able to adjust the source code. I have chosen this PIC for two reasons. First I had it available and second it's pins were partly damaged by the intensive usage in the different testing projects. So I wanted to use it in the permanent project before it gets totally unusable. :-)

IR receiver

The second part the module is based on is the IR receiver VS1838B - the one mentioned in the 1st step.

UART/USB converter

The third part is the MCP2221 that is the UART/I2C/USB converter.

The task is to combine these 3 parts to build up the module that will be able to receive the signals from IR remote control and hand them over to the PC.

The wiring

In the first picture there is the testing circuit on the breadboard. In the second one there is the wiring schematic.

The list of parts

1 pc PIC16F1829 (or any other MCU)

1 pc VS1838B (or any other IR receiver)

1 pc MCP2221 (or any other UART/USB converter)

2 pcs 4-pin header

1 pc 6-pin header

1 pc resistor 100R

2 pcs resistor 10K

2 pcs resistor 330R

1 pc capacitor 470 nF

2 pcs electrolytic capacitor 4.7 uF

1 pc switch (optional)

PCB assembly

Put together the module with use of the schematic. You can either use the universal board or create the custom PCB. If the latter is the case I have provided the KiCad files in the archive below.

The firmware

The source code for the PIC written with the use of the MPLAB X IDE and the XC8 compiler is available for the download below.

The source code notes

For those who would like to know what exactly the program is doing are the following lines.

After all the settings are done the red LED is on and the MCU is waiting for the 0x55AA data. After that the LED turns green and the MCU starts detecting the signal from the IR receiver with use of the interrupts. It measures and records the time intervals the signal is in the High and Low levels. These times are then transformed to the 32-bit number that is sent to the PC.

The relation between the times and the final number is given by the NEC protocol.

Step 4: How to Use the Device


Upload the firmware to the PIC. I use the PICkit 3 programmer.


Install the IR receiver module as seen in the pictures:

  1. Connect the USB header either to the internal USB slot on the motherboard inside the PC case with appropriate 4-wire cable or externally to the USB slot with the standard USB cable. In the second case you have to help yourself in some way, e.g. as seen in the 3rd picture for an inspiration.
  2. Atach the 5 V power cable form the power source inside the PC case to the 4-pin header. Or power the module in another way in the case of the external use.

Look up the motherboard's USB socket pins description. I am not sure whether the wiring follows some kind of standard so it is better to make sure. In my case there are two pin rows with 5 pins in the upper row and 4 pins in the lower one. From left to right the pins are + 5 V, D-, D+, Gnd. The 5th pin in the first row is not connected. I attached the cable as seen in the second picture.


Run the program in the terminal. If everything goes right the last message of the program is "waiting for data...". Now when you press the button on the remote control the received code will appear in the terminal. This way you will know which button emits which code.

Now some programming stuff is waiting for you but do not worry. Just a few things have to be changed in the program's source code so that program responds to your remote control. Open the file remotePC.c in the text editor or in some IDE if you like and replace my codes with yours. Just press the buttons you intend to use for each action one by one. Simply copy the codes that appears in the terminal and paste them to the source code to the place with corresponding action.

When you are finished terminate the program and recompile the code with command gcc -o remotePC remotePC.c. Run the program again and it will be responding to your remote control from now on.

I use this way with hardcoded actions in the program as I find it meaningless to waste my time with further development of the project to the state when it is possible to add/change codes/actions in the user friendly graphics environment for example. But if you would like to do this or even more you can.

PCB Contest

Participated in the
PCB Contest

Be the First to Share


    • Unusual Uses Contest

      Unusual Uses Contest
    • Hour of Code Speed Challenge

      Hour of Code Speed Challenge
    • Edible Art Challenge

      Edible Art Challenge