Controlling the Sphero with the Myo armband in Node.js


I received my Myo armband a few months ago and I have been working on a few projects to control my other devices with it. To start with, I thought I would explain how I managed to control the Sphero ball using the movements of my arms and Node.js.

To follow along, you can view all the code on my github repo.

The setup of the server side is pretty straight-forward, here’s what is in my app.js file:

var express = require('express'),
    path = require('path');

var app = express();

var lab = require('./my_modules/myo_sphero');

// app.use(express.static(path.join(__dirname, 'views')));

//.all('*', function(req, res){
// res.sendfile('views/index.html');

console.log("Server running on port 3001");

As you can see, you start by requiring ‘express’ and ‘path’ to be able to start your server and serve your different files.

You then require the module you created and you call it so it can be executed when you start your app.

The commented part of the code gives you the ability to serve something in your browser as well by calling the files in your ‘views’ folder but I am not using it at the moment as I just make the connection between the Myo and the Sphero without building anything in the front-end. The first part calls all the files in your folder whereas the second part allows you to serve a single file.

Finally, the app uses the port 3001 that you can check in your browser by visiting http://localhost:3001.

Then, you can write your commands in your module; here’s a snippet of my index.js:

module.exports = function() {

  var spheron = require('spheron');
  var myo = require('myo');

  myo = Myo.create();

  // Set this to the device Sphero connects as on your computer.
  var device = '/dev/tty.Sphero-RBR-AMP-SPP';

  var safeMode = true;

  var controlSphero = function(sphero) {
    myo.on('wave_out', function(){
      sphero.heading = 90;
      sphero.roll(70, 90, 1);

Wrap your code into a ‘module.exports’ function to access it from other files.

Then, require the modules you need, create an instance of the Myo and find the reference of the Sphero on your computer by entering ‘ls /dev/tty.Sphero*’ in your command line once your Sphero and your bluetooth connection are on.

The controlSphero function checks if you are doing the ‘wave out’ movement with the Myo and if so, makes the Sphero roll to the right.

The myo.setLockingPolicy() command stops your Myo from being locked after a few seconds so you can keep on making movements and tracking them.

Myo updated their firmware and API recently and introduced an automatic locking of the armband to avoid accidental tracking of gesture but for this app, we need it to be turned off. You can usually pass in the value ‘none’ or ‘standard’ but I made it default to none. If you want to change this, you can find the myo.js file inside the myo module and find the function ‘setLockingPolicy’. You can learn more about this command on the API reference.

With the update of the firmware, new gestures have been added such as ‘index to thumb’ or ‘click’ and the ‘thumb to pinky’ has been removed so there is a little bit more you can play with.

Once again, if you’re interested, you can find the full code on my github.

Let me know if you have any question 🙂 Good luck!

Control the Parrot ARDrone with the Leap Motion in Cylon.js


Following my tutorial on controlling the Sphero using the Leap Motion, I thought I would keep on converting my Node.js projects to Cylon.js and work on controlling the Drone with the Leap Motion.

If you’ve had a look at my last tutorial, you probably noticed that using Cylon.js makes it really easy to program for hardware and connect multiple devices together.

Below is the usual setup of any Cylon project:

var Cylon = require('cylon');

    leapmotion: {adaptor: 'leapmotion'},
    ardrone: {adaptor: 'ardrone', port: ''}

  devices: {
    leapmotion: {driver: 'leapmotion', connection: 'leapmotion'},
    drone: {driver: 'ardrone', connection: 'ardrone'}

As you can see, you simply need to specify which devices you are using, the more interesting bit comes in the rest of the code…

work: function(my){
   my.leapmotion.on('hand', function(hand){
     after((5).seconds(), function(){;

This code only makes the Drone take off when the Leap Motion senses a hand over it and land after 5 seconds (just in case it decides to go crazy…).

Then, if you want to make it do more interesting things, you will have to play around with what the Leap Motion has to offer; different types of gestures, distance, hands, fingers, etc… The Drone actions themselves are pretty straightforward:

  • my.drone.up();
  • my.drone.down();
  • my.drone.forward();
  • my.drone.back();
  • my.drone.left();
  • my.drone.right();

You can also make the drone rotate clockwise or counterclockwise but what I found the most awesome thing is that the cylon-ardrone module makes the ‘flip’ movement really easy to execute. On a ‘keyTap’ for example, your drone could do a backflip!!

The code for that would look like this:

 work: function(my){
   my.leapmotion.on('gesture', function(gesture){
       if(gesture.type === 'keyTap'){
         after((6).seconds(), function(){
     } else {

If you wanna see the difference with Node.js, you can find my original Github repo here, otherwise here is the repo with more commands!

If you have any question, don’t hesitate!

Controlling the Sphero using the Leap Motion in Cylon.js


In my personal time, I love to play around with hardware and robots.

I started in Node.js but recently I discovered Cylon.js and after a quick play around with it, I found it pretty awesome and decided to rewrite my projects using this framework.

As a starting point, I decided to rewrite the project to control the Sphero with the Leap Motion.

You can find the original repo here, but here are a few code snippets:

Screen Shot 2015-01-10 at 3.02.47 pm

Screen Shot 2015-01-10 at 3.04.09 pm

The way it works is pretty straight forward. The Sphero connects via bluetooth and the Leap Motion needs to be plugged in your computer. Once the Sphero is detected, the hand is tracked by the Leap Motion and the direction will be applied to the Sphero.

Feel free to have a better look at the code on Github.

Now, let’s move on to Cylon.js. The first thing I noticed about this framework is the short amount of code necessary to get to the same result. I managed to do pretty much the exact same thing in 68 lines of code!

I guess what makes it easier is that Cylon already has some modules you can install to program for certain devices, like the ones below:


To start using Cylon, you need to require it and specify which devices you are working with.

var Cylon = require('cylon');

  connections: {
    leapmotion: {adaptor: 'leapmotion'},
    sphero: {adaptor: 'sphero', port: '/dev/rfcomm0'}

  devices: {
    leapmotion: {driver: 'leapmotion', connection: 'leapmotion'},
    sphero: {driver: 'sphero', connection: 'sphero'}

  work: function(f){

At the moment, this code is not really doing anything but you can see how to specify which devices you are going to use.

You have to specify a port for the Sphero because it connects to your computer via Bluetooth. To find the port for your own Sphero, run ‘ls /dev/tty.Sphero*’ in your console and replace the port in this code with the result you get.

The rest of the code goes inside the ‘work’ function as below:

work: function(my){
  my.leapmotion.on('frame', function(frame){
   if(frame.valid && frame.gestures.length > 0{


The code above makes the Sphero go forward if the Leap Motion detects any kind of gesture.

For the full code, have a look at my github repo.

I’ll probably write another tutorial soon once I have a chance to rewrite another project but in the meantime let me know if you have any question!

A wearable capable of detecting epileptic seizures before they happen.


Scientific innovations won’t stop amazing me… Once again a new device has outreached what I thought was possible.

Embrace, a new smartwatch, can also detect if you’re about to have an epileptic seizure and alert your family and friends.

On top of the usual activity tracking, this elegant smartwatch could save the life of people with epilepsy by vibrating with increasing strength when it detects stress levels rising. People can then calm down to prevent an attack.


It can track arousal, stress, sleep and physical activity thanks to its accelerometer, temperature and electrodermal sensors.

If you want to know more, watch the video below:


In pre-order until December 23, for one Embrace bought, one will be offered to a child who can’t afford it (as if you needed another reason to support the campaign!). Visit to see the Indiegogo campaign or to see the product website!

onecue: A Single Device to Control Your Connected Home


Developed by the leader in machine vision and gesture recognition eyeSight, the onecue is a new device that enables you to control your smart devices by simple gesture.

Placed on a desk or on top of your TV, the onecue uses its built-in camera to track your movement and recognise predefined gestures linked to specific actions. For example, you can mute your TV show simply by executing a “shush” gesture.

Besides controlling your TV, onecue also allows you to control the temperature and lights in your home by connecting to the Nest and Phillips Hue lightbulbs. In the future, it should also be able to connect to the Xbox and other devices.


If you’re not satisfied with the predefined gestures, you can personalise them via the Android or iOS app.

Your digital devices being usually controlled differently, the onecue acts like a hub able to connect everything together to give you the power to manage them all with the same gestures.

To have a better idea, watch the video below:

Now selling in pre-order for $129 instead of $199, the onecue seems to be worth a shot if you own a few different smart devices. Visit their website if you’re interested!