Reverse-Engineering an AIM IR Beacon Transmitter

“If I have seen further it is by standing on ye sholders of Giants.”

– Sir Isaac Newton

Here is a synopsis of how the AIM IR Beacon Transmitter was reverse-engineered. The AIM device is used to define the start/finish line for timing laps in car/kart/motorcycle racing. It transmits a coded infrared pulse that is received by a device carried in or on a lapping vehicle. See my Lap Timer Project for more details.

aim beacon transmitter

First I connected a LTR-301 detector, which is an NPN transistor biased by incoming IR light to my oscilloscope, and here is what I saw.

Oscope

IR Signal Pattern on Oscilloscope

An underlying pattern is clearly visible, but pinpoint microsecond timing would be nearly impossible to decipher from this signal. Clearly, further refinement was necessary.

Next I wrote a short and simple IR Capture program for the arduino (the program listing is at the end of this post). I used an AtomSoftTech IR Receiver connected to the VCC, GND and SIGNAL pins of the arduino. I used digital pin #2 on the arduino because it’s associated with an interrupt that can be triggered on alternately falling and raising edges. This made the programming logic very easy. The program captures a set amount of signals, then dumps the results of the capture via Serial.print().

Here is the serial output from the program:

Ready to capture.
1161492
836
1104
652
1188
652
5940
648
1184
652
1184
680
5900
652
1184
652
1184
652
...

It didn’t take long to deduce the code sequence from that:

5923us off.
652us on.
1183us off.
652us on.
1183us off.
652us on.
[repeat]

Next, I attached a logic analyzer to the IR Receiver and grabbed this output:

Logic #1

IR Signal Capture

Logic #2

Expanded IR Signal Capture

The logic analyzer confirmed the arduino results, and provided higher and repeatable accuracy, greater than the arduino’s crystal-based timer.

Below is the Ardweeny I used to run this program. It has a very small footprint for an ardino clone.

Ardweeny

Ardweeny with AtomSoftTech TSOP4038 IR Receiver

/*
  IR Capture
  Copyright 2012, all rights reserved.
  James M. Eli
  1/14/2012

  project parts:
    (1) arduino 16MHz
    (1) 38KHz IR receiver
    (1) breadboard
    (3) wires

  IR - Arduino
  SIG - D2
  GND - GND
  VCC - VCC
*/

//definitions
#define IN_PIN 2
#define MAX_CAPTURE 100

//globals
uint32_t now, start, capture[MAX_CAPTURE];
volatile bool flag_complete;
uint8_t i;

//interrupt fires on ir event (rise/fall)
void IRInterrupt(void) {
  now = micros();
  capture[i++] = now - start;
  start = now;
  if (i >= MAX_CAPTURE) {
    detachInterrupt(0);
    flag_complete = true;
  }
}

void setup(void) {
  flag_complete = false;
  start = 0;
  now = 0;
  i = 0;
  Serial.begin(9600);
  attachInterrupt(0, IRInterrupt, CHANGE);
  Serial.println("Ready to capture.");
}

void loop(void) {
  while (1) {
    if (flag_complete) {
      for (i=0; i<MAX_CAPTURE; i++) {        
        Serial.println(capture[i]);
        flag_complete = false;
      }
    }
  }
}

Advertisements

About Jim Eli

µC experimenter
This entry was posted in Uncategorized and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s