Scripts & Things Recap: 8/22/2018

Scripts and Things banner

Last week we hosted the first edition of Scripts & Things, our meetup about embedded software development using JavaScript on microcontrollers and other embedded systems. The event was enjoyed by all in attendance and will serve as a launching pad for future meetups in the series.


Our goal with Scripts & Things is to encourage an eclectic mix of presentations and perspectives on embedded JavaScript. In that spirit, our first meeting featured three very different talks: a high-level call to action, a detailed technical demonstration, and a book report.

"Why JavaScript Matters for Embedded Development" Andy Carle, Moddable

I gave the first presentation of the evening. "Why JavaScript Matters for Embedded Development" makes the argument that JavaScript for Embedded is necessary to restore consumer confidence in the IoT industry. Citing a number of negative articles published by prominent media outlets, I established that the reputation of the IoT industry has suffered from issues of consumer trust, dubious security, lack of transparency, dependence on fragile cloud services, and inability to customize products.

I then discussed how JavaScript addresses each of these issues. In short:

  • Having a single engine and runtime on top of which small script apps can run means that working in JavaScript is inherently safer than starting from scratch in native languages. Critical code only needs to be written once and can be inspected all in once place. Individual apps in script are more concise and less error-prone than native applications.
  • JavaScript modules and runtime features lend themselves naturally to leaving safe hooks in applications for end-user or community mods.
  • JavaScript code is accessible to more developers, increasing the transparency of open source projects and making the emergence of IoT app marketplaces far more plausible.

By solving the major crises of the IoT industry, JavaScript for embedded development can help revitalize the marketplace for smart things and lead to a new generation of connected consumer electronics.

"Mozilla Project Things: IoT Demo" Kathy Giori, Mozilla

Mozilla Senior Product Manager Kathy Giori mixed things up in the next presentation by giving an in-depth demo of the Mozilla Project Things IoT gateway.

Kathy began by giving a brief explanation of Mozilla's Web of Things initiative. Their goal is to move "towards a more decentralized Internet of Things that is safe, open, and interoperable." Project Things is Mozilla's experimental framework of software and services that is working towards this goal by "bridging the communication gap between connected devices."

The Things Gateway is part of Project Things. It provides a web interface to monitor and control devices on a local network. (There are instructions to set up your own using a Raspberry Pi on the Gateway page of the Mozilla IoT website.) Kathy walked through all of the Things Gateway's features: discovering devices, monitoring and controlling their properties, the rules engine, the experimental voice assistant, and more.

Impressively, Kathy performed a live demo in which she controlled a number of devices: a series of lights emulating a whole-home smart lighting setup, a blue LED snowflake, and a remote-controllable power outlet based on a Moddable Zero. Kathy showed off how to set up a new Thing, connect to it from the gateway, and control it from the desktop and mobile versions of the gateway webpage.

One compelling feature of the Things Gateway is the drag and drop interface to create "Rules" that connect the state of devices. For example, you can create a Rule that says when your switch is on, your light should turn on too. This feature is a good example of how Mozilla is working towards openness and interoperability of devices. As long as two devices are compatible with the Gateway, they can be used with each other. And they can be used to add functionality to devices without any changes to the application code on the device.

"Book report on The Inversion Factor from MIT Press" Peter Hoddie, Moddable

Photo of The Inversion Factor book

Moddable Principal Peter Hoddie embraced a somewhat unusual format for his presentation: a book report. Peter discussed The Inversion Factor by Linda Bernardi, Sanjay Sarma, and Kenneth R. Traub, presenting his perspective on its key claims, which center around the thesis that companies must evolve from a focus on building products to solving customer problems.

Peter found the book to be worthwhile overall and would recommend it as a guide to how IoT products should be designed to put their owners in control while benefiting manufacturers. He particularly praised The Inversion Factor for its clearly laid-out motivations for "Composability" and "Recruitability" — design principles the authors promote for defining how customers are able to orchestrate the operation of multiple devices and the ability to support new functions through third party use of APIs on devices.

Peter was less convinced by the authors' arguments for the principles of "Mediation," a notion that IoT devices should not communicate directly but should always go through an intermediate gateway, and "Generalize the hardware," which claims that manufacturers should put in as many components as can be done at a reasonable cost in case a third party might find the extra capabilities useful for a new feature. Peter noted that mediation will always lead to higher latency and, thus, fundamentally introduces a design tradeoff. In some situations it may make sense — and in others it may not — depending on factors of privacy, cost, latency, security, scale, and control. Finally, Peter found the idea of "generalizing the hardware" to be naive given the reality of cost pressure on consumer electronics manufacturers. Peter suggested that a pragmatic way for manufacturers to dip their toes into the waters of recruitability would be to explore options that utilize the ROM, RAM, and CPU overhead that already exists in their current hardware.

See You Next Month

It was wonderful to see old friends and meet new developers who are as enthusiastic about JavaScript for embedded as we are at Moddable. We look forward to the next edition of Scripts & Things in September!