IoT Cookbook > Tessel > Camera

Tessel Camera component

The Tessel Camera component allows the remote triggering of a photo via a WAMP procedure call. The photo is returned as the call result. (Since the Tessel is very slow in processing and transferring the image, you can use progressive call results to inform you of what step is currently taking place).

Tessel with camera

Trying it out

Open a shell for the component directory.

Install the Node.js dependencies by doing

npm install

Start up

crossbar start

This also serves a frontend which allows you to trigger the taking of an image and displays the progress feedback as well as the image.

In camera.js, add the URL of the machine on which runs:

var connection = new autobahn.Connection({
    // replace with the url of your crossbar instance
    url: "ws://<URL OF YOUR CROSSBAR INSTANCE>/ws",
    realm: "iot_cookbook"

Then run camera.js on a Tessel with a camera module connected to port A. (This needs to be port A - no changing ports on this module!)

tessel run camera.js

This should log

camera ready
main called
Procedure '' registered: R1993040553

You might also get

camera error Error: No UART Response...

as part of this. This doesn't necessarily mean that the camera is non-functional - just give it a try!

Once this is running, in the browser frontend click on take photo. You should first see the progress report indicators, e.g. Photo has been taken. and then, eventually, the photo.


The component exposes a single procedure

This returns a hex-encoded photo. (In the example frontent, this is converted to a base64-encoded data URL.)

The procedure can also be called to yield progressive results by setting the option receive_progress: true. In this case, a third handler is attached to the call, and this receives updates about the stage of the process (e.g. "photo taken", "transmitting photo"). The provided example uses progressive results.

Using it

In your own project: