Scott Hanselman

Exploring the Tessel 2 IoT and robotics development board

December 28, 2016 Comment on this post [10] Posted in Hardware
Sponsored By

13841-01I'm still on vacation and still on the mend from surgery. I'm continuing to play around with IoT devices on my staycation. Last week I looked at these devices:

Today I'm messing with the Tessel 2. You can buy it from SparkFun for the next few weeks for US$40. The  Tessel is pretty cool as a tiny device because it includes WiFi on the board as well as two USB ports AND on-board Ethernet. It includes a two custom "module" ports where you can pop in 10-pin modules like Accelerometers, Climate sensors, IR and more. There's also community-created Tessel modules for things like Color Sensing and Motion.

Tessel is programmable in JavaScript and runs Node. Here's the tech specs:

  • 580MHz Mediatek MT7620n
  • Linux built on OpenWRT
  • 802.11bgn WiFi
  • WEP, WPA, WPA2-PSK, WPA2-Enterprise
  • 64MB DDR2 RAM
  • 32MB Flash
  • 16 pins GPIO, 7 of which support analog in
  • 2 USB 2.0 ports with per-port power switching

Tessel isn't a company, it's a open source project! They are on Twitter at @tesselproject and on GitHub here https://github.com/tessel.

NOTE: Some users - including me - have had issues with some Windows machines not recognizing the Tessel 2 over USB. I spent some time exploring this thread on their support site and had to update its firmware but I haven't had issues since.

Once you've plugged your Tessel in, you talk to it with their node based "t2" command line:

>t2 list
INFO Searching for nearby Tessels...
USB Tessel-02A3226BCFA3
LAN Tessel-02A3226BCFA3

It's built on OpenWRT and you can even SSH into it if you want. I haven't needed to though as I just want to write JavaScript and push  projects to it. It's nice to know that you CAN get to the low-level stuff I you need to, though.

For example, here's a basic "blink an LED" bit of code:

// Import the interface to Tessel hardware
var tessel = require('tessel');

// Turn one of the LEDs on to start.
tessel.led[2].on();

// Blink!
setInterval(function () {
  tessel.led[2].toggle();
  tessel.led[3].toggle();
}, 600);

console.log("I'm blinking! (Press CTRL + C to stop)");

The programming model is very familiar, and they've abstracted away the complexities of most of the hardware. Here's a GPS example:

var tessel = require('tessel');
var gpsLib = require('gps-a2235h');

var gps = gpsLib.use(tessel.port['A']);

// Wait until the module is connected
gps.on('ready', function () {
console.log('GPS module powered and ready. Waiting for satellites...');
// Emit coordinates when we get a coordinate fix
gps.on('coordinates', function (coords) {
console.log('Lat:', coords.lat, '\tLon:', coords.lon, '\tTimestamp:', coords.timestamp);
});

// Emit altitude when we get an altitude fix
gps.on('altitude', function (alt) {
console.log('Got an altitude of', alt.alt, 'meters (timestamp: ' + alt.timestamp + ')');
});

// Emitted when we have information about a fix on satellites
gps.on('fix', function (data) {
console.log(data.numSat, 'fixed.');
});

gps.on('dropped', function(){
// we dropped the gps signal
console.log("gps signal dropped");
});
});

gps.on('error', function(err){
console.log("got this error", err);
});

Of course, since it's using node and it has great Wifi or wired, the Tessel can also be a web server! Here we return the image from a USB camera.

var av = require('tessel-av');
var os = require('os');
var http = require('http');
var port = 8000;
var camera = new av.Camera();

http.createServer((request, response) => {
response.writeHead(200, { 'Content-Type': 'image/jpg' });

camera.capture().pipe(response);

}).listen(port, () => console.log(`http://${os.hostname()}.local:${port}`));

I'll make a Hello World webserver:

var tessel = require('tessel');
var http = require('http');

var server = http.createServer(function (request, response) {
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.end("Hello from Tessel!\n");
});
server.listen(8080);
console.log("Server running at http://192.168.1.101:8080/");

Then push the code to the Tessel like this:

>t2 push index.js
INFO Looking for your Tessel...
INFO Connected to Tessel-02A3226BCFA3.
INFO Building project.
INFO Writing project to Flash on Tessel-02A3226BCFA3 (3.072 kB)...
INFO Deployed.
INFO Your Tessel may now be untethered.
INFO The application will run whenever Tessel boots up.
INFO To remove this application, use "t2 erase".
INFO Running index.js...

Where is my Tessel on my network?

>t2 wifi
INFO Looking for your Tessel...
INFO Connected to Tessel-02A3226BCFA3.
INFO Connected to "HANSELMAN"
INFO IP Address: 192.168.0.147
INFO Signal Strength: (33/70)
INFO Bitrate: 29mbps

Now I'll hit the webserver and there it is!

image

There's a lot of cool community work happening around Tessel.  You can get involved with the Tessel community if you're interested:

  • Join us on Slack — Collaboration and real time discussions (Recommended! - ask your questions here).
  • Tessel Forums — General discussion and support by the Tessel community.
  • tessel.hackster.io — Community-submitted projects made with Tessel.
  • tessel.io/community — Join a Tessel meetup near you! Meetups happen around the world and are the easiest way to play with hardware in person.
  • #tessel on Freenode — IRC channel for development questions and live help.
  • Stack Overflow — Technical questions about using Tessel

Sponsor: Big thanks to Telerik! They recently published a comprehensive whitepaper on The State of C#, discussing the history of C#, what’s new in C# 7 and whether C# is the top tech to know. Check it out!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
December 28, 2016 7:38
I would love to make one of these mini computers to host my Plex server... maybe via WIFI & NAS, ideas?
December 30, 2016 11:03
I thought you hate Javascript :)
December 30, 2016 21:02
Chris, that IoT device doesn't have the capabilities to run Plex. If you want a small computer for Plex look into setting up an Intel NUC, install Linux and have fun with it.

Scott, great article. I play a lot with Robotics and IoT in general and wasn't aware of the Tessel. I recently got the powerful ODROID-C2, loaded ArchLinux and I am having lots of fun with it.
Thanks!
January 03, 2017 6:35
Nice! Hope you are healing up nicely from your surgery.
January 03, 2017 21:18
This is great!!
January 03, 2017 21:48
It is amazing and exciting to see open source projects like this can get this mature and easy to use.
January 16, 2017 4:46
Cara Mengatasi Nafas Pendek Karena Maag - Nafas pendek atau sesak nafas dapat timbul secara tiba – tiba menyerang pernafasan. Hal itu terjadi karena penyempetan saluran udara pada bagian pernafasan.
January 16, 2017 12:52
Vitamin Untuk Pertumbuhan Tulang dan Gigi Anak - Pertumbuhan tulang dan gigi pada anak merupakan prioritas utama untuk para orang tua. Hal itu karena pertumbuhan pada anak sangat berpengaruh untuk masa depannya kelak.
January 16, 2017 17:33
para orang tua. Hal itu karena pertumbuhan pada anak sangat berpengaruh untuk masa depan
January 18, 2017 11:43
pada anak sangat berpengaruh untuk masa depan

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.