Exploring the Tessel 2 IoT and robotics development board
I'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:
- Connecting my Particle Photon Internet of Things device to the Azure IoT Hub
- Playing with an Onion Omega IoT device to show live Blood Sugar on an OLED screen
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!
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.
About Newsletter
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!
Comments are closed.