Tessel Camera


Add the sense of sight to Tessel!

Take pictures of your projects, from your projects.

  • Supports 640x480, 320x240, and 160x120
  • Still image camera.

For more info visit here.

How To Connect

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

  devices: {
    led: { driver: 'led', pin: 1, connection: 'tessel' },
    button: { driver: 'button', connection: 'tessel' },
    camera: { driver: 'camera-vc0706', connection: 'tessel_A' },
  },
});

How To Use

Example using a Direct Pin.

var Cylon = require('cylon');

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

  devices: {
    led: { driver: 'led', pin: 1, connection: 'tessel' },
    button: { driver: 'button', connection: 'tessel' },
    camera: { driver: 'camera-vc0706', connection: 'tessel_A' },
  },

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

    my.camera.setCompression(0.4, function(err) {
      if (err) console.log("error setting compression: ", err);
    });

    my.button.on('push', function() {
      my.led.turnOn();
      my.camera.takePicture(function(err, image) {
        if (err) {
          console.log('error taking image', err);
        } else {
          // Name the image
          var name = 'picture-' + Math.floor(Date.now()*1000) + '.jpg';
          // Save the image
          console.log('Picture saving as', name, '...');
          process.sendfile(name, image);
        }
        my.led.turnOff();
      });
    });
  }
}).start();

Properties

camera.resolutions()

An object which maps resolution labels to their dimensions. The string labels can be used to configure the camera's resolution.

camera.disable()

Disable UART connection to camera. Closes connection & ends process.

camera.setCompression( compressionFactor, callback(err) )

Determine the amount of compression on each image. Should be a number between 0 and 1. Default is 0.2. Note that the compression is saved in Flash and will be persistent between power cycles.

camera.setResolution( resolution, callback(err) )

Set the size of images. Options are 'vga' (640x320), 'qvga'(320x240) or 'qqvga' (160x120 ). Default is 'vga'. Note that the resolution is saved in Flash and will be persistent between power cycles.

camera.takePicture( callback(err, picture) )

Take a still picture. Returns raw buffer data which you can pipe into a raw http stream or save in memory.

Events

'compression'

Emitted when compression is set.

'error'

Emitted upon error.

'picture'

Emitted when a photo is taken. Returns buffer of image.

'ready'

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

'resolution'

Emitted when resolution is set.

Compatibility