Arduino Micro USB IR Remote Adapter Board

I was shopping on the Adafruit site for a ATmega32u4 based Arduino board and found the page for the Arduino Micro.  From what I read, the Micro is the result of a joint development between Adafruit and the people at Arduino.cc.  A couple of quick mouse clicks (and three business days later) I had my new Arduino Micro USB board.

My new Arduino sat on the shelf for a few weeks before I came up with a quick project that I wanted to use it for.  I use XBMC a lot on both PC and Raspberry Pi and wanted a quick way to get IR keyboard inputs from a remote.  I had used the IR library for Arduino in the past so I was already pretty familiar with the hardware and code involved.    What made the Arduino Micro ideal for this project was the keyboard emulation supported by the board and also its compact size.   I also own a couple of Adafruit Trinket boards but I wasn’t sure how difficult it would be to get the IR and Keyboard libraries to work together on it.

The board I wanted to make would have a standard size male USB plug on it to pass USB data signals and provide 5V to the Arduino Micro.  To do this I had to do a little research on the Arduino Micro board.  Like most Arduino boards, the 5V supply voltage on the Micro are available  through the header pins on the board so I only needed to figure out a way to get to the  USB Data+ and Data- signals.   Looking at the schematics I found that there was a couple of unused header pins on the Micro.  So if I could find a point to connect to the Data+ and Data- signals that normally come in through the micro USB  plug on the Micro I could just run a couple of jumper wires to the spare header pins and pass the signals to the adapter board. 

The point I decided to tap the Data+ Data- signals was next to a couple of tiny SMT components on the bottom side of the board.  I found these points using a DMM to trace the connections from the mini USB pins on the board.

2014 01 19 13.01.51 e1392143721340 1024x579 Arduino Micro USB IR Remote Adapter Board

To pass the Data+ Data- signals to headers on the top side of the board I used a pair of the small (mounting?) holes in the corners of the board.

2014 01 19 13.01.57 e1392143836522 1024x492 Arduino Micro USB IR Remote Adapter Board

Hardware required for the adapter is really pretty simple – the only active component is the IR detector.  The adapter board was made from a small piece of prototyping board with a scrapped USB plug glued onto it.  The black stuff wrapped around the USB plug is a piece of nylon thread (potted in CA glue) used to give the connection some strength.  the little black square at the end opposite of the USB plug is the IR detector.

2014 01 19 20.02.36 e1392144092923 1024x477 Arduino Micro USB IR Remote Adapter Board

On the top side of the board you can see the short profile header sockets that I used along with the USB wiring connections.

2014 01 19 20.02.27 e1392143892118 1024x482 Arduino Micro USB IR Remote Adapter Board

Here’s a couple of pics of the whole thing assembled. 

2014 02 11 11.01.03 e1392145398660 1024x710 Arduino Micro USB IR Remote Adapter Board

2014 01 20 12.56.43 e1392143945855 930x1024 Arduino Micro USB IR Remote Adapter Board

To clean things up a bit I’ll probably put some shrink tube around the whole thing.  

Here’s an example of the Code (not necessarily for the remote shown above):

 C# |  copy code |? 
001
#include <IRremote.h>
002
 
003
int RECV_PIN = 2;
004
int loopDelay = 120;
005
unsigned long lastCode;
006
unsigned long TimeSinceLastRepeatCode = 0;
007
unsigned long mark;
008
 
009
IRrecv irrecv(RECV_PIN);
010
 
011
decode_results results;
012
 
013
void setup()
014
{
015
  //Serial.begin(9600);
016
  Keyboard.begin();
017
  irrecv.enableIRIn(); // Start the receiver
018
}
019
 
020
void loop() {
021
  if (irrecv.decode(&results)) {
022
 
023
    if (results.value == 4294967295){///check for repeat code signal
024
      TimeSinceLastRepeatCode = millis();
025
      if ((millis() - TimeSinceLastRepeatCode) < (loopDelay *2)){
026
        results.value = lastCode;
027
      }
028
      else {
029
        results.value = 0;
030
      }
031
    }
032
    if (results.value == 2155813095){
033
      Keyboard.press(KEY_UP_ARROW);
034
      Keyboard.release(KEY_UP_ARROW);
035
      lastCode = results.value;
036
    }
037
    if (results.value == 2155862055){
038
      Keyboard.press(KEY_DOWN_ARROW);
039
      Keyboard.release(KEY_DOWN_ARROW);
040
      lastCode = results.value;
041
    }
042
    if (results.value == 2155845735){
043
      Keyboard.press(KEY_LEFT_ARROW);
044
      Keyboard.release(KEY_LEFT_ARROW);
045
      lastCode = results.value;
046
    }
047
    if (results.value == 2155829415){
048
      Keyboard.press(KEY_RIGHT_ARROW);
049
      Keyboard.release(KEY_RIGHT_ARROW);
050
      lastCode = results.value;
051
    }
052
    if (results.value == 2155868685){
053
      Keyboard.press(KEY_RETURN);
054
      Keyboard.release(KEY_RETURN);
055
      lastCode = results.value;
056
    }
057
    if (results.value == 2155833495){
058
      Keyboard.press(KEY_ESC);
059
      Keyboard.release(KEY_ESC);
060
      lastCode = results.value;
061
    }
062
    if (results.value == 2155849815){
063
      Keyboard.press('c');
064
      Keyboard.release('c');
065
      lastCode = results.value;
066
    }
067
    if (results.value == 2155848285){
068
      Keyboard.press('p');
069
      Keyboard.release('p');
070
      lastCode = results.value;
071
    }
072
    if (results.value == 2155811565){//stop
073
      Keyboard.press('x');
074
      Keyboard.release('x');
075
      lastCode = results.value;
076
    }
077
    if (results.value == 2155855935){//shutdown menu
078
      Keyboard.press('s');
079
      Keyboard.release('s');
080
      lastCode = results.value;
081
    }
082
    if (results.value == 2155870215){//volume up
083
      Keyboard.press('+');
084
      Keyboard.release('+');
085
      lastCode = results.value;
086
    }
087
    if (results.value == 2155856445){//volume down
088
      Keyboard.press('-');
089
      Keyboard.release('-');
090
      lastCode = results.value;
091
    }
092
    if (results.value == 2155860525){//play pause
093
      Keyboard.press(' ');
094
      Keyboard.release(' ');
095
      lastCode = results.value;
096
    }
097
    if (results.value == 2155866135){//subtitles
098
      Keyboard.press('t');
099
      Keyboard.release('t');
100
      lastCode = results.value;
101
    }    
102
    delay(loopDelay);    
103
    irrecv.resume(); // Receive the next value
104
 
105
  }
106
 
107
}

Posted in Uncategorized
3 comments on “Arduino Micro USB IR Remote Adapter Board
  1. Michael Eidel says:

    Hi Steve,

    wouldn’t it have been easier to tinker an adapter cable from mini-USB to USB-A instead of catching the Data+ Data- signals from the SMD resitors?

    Mike

4 Pings/Trackbacks for "Arduino Micro USB IR Remote Adapter Board"
  1. […] a look at the complete post on his blog with more pics and the […]

  2. […] a look at the complete post on his blog with more pics and the […]

  3. […] a look at the complete post on his blog with more pics and the […]

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Hit Counter provided by orange county property management