Tessel Relay


Control high-current devices, such as power cords and appliances. Turn your coffee maker on when the Ambient module detects light, or based on input from an app.

  • Rated for 240V and 5A
  • AC or DC current
  • Secure and remove wires with the help of a ballpoint pen. No more loose wires or screwdrivers.

For more info visit here.

How To Connect

Cylon.robot({
  connections: {
    tessel: { adaptor: 'tessel', port: 'A' }
  },

  devices: {
    relay: { driver: 'relay-mono' }
  },
});

How To Use

Example using a Direct Pin.

var Cylon = require('cylon');

Cylon.robot({
  connections: {
    tessel: { adaptor: 'tessel', port: 'A' }
  },

  devices: {
    relay: { driver: 'relay-mono' }
  },

  work: function(my) {
    my.relay.on('error', function (err) {
      console.log(err)
    });

    my.relay.on('latch', function(channel, value) {
      console.log('latch on relay channel ' + channel + ' switched to', value);
    });

    every((2).seconds(), function() {
      // Toggle relay channel 1
      my.relay.toggle(1, function toggleOneResult(err) {
        if (err) console.log("Err toggling 1", err);
      });
      // Toggle relay channel 2
      my.relay.toggle(2, function toggleTwoResult(err) {
        if (err) console.log("Err toggling 2", err);
      });
    });
  }
}).start();

Commands

relay.getState( relayChannel, callback(err, state) )

Gets the state of the specified relay channel: "true" for on and "false" for off.

relay.toggle( relayChannel, callback(err) )

Switches the state of the specified relay channel: on if it's off; off if it's on.

relay.turnOff( relayChannel, callback(err) )

Switches off the specified relay channel.

relay.turnOn( relayChannel, callback(err) )

Switches on the specified relay channel.

Events

'error'

Emitted upon error.

'latch'

Emitted when the latch state (boolean on or off ) is changed for a channel.

'ready'

Emitted upon first successful communication between the Tessel and the module.

Compatibility