Building robots and rockets with Javascript

Computers & Mobile Drones & Vehicles Rockets Technology
Building robots and rockets with Javascript
YouTube player

Ron Evans and Adrian Zankich talking about Cylon.js on the Make: Electronics Stage at the 2014 Bay Area Maker Faire

There was a time when turning an LED on and off using a microcontroller took a week, and detailed knowledge of the microcontroller. But that was before Arduino. But even with Arduino people sometimes found it hard to hack together the things the wanted to do, especially when you had to deal with networks, something that was traditionally seen as hard on an Arduino.

Despite that the Arduino, and later the Raspberry Pi, made building things—robots for instance—much easier, primarily due to the huge community that they built up around themselves. It has been those communities that has led the Arduino and the Raspberry Pi to dominate the landscape. If you had a problem, there was someone that had probably already had the same problem and solved it for you.

A Cylon.js controlled Sphero (credit Matthew Bergman)

Enter the web developers, and node.js. For those of you who haven’t come across it yet, node.js is a server-side solution for JavaScript—it’s an event-driven Javascript platform which does non-blocking I/O—and is rapidly gaining popularity, and mindshare amongst the web community. It’s that popularity and the arrival of boards that natively speak Javascript—like the Tessel or the Espruino—that means that a third community is now growing.

This third community doesn’t seem to look at microcontrollers, electronics, and things like building robots, quite the same way as we’ve done in the past, and that makes a lot of sense. Coming from a high level language background, and the web, they put the software stack first, and networking a close second. Their approach leads to frameworks like Cylon.js—a JavaScript framework for robotics, physical computing, and the Internet of Things written for node.js.

I first ran across them at ThingsCon earlier in the year, where they held a workshop using Spheros, Arduinos, and the Leap Motion gestural controller to show how easy it is to hack hardware using Javascript. So when I saw they were talking on the Make: Electronics Stage at the Bay Area Maker Faire a couple of weeks ago, I thought that this was a good chance to sit down and talk  to Ron Evans—one of the creators of Cylon.js—about the Cylon.js framework and where it was going.

So tell me about Cylon.js?

Cylon.js is a open source JavaScript framework for robotics and the Internet of Things. It supports 19 different hardware and software platforms, and multiple platforms at the same time. Our goal is to make developing software for devices as easy as web development.

Why Javascript?

JavaScript is one of the most popular programming languages, and thanks to being built on top of node.js we can handle the real-time I/O and streaming needed to communicate with many different devices.

There seems to be a lot of interest from the Javascript—especially the Node.js community—in hardware, why do you think that is?

There are a couple different reasons. One is that the JS community are very much trail-blazers in terms of exploring new technologies. Another is the influence of my friend Chris Williams—the main organiser of JSConf and the newer RobotsConf—who has been a key player in helping introduce the JS community to hardware hacking.

Why do you think Makers, people that have traditionally been much closer to the hardware, are going to be interested in a Javascript framework?

The ubiquity of JS has made it a lot easier for people to program on different kinds of JS-enabled devices, such as the Beaglebone Black and Raspberry Pi. Working in a higher-level language such as JS allows devs to spend less time of just trying to get things to work, and more time actually making something useful.

The platforms you support seems to be a mix of UI elements, pre-built hardware, software and boards. How do they interact?

We call it “full-stack robotics,” and we have adopted several different software design patterns to integrate different layers together in a seamless way. Similar to how web developers can switch between different database engines, we allow you connect to different devices, and even switch from one platform to another with a minimum number of code changes. We also support “Test-Driven Robotics” to allow devs to write automated tests before writing code on the actual hardware.

How does Cylon.js ‘support’ something like the Arduino or the Digispark that doesn’t speak Javascript?

Cylon.js also supports many different kinds of communication with devices, such as serial or TCP/UDP. In the case of the Arduino we communicate using the Firmata protocol, and in the case of the Digispark we support a protocol named Littlewire created by the brilliant Jenna Fox that runs on even smaller micro-controllers such as the Digispark.

You seem to run a lot of workshops to promote the framework, tell me how those go? Why do you run them?

We have had an amazing response to the robot hacking workshops that we’ve been running at conferences all over the world.

From people who are already makers, to those who have never had a chance to program any hardware at all, we have seen a really high level of enthusiasm and happiness. We try to incorporate the artistic and creative side as well. For example, at our recent workshops we show people how to make wearable controllers out of Popsicle sticks and conductive foil to drive around Sphero robots.

Where do you see Cylon.js heading?

We are starting to see a very active community growing. At JSConf, we had a group of people that built NodeRockets using Cylon.js, the Raspberry Pi, and Arduino, which they then launched into the sky using compressed air. They had telemetry readings, deployed their parachutes, and everything all using Cylon.js. No surprise that Cylon.js is demonstrating space superiority, of course!

We are adding new hardware support for more devices, some of which are not released, so we cannot talk about them yet—but more on that in the upcoming months. Our company is the “software company that makes hardware companies look good,” so we’re here to help out both as open source contributors, as well as professionals when we’re needed.

With the ability for them to hack hardware in their native language, I think we’re going to be seeing a lot more hardware hacking from the web developers.

Discuss this article with the rest of the community on our Discord server!

Alasdair Allan is a scientist, author, hacker and tinkerer, who is spending a lot of his time thinking about the Internet of Things. In the past he has mesh networked the Moscone Center, caused a U.S. Senate hearing, and contributed to the detection of what was—at the time—the most distant object yet discovered.

View more articles by Alasdair Allan


Ready to dive into the realm of hands-on innovation? This collection serves as your passport to an exhilarating journey of cutting-edge tinkering and technological marvels, encompassing 15 indispensable books tailored for budding creators.