Introduction: DIY HID IR Keyboard (FLIRC Clone)
Hello everyone. This is my first Instructable.
A while ago I got to know about the FLIRC IR receiver which I thought of buying. But I thought, Hey! Why buy something I can make at home.
So basically what FLIRC do is convert IR signals received from any remote to HID signals. From what I gathered, it recognizes as an HID keyboard to the computer.
Now, to the project, we can do this using two ways.
Easy way would be to use and arduino Leonardo compatible board which can easily made to be recognized as an HID keyboard or mouse to the computer. There is even an IR library to easily decode IR signals from the remote. But let’s be real here, you cannot use a development oriented board to create something to be used on a daily basis. Plus there are similar projects already available. Also it will be WAY too bulky. Even if you use the tiniest Leonardo compatible board. So, we move on to the fun way.
For this project, I used a PIC18F25J50 microcontroller with a TSOP IR decoder. I used this microcontroller because of three reasons. First, this mcu is available in tiny QFN package which helps reducing the overall board size. Second, this mcu supports usb communication without using an external crystal/resonator which again helps reducing the board size. And third, is that I have several of these laying around in my stock. The list of components required to make this project is very tiny. Hence it’s not very hard to build this circuit. But, if you want to build the circuit I built, you’ll need very steady hands and expert soldering skills.
Step 1: Components Required
-PIC18F25J50 (You can also use other PIC18F MCUs with USB transceiver built-in but you may have to make appropriate changes to the code and the schematics. You can comment below if you need my help doing so.)
-TSOP IR receiver.
-LM1117 3.3v regulator
-470 ohm resistance.
-10k ohm resistance.
As I said, the list of components is tiny.
Step 2: Schematics and PCB Layout
To make the PCB i used the simple Toner transfer method using a simple iron. As you can see, the quality is decent except sometimes the 0.01 inch traces gets scraped off by using steel wool no matter how careful i get with it.
To cut the PCB to size, I mainly used a box cutter to carve out the shape. (I also got my right thumb severely cut in the process.)
After carving the shape, i drilled necessary holes using a 0.5 mm drill bit. Then there was just a matter of soldering the components on the board. which requires a lot of patience since it's a QFN chip and i don't have a hot air soldering station. But anyways, I got it to work in the first try..
For later, I've designed a double layer PCB which is more than 40% smaller.
You can also refer to the project folder to these images... I've also included Eagle-CAD files
Step 3: PIC Firmware and the Final Product.
I used MikroC pro for PIC to build the firmware. Source code is attached in the project zip file. There is precompiled Hex file that you can burn to the chip using PICKIT2 or any other pic programmer.
Note that you’ll need the registered version of the MikroC pro for pic IDE to compile the project as you cannot compile a code larger than 2000 words in the demo version. But I’m sure you guys can figure that out on your own.
Alternatively, you can convert the code to MPlabX (please send me the project folder if you do).
I’ve used IR remote decoder example code from this link. HERE
I’ve slightly modified the code to trigger the decoding process using an external Interrupt pin so the program don’t need to constantly check whether any data is received from the IR decoder. It also reduces the lag.
In this project, I’ve used a NEC remote. Because it’s easiest to decode. You can refer to the project code for more info on that.
To decode the ir code sent by your remote, You can use UART to send the integer value inside ir_result variable(in case of NEC remote). I used UART_remappable module mapped Tx and Rx pins to RB6 and RB7 respectively (ie. PGD and PGC pins used to program the chip) so I can use the PICKIT2’s UART feature to receive serial data without connecting any other usb to serial converter to the board. (Do I need to elaborate this?)
You can also refer to the IR remote decoder example code I’ve linked above. To get help decoding your remote.
1. As of now you can’t remap the keys. However I’m planning to do this sometime later.
2. Current Code cannot decode RAW ir data. Hence only known IR remotes are supported like sony, NEC, RC5 etc.
Feel free to ask any questions. And do share your experience if you decide to do this project.
We have a be nice policy.
Please be positive and constructive.