IRK! Infrared Remote USB Keyboard

Control your computer with an IR remote

Similar projects worth following
IRK! is a USB keyboard, without keys, that you can operate by simply using your LEARNING infrared remote control.

I designed IRK! to allow me to control my MythTV home theater PC with my learning infrared remote control instead of having to use a real USB keyboard - but it will work with any system (Linux, Windows, or whatever) that you can plug a USB keyboard into, and also other home theater systems like XBMC and MediaPortal.

Many people use LIRC on Linux to control MythTV, but my solution does not require you to edit any complicated configuration files and does not need any special device drivers or software to be installed. However, you do need to build it - which is way more fun!

IRK! comes in two flavours: a Through Hole Technology (THT) version using a PIC18F2550, and a Surface Mount Technology (SMT) version using a PIC18F25K50. Both have been built and tested (WAF=100%).

IRK! is an open-hardware project that I created on SourceForge. Contributors and bug reports ar

This project is for reasonably advanced electronic nuts...but if you stick with it anyone can make it.

Through Hole Technology (THT) version

If you choose to build the Through Hole Technology (THT) version, then you will be making a Printed Circuit Board (PCB) or at least a matrix board, soldering electronic components onto it, and then programming a PIC micro-controller, so you'll need:

  • PCB making equipment. I use inkjet transparencies, an ordinary fluorescent desk lamp as a UV source, and Kinsten positive-acting presensitised board, and ferric chloride etchant.
  • A good soldering iron with a fine tip. I soldered everything on both the THT and SMT boards with a Hakko T18-B 1 mm ball tip.
  • A micro-controller programmer able to program a Microchip PIC18F2550 micro-controller, such as a Pickit2 or you can make your own (search for "pic programmer" on Instructables).
Surface Mount Technology (SMT) version

If you choose to build the Surface Mount Technology (SMT) version, then you'll need:

  • A PCB manufacturer to make a double-sided PCB. I used a company called ITEAD who have very reasonable rates and manufacture very high quality boards. All the Gerber files are available on SourceForge. You just need to zip them up and email them to the manufacturer, pay your money and wait.
  • To be able to solder small Surface Mount Devices (SMDs) to the PCB. That is not as hard as it seems as the design uses only relatively large SMD parts. There are plenty of tutorials on the Internet showing how to handle SMDs. A Hakko T18-B 1 mm ball tip (or similar) is fine - even for the ICs. Use plenty of "no clean" flux.
  • A micro-controller programmer able to program a Microchip PIC18F25K50 micro-controller, such as Mikroelektronika's mikroProg for PIC. Unfortunately the PIC18F25K50 is not supported by Pickit2 and even Pickit3 seems to lack support (well, I couldn't get it to work, so I bought a mikroProg which seems to be better anyway).

And in case it doesn't work for you first time, you may find it helpful to have:

  • A good logic analyser like Logic (works on Windows or Linux)
  • A USB trace capture program like USBTrace or USBlyzer (for Windows) or Wireshark (free on Linux). On Linux, make sure you're using the libpcap 1.1 (packet capture library) or later. 

Circuit Diagram

The circuit can be divided into a number of functional groups.

Infrared Receiver Interface
The infrared receiver consists of the TSOP4838 IR receiver module. Its job is to convert 38 kHz modulated IR signals from your remote control into digital ones and zeroes. The receiver will output a logical one (0V) when the remote is transmitting a 38 kHz signal, and will output a logical zero (+5V) during periods of silence.

Infrared Transmitter Interface
The transmitter consists of a PN2222A transistor (but any general purpose NPN transistor will work) which drives a series of three Infrared Light Emitting Diodes (IR LEDs). Driving three IR LEDs is done to boost the transmitting power. Learning remotes are designed to accept signals from remote controls in close proximity and remotes are designed to produce an intense IR signal. Consequently, IRK! must produce a fairly intense IR signal in order for the learning remote to be able to "see" it during the learning process.

