Step 1

Make a directory inside your "tessel-code" folder: enter mkdir ir into your command line, then change directory into that folder: cd ir

Step 2

Plug the IR module into Tessel port A with the hexagon/icon side down and the electrical components on the top, then plug Tessel into your computer via USB.

Step 3

Install by typing npm install ir-attx4 into the command line.

Step 4

Save this code in a text file called ir.js:

// Any copyright is dedicated to the Public Domain.

This infrared module example transmits the
power signal sequence of an Insignia brand
television every three seconds, while also
listening for (and logging) any incoming
infrared data.

var tessel = require('tessel');
var infraredlib = require('ir-attx4');
var infrared = infraredlib.use(tessel.port['A']);  

// When we're connected
infrared.on('ready', function() {
  console.log("Connected to IR!");
  // Start sending a signal every three seconds
  setInterval(function() {
    // Make a buffer of on/off durations (each duration is 16 bits)
    var powerBuffer = new Buffer([0x22,0xc4,0xee,0xd0,0x2,0x58,0xfe,0xc,0x2,0x8a,0xf9,0xf2,0x2,0x8a,0xf9,0xc0,0x2,0x58,0xfe,0xc,0x2,0x58,0xfe,0xc,0x2,0x8a,0xfe,0x3e,0x2,0x8a,0xfe,0x3e,0x2,0x8a,0xf9,0xc0,0x2,0x58,0xf9,0xc0,0x2,0x8a,0xfe,0x3e,0x2,0x8a,0xf9,0xc0,0x2,0x58,0xfe,0xc,0x2,0x58,0xfe,0xc,0x2,0x58,0xfe,0xc,0x2,0x58,0xfe,0xc,0x2,0x8a,0xfe,0x3e,0x2,0x8a,0xf9,0xc0,0x2,0x58,0xf9,0xc0,0x2,0x8a,0xf9,0xf2,0x2,0x8a,0xf9,0xc0,0x2,0x58,0xfe,0xc,0x2,0x58,0xfe,0xc,0x2,0x8a,0xfe,0x3e,0x2,0x8a,0xfe,0x3e,0x2,0x8a,0xfe,0xc,0x2,0x58,0xfe,0xc,0x2,0x58,0xfe,0xc,0x2,0x58,0xfe,0xc,0x2,0x58,0xf9,0xc0,0x2,0x8a,0xf9,0xc0,0x2,0x58,0xf9,0xc0,0x2,0x58,0xf9,0xc0,0x2,0x58]); 
    // Send the signal at 38 kHz
    infrared.sendRawSignal(38, powerBuffer, function(err) {
      if (err) {
        console.log("Unable to send signal: ", err);
      } else {
        console.log("Signal sent!");
  }, 3000); // Every 3 seconds


// If we get data, print it out
infrared.on('data', function(data) {
  console.log("Received RX Data: ", data);

Step 5

In your command line, tessel run ir.js
Try turning on your TV! Look at the IR LED through a camera.

Bonus: Change the code to turn on a different device.

To see what else you can do with the IR module, see the module docs here.

Step 6

What else can you do with a IR module? Try a community-created project.

What are you making? Share your invention!

If you run into any issues you can check out the IR forums.

Choose another module

Or if you're all set, move on to Wifi.

Fork on Github