Controlling the Parrot AR Drone with the Myo armband in Node.js


Following the last tutorial I wrote on how to control the Sphero with the Myo armband, here is another one on how to control the Parrot AR Drone with the Myo using Node.js.

If you want to follow along, you can find the repo on my github.

To begin with, we need to setup the server configuration. After requiring the necessary modules, here is what we need to write:

var env = process.env.NODE_ENV || 'development';
if('development' == env){
  app.set('port', process.env.PORT || 3000);
  app.use(express.static(__dirname + '/public'));
  app.use("/node_modules", express.static(path.join(__dirname, 'node_modules')))

server = require('http').createServer(app);

var bayeux = new faye.NodeAdapter({
    mount: '/faye',
    timeout: 50


  client = new faye.Client("http://localhost:" + (app.get("port")) + "/faye", {});

  client.subscribe("/drone/move", function (d) {
    console.log("drone move?")
    return drone[d.action](d.speed);

  client.subscribe("/drone/drone", function (d) {
    console.log("drone stuff")
      return drone[d.action]();

  server.listen(app.get('port'), function () {
    console.log("Express server listening on port " + app.get("port"));

We use express to set up the server and Faye & Bayeux for the communications between the Drone and your app.

We also use the module ‘dronestream’ to be able to stream video from the drone to the browser that is listening on port 3001.

The rest of the code deals with the commands sent from the Myo to the drone. First of all, we need to create an instance of the Myo and then define some commands.

myo = Myo.create();


myo.on('fingers_spread', function(){

myo.on('wave_in', function(){

var takeoff = function () {
    flying = true;
    return faye.publish("/drone/drone", {
      action: 'takeoff'

var goLeft = function(){
    stopped = false;
    setTimeout(function (){
      return faye.publish("/drone/move", {
        action: 'left'
        // speed: adjustXspeed
    }, timeout);

Once the instance of the Myo is created, it can detect certain types of movements and run functions accordingly.

The ‘myo.unlock()’ command should allow the Myo to be unlocked while you use the app. However, I noticed I still needed to execute the unlock gesture ‘double tap’ between each command… Then the ‘faye.publish’ allows to send the commands and make the drone move. You can adjust the action and speed as you like.

This is just a snippet so once again, if you wanna have a look at the rest of the code or if you want to play around with it, everything is available on my Github 🙂

Hope it helps and enjoy!