LCD Interface
The Liquid Crystal Display is a 2x16 (2 lines at 16 characters per line) unit compatible with the Hitachi HD44780 4-bit defacto standard. You can use a 4x16, or a 4x20 display if you like as long as it is HD44780-compatible. These are available on eBay at very reasonable prices.

USB Interface
The USB interface is provided by the USB module built into the PIC18F2550 microcontroller. It is managed programmatically by the USB library provided with the MikroC Pro C Compiler.

Activity LED Interface
Hardly an interface as such - a simple LED and a current-limiting resistor - but if you use a high intensity (8000 mcd) green LED then I've found that you can make the resistor an insanely...

Read more »

  • 1 × PIC18F2550 THT: Microprocessors, Microcontrollers, DSPs / Microcontrollers (MCUs)
  • 1 × TSOP4838 (IR Receiver and Demodulator) Opto and Fiber Optic Semiconductors and ICs / Other Optoelectronic ICs
  • 1 × TSAL7400 (infrared LED 940 nM) Opto and Fiber Optic Semiconductors and ICs / Infrared (IrDA)
  • 1 × LCD Display (16x2) HD44780-compatible with backlight
  • 1 × PN2222A (or equivalent e.g. BC548) THT: Discrete Semiconductors / Transistors, MOSFETs, FETs, IGBTs

View all 28 components

  • Touch interface to replace buttons

    androidarmstrong05/04/2014 at 07:17 0 comments

    I'm in the middle of trying to figure out how to replace the (very reliable, well-proven, cheap) push buttons on the front panel with a touch interface (a bit flaky, not widely used, but still cheap as no buttons are required) that uses Microchip's "Charge Time Measurement Unit" (CTMU) that is built into the PIC18F25K50 chip.

    Initital testing (using Kapton tape as the dielectric) shows that it is feasible, but when I swapped the Kapton tape with 2 mm Lexan (polycarbonate) the whole thing turned to brown-colored stuff...switching became erratic and sometimes not responsive to touch. One of the problems is how to calibrate the sensing so that different finger types (big, little, sweaty, dry etc) work reliably and environmental variations over time (humidity, temperature etc) are accounted for.

    Another problem is that testing is a little difficult because it's looking like I might need to have a prototype board manufactured, then tweaked, then re-manufactured and so on. That could get expensive.

    Still, I think it is worth persuing if only because the unit would look better with a flat panel interface. One of the good things about using CTMU intead of buttons is that the front panel artwork is simply printed on a piece of paper and slipped behind a transparent polycarbonate sheet - no more drilling holes or wiring switches. Your front panel can be printed on an inkjet printer so you can make it look as classy or weird as you want.

