Andrew Chalkley is the host of , Project Lead of , and a Teacher . Hosting the interview is , the Developer Evangelist at . That Maker Show @thingsSDK @treehouse Taron Foxworth Losant In this conversation, we focused on , which is a set of tools for web developers to create internet-connected hardware projects using . We also cover: thingsSDK Javascript How Andrew got started with hardware The 3 fundamental problems when it comes to hardware and the internet of things Why you should use Javascript when building an app for IoT The challenges when building a Javascript platform for hardware How you can get started and contribute to thingsSDK Andrew, could you give a little background about yourself? Before we dive into thingsSDK, could you give a little background about yourself? Taron Foxworth: Sure. By day I teach at online school where I teach JavaScript and SQL among other things. By night, I’m tinkering :) I host , which aims to break down the barriers to entry into the Maker Movement. I’m also the project lead of thingsSDK. Andrew Chalkley: Treehouse That Maker Show I’ve been working with computers for most all of my professional life. I’m self-taught, and had development jobs in PHP, Ruby, Java and Objective-C. I’m currently stabilized around JavaScript :) The self-taught jack of all trades! For the record, That Maker Show is awesome! The episode is what got me hooked on 3D printing. Taron Foxworth: Introduction to 3D Printing What made you interested in becoming a maker? I’ve learned so many programming languages over the years. It didn’t feel challenging to me anymore. The excitement of pushing pixels on a screen had lost it’s appeal. Andrew Chalkley: So I wanted to stretch myself and get involved with hardware. I feel that I thrive the most at the edge of my current limits. And hardware was a that outlet. So, you turned to the physical world. Nice Taron Foxworth: What hardware or framework did you start with? I started with an . The way I learn the best is to immerse myself in the language of the thing I’m trying to learn. I watched a ton of Adafruit videos and other maker videos online. Andrew Chalkley: Arduino Then, I did a write up “ ”. It still gets lots of traffic and people love it and it seems to resonate with the beginner — because I was a beginner too :) The Absolute Beginner’s Guide to Arduino Yes! I love that. Beginners should write too. It sounds like + is a perfect hardware starter kit. This leads us now to thingsSDK. Taron Foxworth: Arduino Adafruit Can you tell us what thingsSDK is, and how you came up with the idea? There are 3 fundamental problems when it comes with hardware and the internet of things. Andrew Chalkley: Firstly, the cost of these development boards are quite high — especially if you want to connect an Arduino to the internet. Anywhere between $50 and $90 dollars. Secondly, the programming languages aren’t that user friendly. C and C++ have a lot of challenges to new hardware enthusiasts even if you’ve been programming in a more modern language. Thirdly, even if you could get a programming language on the device, there were no modern developer workflows for the professional developer. You had to use clunky IDEs. Out of this frustration came thingsSDK. I run a in Portland, OR. We around 500 people on the books with 30–40 people turn up every month. At the end of one our meetups, I was venting my frustration about the points above. And a close friend of mine, , offered to help tackle this problem with me. JavaScript and Internet of Things group Craig Dennis The first problem — cost. We wanted to be able open this up to as many people as possible. The is a cheap microcontroller module with wifi built in. Costs between $2 — $4 for a development board! ESP8266 The ESP8266 can run Lua and can have Arduino sketches flashed to it. Around this time last year MicroPython was doing a Kickstarter to be ported to the boards. And Gordon Williams, of , started distributing his runtime binaries for the ESP8266. You can think of the Espruino as the Node of microcontrollers. Espruino We created a GUI called to have a one click install for your ESP8266 based development boards, like the NodeMCU and the Adafruit Feather HUZZAH. Flasher.js Flasher.js reduced the amount of time and friction developers had to spend getting JavaScript on the device. To solve the third and final problem, the modern work flow, I wanted to create a CLI utility that was opinionated enough that it would be easy for current JavaScript web developers. They didn’t have to learn anything new, all they need to know is Node and npm. By simply issuing one command you can deploy modern ES2015 JavaScript to a microcontroller. I put a short video together showing off the tools here: Oh so beautiful. You’re bringing the power of a convenient toolchain to the physical world. It looks like we have a question from a community member: Taron Foxworth: Why should I use Javascript for doing IoT? Why should I use Javascript for doing IoT? - Martin Bavio Great question. Because it’s not C. I jest. JavaScript is great for event-driven programming. It’s asynchronous too. You don’t have to keep checking on the state of a button. You can implement a handler for when a button presses. When someone presses the button it triggers the code. Same goes for HTTP requests. While data is loading, you can display things on a screen. Writing non-blocking C code is possible but is challenging. To a JavaScript developer, it’s second nature. JavaScript as meant for hardware! Andrew Chalkley: I have a story about how Marvell (a chip manufacturer) was building an eReader with Sony. In Japan, the firmware and UI were written in C. In the US the UI was written in JavaScript. When comparing the two devices the one in the US was performing faster than the one written in C! I’m not saying people can’t write good C code, it’s just easier to write responsive JavaScript code :) Good point! The real world if event-driven just like javascript. It makes since. But, I’m sure this task isn’t trivial. Taron Foxworth: What are some of the challenges you face creating thingsSDK? Great question. Where do I start? Some of the challenges are to do with the limitations of the ESP8266 devices. Having a JavaScript interpreter on there doesn’t leave much room for complex applications. But most home automation projects that require an internet connection and the ability to switch a couple pins is fine. Or if you want to drive 5 displays and have animation that’s fine too. But if you want to drive 5 displays connect to the internet you’re pushing it. We’re exploring using the ESP32 and some other devices so people can really go-to-town on this stuff. Andrew Chalkley: and Other problems include being able to decipher C and Python code to write the flasher. A lot of the source code looked magic. Craig Dennis did a great job and extracted the flashing code from those languages and he’s even refactored it to be written in functionally reactive programming using RxJS. We’re hoping to do the same for other chips too. Another challenge is not being in control of the runtime environment directly. Ideally, we’d want a small runtime with only the features you’d want in an IoT-based development board. A lot of runtimes have additional overhead and bloat. I’m currently exploring more low-level alternatives and really pushing the limits of my capabilities :) If anyone wants to help on that front let me know :) So, most of the efforts have been to support ESP8266 devices. From what it looks like, the immediate future is to support more devices and figure out a more efficient runtime. Taron Foxworth: What does the future of thingsSDK look like? From the outset, we wanted to make thingsSDK projects portable. The CLI uses what we call “strategies” to transpile for a targeted runtime — in our case it’s Espruino. But we’re not married to it. We — or anyone in that fact — could create other strategies for other runtimes like Kinoma’s JavaScript runtime XS6. Right now, we’re looking at creating additional abstractions to work with other devices. Andrew Chalkley: In other words — if you learn the tools around thingsSDK you won’t need to learn something new even in this ever changing world of IoT runtimes and development boards. We abstract that away from you to some degree — we’re hoping to abstract it further :) So fantastic! So now, I’m going to ask the golden question. Taron Foxworth: If I wanted to get started with thingsSDK, how would I start? Over on we have links to getting started guides and some simple starter projects. We also have a link to our and everyone is welcome. Andrew Chalkley: http://thingssdk.com community Slack channel There are low-hanging-fruit issues on our GitHub where people can contribute. We’ve had many Open Source first-time contributors help with the project so come on in! I can honestly say that the JS IoT Slack channel has been the best hardware resource I’ve seen so far. So many smart people in there! Andrew, thank you for leading such an awesome product. I’m excited to see thingsSDK grow and contribute to it. Taron Foxworth: Do you have any closing points you would like to add? Thanks for having me! I’m really excited to see what the future holds. I think getting this in as many hands as possible will give birth to some awesome innovations and products. Andrew Chalkley: technology If you’re new to hardware be sure to check out That Maker Show, our next two episodes have been shot on “Single Board Computers” and “Internet of Things” and should be coming out in the next couple of weeks! Stay tuned for more! What Next? Make sure you guys follow and If you guys enjoyed this, give it a heart and/or let me know on ! Andrew thingSDK Twitter This interview was originally discussed as on . “Diving into Javascript on Microcontrollers with ThingsSDK with Andrew Chalkley” Sideway Until next time, Stay Connected 😉