September 21, 2018 | Lizzie Prader, Software Engineer
Earlier this week Moddable hosted the second meeting of Scripts & Things, our meetup about embedded software development using JavaScript on microcontrollers and other embedded systems. We were pleased to have a diverse group of web developers, embedded developers, and even some brand new programmers join us and get excited about JavaScript for embedded.
If you're facing problem 1 mentioned above, the picture on screen is the person who moved your clothes and the time displayed on the screen connected to the camera is when they moved them. If you're facing problem 2, the picture on screen is the person whose clothes are in the machine and the time displayed on the screen connected to the camera is how long they've been there.
This demo was meant to be a fun example of wireless communication between several devices. I was also pleased that it led to follow-up conversations with audience members who wanted to add additional features like text updates when your laundry is done (which would be easy to add by reusing code from our twilio example app), and that others were entertained by the idea of taking self portraits with a washing machine.
This demo featured two devices: a STAR Tech Colorific light bulb and a MESH Button Block. Like most IoT products, both devices are compatible with iOS/Android apps created by their manufacturers. Shotaro's JavaScript applications offer an alternative way to interact with them. The first app he showed us simply changes the color of the light every few seconds. The second prints a message to the terminal when the MESH button is tapped, double clicked, or held for a few seconds. The devices in the demo connected as fast as any Bluetooth devices, even with the entire BLE protocol stack written in JavaScript instead of C.
These demos may sound simple, but they are exciting because they demonstrate a much bigger idea: the idea of customizing the devices you buy to suit your own needs. This is an idea we at Moddable embrace and want to see become standard for IoT devices. We talk about it every chance we get whether it's at other meetups, trade shows like Maker Faire, or conferences like Sketching in Hardware.
The first device is an iOS app that displays the timing information. For this demo, it was a quick prototype of the app running on an ESP32 with a small screen attached. The second device is a timing gate that consists of a laser, a photoresistor, a compact mirror, and an ESP32. The mirror is attached to a box a few feet away from another box with the laser, photoresistor, and ESP32. The laser points at the mirror, which reflects the beam of light at the photoresistor. The ESP32 reads the photoresistor to determine when something (a curler) breaks the path of the laser beam.
In the final setup, there will be two timing gates. Each will send the iOS app a timestamped message when the curler crosses its path. The iOS app will calculate how much time elapsed between the two messages and display it on screen.
Products that do the same thing are available on the market already, but it would cost tens of thousands of dollars to purchase enough for an entire curling club. Andy's project makes use of inexpensive materials and will significantly reduce the cost.
For example, the M5Stack Fire and Lily Go TAudio both have built-in NeoPixels. However, their configuration is completely different, so doing something conceptually simple like turning all the lights on ends up being considerably more complicated to code because you have to figure out the pin numbers, count the number of lights on each strand, etc.
He then demonstrated how the Moddable SDK solves this problem for developers by taking care of the configuration behind the scenes and creating a single API for the NeoPixels. Developers can write one JavaScript application that works across all devices supported by the Moddable SDK and simply specify at build time which device they are running it on.
Peter also took the opportunity to show the audience how quick the build process is and how to use xsbug for live, source-level JavaScript debugging.