View project log

  • 1
    Step 1

    Through Hole Technology (THT) version

    This is how I built the Through Hole Technology version

    • Make a double-sided fibre glass PCB (see front- and back- PDF files below). There are several ways to do this. The way I do it is to print the front and back PDF files onto inkjet transparencies using the highest quality level. It doesn't matter whether you print mirrored or not because you can always flip the transparency. Line the transparencies up and tape along one edge to keep them aligned. Cut some Kinsten positive resist PCB to size and peel off the protective layers. Insert the PCB between the two transparencies, carefully line up the transparency to the PCB, and clamp the lot between two pieces of glass using pegs or whatever. Now that the protective layers have been peeled off, the photo-sensitive coating on the PCB is now exposed to light, so try to keep it out of any unintentional UV light sources (e.g. the sun, fluorescent lights, arc welders etc). Use an ordinary fluorescent desk lamp to expose each side for 10 minutes at a distance of about 5 cm. Develop with DP-50 developer until the tracks are clearly seen. Then etch using ferric chloride.
    • Drill all the small (0.8 mm) holes first, then the larger holes (1 mm) for the headers, then the largest (3 mm) for the 4 x 2.5 mm LCD mounting bolts.
    • Solder all components onto the PCB starting with the lowest-profile parts. For example, the SMD bypass capacitor is a good place to start, then resistors, capacitors, crystal, trimmer resistor, IC socket, headers and LCD socket.
    • Tantalum capacitors are polarised. This means you have to make sure they are inserted the right way around. The lead closest to the painted "stripe" is the positive (+) lead. Note that this is the opposite part labeling convention to diodes, where the "stripe" indicates the negative (-) side (aka cathode).
    • Leave the IR transmitting LEDs until later as you will have a better idea how long you will have to make their leads then. Also leave the IR receiver module until later as it will be connected to the PCB with fly leads and a female plug.
    • Make sure you don't mount the crystal flush to the PCB otherwise it will come into contact with some of the PCB tracks. You could insert a plastic spacer but it's easier just to keep a 1-2 mm air gap between the crystal and the PCB.
    • For the PCB layout, I've cheated on some vias by using some legs of wired parts as vias. I'll never do that again - it's not worth the trouble! You have to remember to solder both sides of the board for these parts. In particular, if you miss the middle pin of the IR receiver module, then none of the buttons will work as they won't be connected to ground!
    • After soldering each part, use your multimeter to check connections. For example, after you solder the SMD bypass capacitor, check that it is not shorted and that it still reads 100 nF. It's best to fix soldering problems as you go rather than after the unit is fully built.
    • I built my unit behind a Lian Li aluminium 5.25" drive bay panel and connecting it to an internal motherboard USB header using a cable liberated from a broken USB card reader. It's probably easier to modify one of these drive bay drawers though.
    • The IR receiver module deserves special attention. I glued mine to the 5.25" front panel using Araldite two-part epoxy. The IR receiver is connected to the PCB via a miniature female plug - the type used to connect speakers etc to a PCB socket. You solder three leads to the PCB and on the other end of the leads you have a miniature female plug. You push the plug onto the legs of the IR receiver module.
    • Wire up the switches using rainbow cable. There is one wire per switch which has to go to the corresponding connection point near the micro-controller. The circuit diagram and board layout shows these connection points. For example, the Teach button connection point is marked with a "T".
    • Plug the LCD display into a 16-pin SIP socket and bolt it to the PCB using plastic spacers. You may have to cut the spacers to the correct height. An easy way to make sure they all have the same height is to buy threaded plastic spacers, then bolt them onto a piece of spare timber, then use a drop saw to cut them all at once.
    • Make a pair of L-shaped aluminium brackets and bolt them to the edges of the PCB. These will become the mounting points with which you will later attach the PCB to the 5.25" drive bay panel.
    • Mark out the front panel holes, LCD window and IR window by using the PCB layout as a template. To do that, print it on an inkjet transparency, tape the transparency to the 5.25" drive bay panel and drill though it. Use a nibbler to cut the LCD and IR windows in the panel, then file the inside edges until they are straight. Use a tiny piece of wet-and-dry sandpaper to smooth the edges further if you wish.
    • For the push buttons, don't drill the holes just yet. Instead, glue a 12 mm thick piece of wood (pine is good) behind the front panel using Araldite (see picture below). The wood will act as a guide for the push-button rods. Once the Araldite has set, drill a hole for each push button through the front panel and completely through the wood behind it too. I used a piece 3/16" clear acrylic rod for each push-button and drilled a 13/64" (5.2 mm) hole for each. The 3/16" is 4.8 mm in theory, but when I measured the rod it was 5.0 mm, so a 0.1 mm gap is all that you need between the rod and the hole.
    • Now is a good time to make the front panel artwork. See "How to Make the Front Panel Artwork" below. You can leave it until later like I did, but it's more troublesome.
    • The acrylic rod used for the push buttons can be cut by scoring it at the required length using a craft knife and snapping it with your fingers. You may have to try a few times until you get a decent edge. Even so, the edge will be translucent (i.e. not clear) and not necessarily square so you will need to sand it down first with P180 glass paper to get a square end. If you want to make the ends transparent you will need to do some extra work. Sand first with Grade P2000, then 15μ 3M Microfinishing Film 468L, then 5μ, then 0.5μ - each time make sure the paper is resting on a sheet of flat glass. This stuff is so fine you wouldn't think would be abrasive at all, but you will find that the ends will become transparent after you use the 0.5μ paper. It's probably not worth it really...translucent is ok.
    • Insert the acrylic rods until they touch the top of each microswitch. To stop them from falling out again, use some rings of heat shrink tubing to hold them in place. To do that, get some 5 mm heat shrink tube, and cut one 3-4 mm ring for each rod. Thread each ring onto some spare 3/16" rod, use a hair dryer (or whatever) to shrink them onto the rod. When they have cooled, push them all off the rod, insert the push button rods into their positions and thread the pre-shrunk rings onto each rod to hold them in place. A pair of good tweezers makes this a lot easier. A dob of glue may be necessary to ensure that the rings don't slip. Don't try to shrink the tubing directly onto your acrylic rods...the heat may deform the rods so that they won't slide properly.
    • For the IR transmitter window, cut a piece of Infrared-transparent acrylic to size and glue it behind the IR transmitter window on the front panel. This stuff is incredibly hard to buy, so I ended up hacking a piece out of an old IR remote control. It's the dark red plastic that hides the internals but still allows infrared light to pass through it.
    • For the activity LED I already had a clear acrylic light guide that I'd harvested from some dead electronics. I drilled and filed a 2 mm x 5 mm slot in the front panel and epoxied the light guide behind it. If you use a light guide then the LED lead length is not critical. Alternatively, you could panel mount the LED with a plastic LED clip and have the LED leads plug into a socket on the PCB. Alignment of the PCB to the panel becomes finicky though.
    • Finally, put the PCB into the front panel so that the LCD is positioned squarely in the front panel's LCD window and use masking tape to temporarily hold it in that position. Now drill one (or two if you prefer) holes in each side so that the holes go through both the 5.25" drive bay panel wings and the PCB side brackets. Remove the masking tape and then bolt the side brackets to the 5.25" drive bay panel wings. Use flat-headed bolts if you have them. Don't forget to plug the IR receiver up.

    How to Make the Front Panel Artwork

    • I'd recommend doing this step before you have mounted any component on the front panel (that is, the IR transmitter LED, the IR receiver window filter, and the activity LED), but after you have cut/drilled all the holes.
    • This is my second attempt at this. Using Inkjet Waterslide decal paper was a complete failure! Waterslide decals just don't stick to aluminium very well. Instead, get some sheets of Clear Inkjet Adhesive Shipping Labels (for example, Avery 8665), print the words/design that you want to appear on the front panel using any program that you're comfortable with. Microsoft Visio worked for me.
    • Cut out the rectangle that contains all the words/graphics. Then spray it with a few light coats of clear gloss acrylic paint.
    • After the acrylic has dried (maybe 20 minutes), peel the backing away, line it up with the front panel, and roll it into place (so you don't get bubbles).
    • Trim around the outside edges with scissors leaving a 5 mm border (or more). Use a craft knife to cut the front panel cutouts - again leaving a 5 mm border.
    • Cut diagonally towards the corner of each cutout and tuck the flaps under so that they wrap around and stick to the back of the panel. Similarly, chamfer the corners of the outside edge so that the flaps can stick to the sides without overlapping. This sounds complicated but it is really obvious once you start!
    • Next, use a craft knife to cut out the front panel button holes. There is no advice here except to be as neat as possible - cutting 5 mm circles in plastic is not easy.

    Tip for Soldering Hand-made Vias

    With a double-sided PCB sometimes the tracks on one side of the board need to be connected to tracks on the other side. This is called a "via". Manufactured boards have plated-through holes for that purpose (that is manufacturing magic of which I know nothing). For hand-made boards you can either solder, on both sides, a piece of single-core wire through the via hole - or you can do this...which I think is easier:

    If you have an IC socket in your spare parts box which has machined sockets (not spring sockets), then just use your wire-cutters to cut off the pins so that you have a set of "goblet" shaped pins (usually a bit mangled on the top, but it doesn't matter). Wedge a "goblet" into each via hole - they'll hold themselves in place - then solder them on each side!

    Don't Forget to Set The LCD Contrast

    When you power it up for the first time, don't forget to set the LCD contrast by adjusting the 10 kΩ variable trimmer resistor. Once you have done this you will not need to readjust it. Failure to to this may cause you to think that the LCD display is not working.

    Experimental Power/Reset Switch Control Connections

    If you decide to implement the experimental power/reset switch functions then you will need to connect IRK!'s PWR and RST pins in parallel with your PC's Power and Reset switches. This is pretty easy because the Power and Reset switch cables on most PCs connect to a header on the motherboard. What you have to do is redirect these cables to IRK!'s header pins, and then make up another pair of cables and connect them between IRK! and your motherboard PWR and RST header pins. The connectors that you should use on the ends of each cable are Harwin M20-1060200 2.54 mm pitch rectangular housings with Harwin M20-1180046 female crimp contacts crimped to the end of each wire. You can usually harvest these from an old PC.

    Note that polarity is important when using 2N7000 FETs! This is not intuitive because although a switch does not have polarity, the circuit on your PC's motherboard that senses the switch action has a ground pin and a sense pin. The sense pin will be kept weakly high (above ground) by your motherboard. Pressing the power button, for example, will short the PWR+ sense pin to ground (the PWR- pin), causing your motherboard to begin the power up cycle. But the 2N7000 FETs that IRK! has in parallel with the switches each have a reverse diode built into them, so if you connect the cables the wrong way around it would be the same as constantly pressing the power and/or reset buttons! Not good.

    Surface Mount Technology (SMT) version

    The construction for the SMT version is much the same as the THT version. However, a few things are worth noting:

    • Hand soldering small SMT devices is much easier if you can somehow hold the device in place leaving both hands free to work the soldering iron. I'd suggest making a Do-It-Yourself SMD clamp as shown in the picture above. The idea is to let gravity hold the device in place while you solder it. The general process is, apply plenty of "no clean" flux to the pads, position the part with tweezers, hold it in place with the DIY clamp, apply a tiny dot of solder to the soldering iron tip (let the core flux burn off), solder one end of the part, apply more "no clean" flux, add another tiny dot of solder to the tip, solder other end, remove clamp, flush area with isopropyl alcohol, soak up excess alcohol with a lint-free wipe. You don't normally apply solder to the tip of the iron and then apply it to the work (certainly not for through-hole soldering) - but I think it works better for surface mount devices.
    • The 2N7000 FETs have been replaced by a single 4066 CMOS Quad Bilateral Analog Switch integrated circuit. The 4066 has a much more "switch-like" behaviour so polarity becomes irrelevant. Just make sure you don't try to switch more than 25 mA of current. The 4066 is not a power switch.
    • The parts list consists mostly of SMT parts. The following is the parts list as exported by Eagle CAD:

      Part Value Device Package Description

      C1 4.7uF CPOL-EUSMCA SMC_A POLARIZED TANTALUM CAPACITOR C2 4.7uF CPOL-EUSMCA SMC_A POLARIZED TANTALUM CAPACITOR C3 100nF C-EUC0805 C0805 CERAMIC CAPACITOR C4 100nF C-EUC0805 C0805 CERAMIC CAPACITOR C5 100nF C-EUC0805 C0805 CERAMIC CAPACITOR C6 100nF C-EUC0805 C0805 CERAMIC CAPACITOR D1 SS14 SS14 SMA-DIODE SS14 Schottky Diode D2 SS14 SS14 SMA-DIODE SS14 Schottky Diode D3 SS14 SS14 SMA-DIODE SS14 Schottky Diode IC1 PIC18F25K50 PIC18F25K50SO28W SO28W PIC Microcontroller IC2 MAX4066ESD MAX4066ESD SO14 Quad Bilateral Analog Switch JP2 ICSP PINHD-1X6 1X06 PIN HEADER JP3 USB PINHD-2X5 2X05 PIN HEADER JP5 SWITCHES PINHD-1X8 1X08 PIN HEADER LCD1 HD44780 HD44780 LCD_16X2 Generic HD44780 16x2 LCD LED1 ACTIVITY LED5MM LED5MM LED (any color) LED2 TSAL4700 LED5MM LED5MM IR LED LED3 LED5MM LED5MM IR LED LED4 LED5MM LED5MM IR LED Q1 MMBT2222A MMBT2222A SOT23 2N2222 General Purpose NPN Transistor Q2 MMBT3906 MMBT3906SOT23 SOT23 2N3906 General Purpose PNP Transistor R1 100k R-US_M1206 M1206 RESISTOR R2 100 R-US_M1206 M1206 RESISTOR R3 470 R-US_M1206 M1206 RESISTOR R4 22 R-US_M1206 M1206 RESISTOR R5 4.7k R-US_M1206 M1206 RESISTOR R8 4.7k R-US_M1206 M1206 RESISTOR R9 10k R-US_M1206 M1206 RESISTOR S1 DOWN C&K-PTS525-SM10 PTH525-SM10 Momentary Switch S2 UP C&K-PTS525-SM10 PTH525-SM10 Momentary Switch S3 OK C&K-PTS525-SM10 PTH525-SM10 Momentary Switch S4 SHIFT C&K-PTS525-SM10 PTH525-SM10 Momentary Switch S5 ALT C&K-PTS525-SM10 PTH525-SM10 Momentary Switch S6 CTL C&K-PTS525-SM10 PTH525-SM10 Momentary Switch S7 TEACH C&K-PTS525-SM10 PTH525-SM10 Momentary Switch U1 TSOP4838 TSOP4838 TSOP18XX IR Receiver and Demodulator VR1 10k TRIMPOT3303W 3303W Trimmer Potentiometer

View all instructions

Enjoy this project?



Tachyon wrote 07/11/2014 at 15:13 point
This is perfect for those of us with home theatre PC setups. I've been wanting just such a thing since the first day I set mine up....let's see now, where did that pickit2 get to?

  Are you sure? yes | no

Adam Fabio wrote 06/23/2014 at 02:47 point
PC Keyboards aren't always the easiest thing to have stuck in the couch - so this is a great idea for home theater! Thanks for entering it in The Hackaday Prize! Geat Dave Jones Impression Too :)

  Are you sure? yes | no

Eric Evenchick wrote 05/04/2014 at 08:46 point
I like how this thing drops into the drive slot, very clean looking. Do you have a preferred remote to pair with this?

  Are you sure? yes | no

androidarmstrong wrote 05/05/2014 at 12:10 point
Hi Eric,
I used a Lian Li aluminium blank drive bay the one here:
It's designed to snap into a Lian Li drive bay slot, but it seems to fit a standard drive bay anyway. I bolted some extruded aluminium angle to the PCB and bolted *that* to the wings of the Lian Li bezel. It slid snugly enough into the drive bay that the bezel itself didn't really need to be bolted to the bay. If I had a (working) 3D printer it might be better to print a harness and then just glue a flat piece of aluminium (with cutouts) to the front - if you really wanted the metal look, that is.

  Are you sure? yes | no

androidarmstrong wrote 05/05/2014 at 12:16 point
Regarding the remote...I use a (relatively ancient) Home Theater Master MX-500
...but I think any modern remote that can learn IR codes would work.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates