Scripts & Things Recap: 12/5/2018

Scripts and Things banner

This Wednesday, we wrapped up year one of Scripts & Things, our meetup on JavaScript development for the microcontrollers and embedded systems that make up the Internet of Things. We concluded 2018 with lively discussions before, during, and after a series of demos.

A big thank you to everyone who joined in the fun — especially to our presenters.

Demo #1: The Moddable SDK BLE Stack

Brian Friedkin gives a presentation on the Moddable SDK BLE stack

The first presentation of the evening was by Brian Friedkin, who walked the audience through an overview of the Moddable SDK BLE stack. This is a modern, portable, and modular implementation of BLE in JavaScript with a class-based API. It allows developers to add BLE to applications independent of silicon platform or manufacturer.

Brian gave a brief tour of the features of the BLE stack, including the Client API, Server API, Discovery, Advertising, GATT services, and Security Manager. For details, check out Brian's blog post introducing the BLE stack and the Moddable BLE documentation on GitHub.

To demonstrate the capabilities of the BLE stack, Brian showed off two demos: an ESP32-based "air pedal" and a remote Apple Media Service controller implemented on an ESP32 Moddable Zero.

BLE Demos

The Air Pedal is intended to be used by musicians as a foot pedal for turning the pages of digital sheet music on an iPad or other BLE-compatible device. This clever contraption is essentially a DIY equivalent to the AirTurn PEDPro, which retails for $69 on Amazon. It works by implementing BLE HID over GATT to emulate a (two-key) keyboard. Tapping the buttons on the device send up and down arrow key notifications to the paired iOS or Android device to turn the pages of the music.

Apple Media Service allows BLE accessories to interact with the iOS media player. It exposes characteristics for controlling media playback and notifying on track/media changes. Brian's AMS Client App uses BLE, HTTPS, JSON, JPEG, and the Commodetto graphics library to deliver a rich user experience on an small ESP32-powered touchscreen device. It allows for remote control of the iOS media player; it displays track info, playbar, and album art; and it has media control touch buttons for previous track, play/pause, and next track operations. Please see Brian's AMS blog post for more information and a video.

Brian's presentation and demos made it very clear just how much you can accomplish using BLE with an extremely inexpensive microcontroller and a few extra parts. We look forward to seeing more BLE-based demos from our community at future meetups.

Demo #2: Lights API

Nanoleaf Lights controlled by the Moddable Lighting Control API

Peter Hoddie gave the next presentation, which explored Lights, an API that unifies the discovery, remote control, and monitoring of a variety of commercial Wi-Fi lighting solutions. Lights facilitates changing the power, brightness, and color of IoT lights while also providing tools for light discovery, maintaining state, and managing security. It has been implemented for the protocols used by LIFX, Nanoleaf, Philips Hue, and YeeLight.

Peter demonstrated to our audience how Lights radically simplifies developing controllers and companion experiences for these products. Much like the work that Brian presented allows a silicon-vendor-neutral development workflow for BLE, Peter's Lights API abstracts away the quirks of each lighting product to present a single elegant development target. This is highly germane to the thesis of Scripts & Things: that working with IoT devices in JavaScript is fundamentally better than working with them in native languages.

Demo #3: Lellan SmartTile

Frank Halasz presents the Lellan SmartTile

Next we had a presentation from CEO of Lellan, Frank Halasz. This engaging talk was on the Lellan SmartTile, a one-square-foot Wi-Fi controllable lighting panel that contains a grid of 36 individually addressable RGB cells.

Frank explained how these panels are typically used in large-scale digital canvases that are installed in bars, restaurants, hotels, and more. Unlike the consumer-oriented lighting systems presented by Peter, Lellan typically targets architects and interior designers who wish to bring one-of-a-kind digital art to life in commercial spaces.

Each Lellan DigitalCanvas is powered by Node.js-based smart hub that can control up to 240 SmartTiles. This JavaScript platform enables a smooth developer interaction with the tiles and allows for communication with the Lellan app running on a tablet.

It was wonderful to get an additional perspective on lighting control using JavaScript into our meetup, and we look forward to hearing more about Lellan's advances in the future!

Demo #4: mDNS Door Monitor

Lizzie Prader presents the mDNS Door Monitor.

Our final presentation was given by Lizzie Prader, who showed off a multicast-DNS-based door monitoring system. Lizzie's demo combined a hall effect sensor and a battery-powered ESP8266 to send notifications over Wi-Fi when a door is opened or closed.

A challenge of battery-based monitoring projects is that it is not practical for the device to remain active and ready to respond to state requests at all times. It is only reasonable to wake up the device briefly on state changes, turn on the Wi-Fi radio, send out a notification of the new state, and then power back down. This is problematic when other devices that need to know that state are, themselves, entering and leaving the network over time.

Lizzie presented one solution to this challenge: using an mDNS Sleep Proxy to persist state on the local network. In this setup, the sleep proxy device (in the case of this demo, an Apple Airport) captures the state of the door sensor device on broadcast. The sleep proxy device is then able to respond to mDNS queries that are directed to the low-power device, while the low-power device remains asleep.

This can provide a tremendous improvement in battery life for the low-power device, making deployments of at least several months possible on even an extremely inexpensive device like an ESP8266. Lizzie's demo shows the way to a whole class of low-power sensor devices running JavaScript.

See You Next Year

2018 was a great inaugural year for Scripts & Things. In the coming months, we look forward to continuing to grow our community and to broadening participation and the presentations at our meetups to include more voices from the JavaScript and embedded device design professions.

We can only do this with your help. If you have a proposal for a presentation, demo, or workshop that would be a good fit at Scripts & Things, please reach out to us via our page on Meetup.com.

And, as always, we look forward to seeing you next month!