Build

Programming a Tessel Camera App with JavaScript

2 min readPubNub Staff on Feb 24, 2015
Try PubNub Today

Free up to 1MM monthly messages. No credit card required.

Subscribe to our newsletter

By submitting this form, you are agreeing to our Terms and Conditions and Privacy Policy.

How to program a Tessel camera app to capture images, including connecting your Tessel, all on the client side.

board_camThe Tessel board is an awesome little machine. It allows you to program hardware with JavaScript, and includes a ton of cool modules that can be implemented for a wide variety of applications.

One of those modules is the Tessel camera. This enables you to take your own board, capture images, and publish photos to a real-time picture feed (part two).

In this blog post, we’ll get you started programming your Tessel camera app with JavaScript, which will allow you to take photos with your microcontroller. So let’s get started!

Installing the Tessel Camera Module

First let’s get set up. Clone the contents of the pubnub-tessel directory and following the instructions written on the page.

After following the instructions from the link you should have a working Tessel board, which is connected to your WiFi. The manufacturer recommends that you only switch modules after unplugging the board. Unplug the board and attach the camera module to the “B” socket on the board.

Plug in the board to power it on. Type tessel wifi -l, to make sure the board is connected to your preferred WiFi network.

Next you need to install the package for the camera. At the time of this entry the camera is vc0706. The software can be viewed here. The source page also provides a code example of uploading the image to a directory.

Install the software using npm.

Running the Code

The next step is running the code. Navigate to /projects/streaming-camera. This is the source code. In this directory you will use the camera-server.js.

For the purposes of testing a one-time message you may want to consider removing the setInterval function. The code will work either way, this is just based on preference.

Use the camera-server.coffee file to edit.

After calling package requirements and setting the notification LED, the device is set on.

Sender

This is where the device functions can be called.

These are the messages that tell us the server side is working.

send_img

Receiver

In a separate terminal, use the example in /examples/pubnub_debug_listen.js

This is the message, which tells us the code is working on the client side.

msg_sent

Now if we add the setInteval back into the code, we see what happens on repeat.

send_msg

Everytime the code sends a message, you can see it received in the client-side code. If you’re interested in creating a real-time camera feed, where photos are streamed in real time, check out part two of our series!

tessel camera app

More from PubNub

Can Empathy Exist in the Metaverse
News May 16, 20221 min read

Can Empathy Exist in the Metaverse

A roundtable discussion led by PubNub’s COO, Casey Clegg, exploring the topics of what it means to be human in a virtual world.

PubNub Staff

PubNub Staff

How to Advance Telehealth and Virtual Care Technologies
News May 2, 20221 min read

How to Advance Telehealth and Virtual Care Technologies

Dr. Joe Kvedar, Chair of the Board for the American Telemedicine Association, joins our COO, Casey Clegg, to discuss why...

PubNub Staff

PubNub Staff

Another Step Towards Data Security: ISO-27001 Implementation
BuildMay 2, 20221 min read

Another Step Towards Data Security: ISO-27001 Implementation

Today, we are glad to announce that we are currently in the process of implementing ISO-27001 security standards.

PubNub Staff

PubNub Staff