Why?

Why would anyone want to use the web platform for physical computing ? Are there not many good environments already available to do precisely that ?

Yes, there are. Processing, openFrameworks and Pure Data, for example, are all great, proven platforms.

However, the web technologies (HTML/CSS/JavaScript) do have an advantage. This advantage is the unique combination of the following :

  • ubiquity : they are everywhere, even more so with the advent of the IoT;
  • familiarity : almost everybody has used or knows about them;
  • community : they have a gigantic user base and tons of free resources;
  • simplicity : they have a small learning curve and can be picked up quickly.

Yeah, okay. But who wants an app that can only run in the restricted sandbox of a browser window?

With tools such as nw.js (a.k.a. node-webkit) or Cordova, you can write desktop or mobile applications that behave exactly like any other native application. You can even run compiled JavaScript code directly on microcontrollers such as the Tessel or the Espruino.

That’s all fine but JavaScript still remains a front-end technology. It was never meant to do the heavy lifting required by back end tasks ?

JavaScript started in the front-end but moved to the back-end a long time ago. With Node.js you can actually write event-driven, non-blocking network heavy-duty applications. Furthermore, there are over 125 000 modules currently available for Node. I think the back-end is covered.

Okay, but in a physical computing project you need access to sensors and actuators. Those won’t be available to JavaScript, won’t they ?

Well, with nw.js you can use the whole front-end stack and any of the Node.js modules. There are modules to talk to serial ports, to Arduinos, to MIDI devices, to Pebble watches, to I2C devices, to gpio inputs, etc. As a matter of fact, whole frameworks are now available to do just that. As an example, Cylon.js and Johnny-Five will let you fly a drone or control a robot from within the comfort of your beloved JavaScript environment.

Let’s say all of that is true. It does not change the fact that JavaScript is slow. You can’t counter that.

If your project’s first criteria is speed, then web technologies are probably not the best choice. However, performance is rarely the first nor the only criteria in a physical computing project. When you balance all factors, you probably will (in all likelyhood) arrive at the conclusion that it is fast enough. If it’s not, please use something else. But with WebGL and JIT (just-in-time) compiling, JavaScript is pretty fast and will get even faster. As an example, Mozilla’s new asm.js engine is reported to offer near-native performance. That’s plenty fast for me! And WebAssembly is just around the corner…

But…

I’m sure there are scenarios where the web technologies are not the best choice or not even a good choice. But those scenarios are becoming harder to find.

The web platform has such a great toolkit behind it that it is becoming one of the best alternatives for physical computing, tangible interactivity, robotics and IoT projects. And, because of it’s simplicity, it is especially welcoming to hobbyists, makers, artists, hackers, and tinkerers of all sorts which this site is aimed at and who we welcome with open arms.

Let’s get tangible!


The header photomontage contains images from Greg Borenstein, creativecaos86 and jabstarr. The photos are being used according to the terms of the Creative Commons license.