Andrew Chalkley is the host of That Maker Show, Project Lead of @thingsSDK, and a Teacher @treehouse. Hosting the interview is Taron Foxworth, the Developer Evangelist at Losant.
In this conversation, we focused on thingsSDK, which is a set of tools for web developers to create internet-connected hardware projects using Javascript. We also cover:
- 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?
Taron Foxworth: Before we dive into thingsSDK, could you give a little background about yourself?
Andrew Chalkley: Sure. By day I teach at online school Treehouse where I teach JavaScript and SQL among other things. By night, Iām tinkeringĀ :) I host That Maker Show, which aims to break down the barriers to entry into the Maker Movement. Iām also the project lead of thingsSDK.
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Ā :)
Taron Foxworth: The self-taught jack of all trades! For the record, That Maker Show is awesome! The Introduction to 3D Printing episode is what got me hooked on 3D printing.
What made you interested in becoming aĀ maker?
Andrew Chalkley: 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.
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.
Taron Foxworth: So, you turned to the physical world. Nice
What hardware or framework did you startĀ with?
Andrew Chalkley: I started with an Arduino. 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.
Then, I did a write up āThe Absolute Beginnerās Guide to Arduinoā. It still gets lots of traffic and people love it and it seems to resonate with the beginnerāāābecause I was a beginner tooĀ :)
Taron Foxworth: Yes! I love that. Beginners should write too. It sounds like Arduino + Adafruit is a perfect hardware starter kit. This leads us now to thingsSDK.
Can you tell us what thingsSDK is, and how you came up with theĀ idea?
Andrew Chalkley: There are 3 fundamental problems when it comes with hardware and the internet of things.
- 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 JavaScript and Internet of Things group 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, Craig Dennis, offered to help tackle this problem with me.
The first problemāāācost. We wanted to be able open this up to as many people as possible. The ESP8266 is a cheap microcontroller module with wifi built in. Costs between $2āāā$4 for a development board!
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 Espruino, started distributing his runtime binaries for the ESP8266. You can think of the Espruino as the Node of microcontrollers.
We created a GUI called Flasher.js to have a one click install for your ESP8266 based development boards, like the NodeMCU and the Adafruit Feather HUZZAH.
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:
Taron Foxworth: 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:
Why should I use Javascript for doingĀ IoT?
Why should I use Javascript for doing IoT?
Andrew Chalkley: 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!
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Ā :)
Taron Foxworth: Good point! The real world if event-driven just like javascript. It makes since. But, Iām sure this task isnāt trivial.
What are some of the challenges you face creating thingsSDK?
Andrew Chalkley: 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 and 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.
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Ā :)
Taron Foxworth: 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.
What does the future of thingsSDK lookĀ like?
Andrew Chalkley: 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.
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Ā :)
Taron Foxworth: So fantastic! So now, Iām going to ask the golden question.
If I wanted to get started with thingsSDK, how would IĀ start?
Andrew Chalkley: Over on http://thingssdk.com we have links to getting started guides and some simple starter projects. We also have a link to our community Slack channel and everyone is welcome.
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!
Taron Foxworth: 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.
Do you have any closing points you would like to add?
Andrew Chalkley: Thanks for having me! Iām really excited to see what the future holds. I think getting this technology in as many hands as possible will give birth to some awesome innovations and products.
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 Andrew and thingSDK If you guys enjoyed this, give it a heart and/or let me know on Twitter!
This interview was originally discussed as āDiving into Javascript on Microcontrollers with ThingsSDK with Andrew Chalkleyā on Sideway.
Until next time, Stay Connected š