Flying a drone using JavaScript

With a little bit of JavaScript knowledge, you can interact with the world in exciting ways. For instance, in just a few minutes, we were able to fly a small drone using a JavaScript application in our web browser.

The idea behind this project is to use the drone’s Bluetooth connectivity to receive commands from another Bluetooth-enabled device, like a computer or smartphone. In the video above, Sergio Cruz accesses his laptop’s built-in Bluetooth functions to send commands to a drone using a Node.js application he built.

Using Node.js

This project uses some basic Node.js syntax and JavaScript knowledge. We’ve seen similar projects using Ruby, and even Golang, to control robots and IoT devices.

Code School’s Real-time Web with Node.js Course

If you’d like a refresher on the basics of Node.js, we recommend checking out the Code School Node.js course, Real-time Web with Node.js. You’ll learn about concepts like event listening and npm installing, which are both used in this project.

Purchasing a drone

With so many consumer drones available for purchase, how do you decide which one to get so you can make it fly with JavaScript?

Parrot Mambo Drone — Image Source:

Bluetooth: First, make sure the drone you purchase has Bluetooth functionality. We’re using a Parrot Mambo.

Node package: Next, make sure it has an associated dependency available. In our case, there are many packages available for Parrot Minidrones. Although we purchased a Parrot Mambo drone, we used this package to control it. This package was created for the Parrot Rolling Spider, a similar product to our Parrot Mambo that was recently discontinued.

Flying the drone

Once you’ve purchased your drone and found a suitable Node package to control it, you’re ready to start flying!

In the package we chose, the setup instructions look like this:

First, we installed our dependency.

npm install rolling-spider

Next, we created a new rolling-spider instance and set a custom uuid for our drone. This allowed us to connect to the drone and start flying!

var RollingSpider = require(“rolling-spider”);
var rollingSpider = new RollingSpider({
    uuid: 'Mambo_434915'

We then used our package’s syntax recommendations to connect to the drone, set up the available commands, and ping the drone so it stays connected.

rollingSpider.connect(function() {
   rollingSpider.setup(function() {

Finally, we read the documentation for our Node.js package to utilize the drone’s flying functionality. In our video, you can see us taking off, hovering, and landing after just a few seconds. A full list of available commands are in the Rolling Spider documentation.

Adding React and

A preview of our React and application.

The original Node.js application can control the drone using the command line. Building on this concept, Sergio used some React and to create a user interface within the browser.