This remote control in the picture used to control a fan until the fan stopped working. I threw away the fan and saved the remote control unit. This is definitely my personal favourite instructable because it is is useful for lazy people like me. Too lazy to use click on menu, buttons, keyboards and mouse.
This instructable will show how to install and configure a LIRC client program, irexec:
- To shutdown the Raspberry Pi.
- To reboot the Raspberry Pi.
It will NOT cover how to add infrared interface to Raspberry Pi which is covered in my other instructable.
Anyone who has a Raspberry Pi with a infrared interface.
Step 1: Record and map infrared codes to LIRC events
Complete the steps in “Record Infrared Codes of Any Remote Control Unit for Usage with Linux Infrared Remote Control (LIRC) on Raspberry Pi” instructable.
Step 2: Install and configure Linux Infrared Remote Control (LIRC) daemon
Complete the steps in my instructable for the above.
Step 3: Make Raspberry Pi respond to Remote Control events
The remote control unit sends IR signals when its buttons are pressed. LIRC daemon captures the IR signals and translate it to LIRC events. However, it doesn't know what to do with the LIRC events. “irexec” is the program that will translate the LIRC events into actions. irexec is classified as a LIRC clientCreate a configuration file that will tell irexec what to do when LIRC events occur.
Enter the values as show in the screenshot.
$sudo vi lircrc
Step 4: Test
Open terminal emulator in Raspberry Pi
Point the remote control at the Raspberry Pi
Press the button that was mapped to “KEY_RESTART”. The Raspberry Pi should reboot.
Press the button that was mapped to “KEY_POWER”. The Raspberry Pi should power off.
If nothing happens, then it's time to debug.