Welcome! In our prior tutorial, Control a Droid With Your Mind and IBM Bluemix Internet of Things, we covered Joshua Carr’s use of the Emotiv Insight headset to control a Star Wars BB-8 droid with his thoughts. If you don’t believe me, check it out or watch the video below.
It’s made possible with some amazing consumer hardware and IBM Bluemix integration with the Internet of Things.
In today’s tutorial, I’ll guide you through my interview with Consulting IT Specialist Rob Peeren. He created the featured video at the top, showing how he used an armband and arm gestures to control BB-8 with enough accuracy to play soccer (or concussion-free football as some call it).
We’re also likely to continue this series on IBM Bluemix and the Internet of Things (IoT) with specific step-by-step tutorials about how to try out more of your own projects. Please let us know which types of IoT topics you’d like to see more written about in the future.
If you’d like a broader overview of IBM Bluemix, I encourage you to watch David Barnes’s introduction below:
Armband Controller Components
Here are the elements of Peeren’s armband demonstration:
- The Myo Gesture Control Armband
- The blue Raspberry Pi which receives input from the armband and sends it to the Bluemix cloud (not pictured)
- The silver Raspberry Pi which delivers data from Bluemix to the BB-8 via Bluetooth Low Energy
- The Sphero Star Wars BB-8 Droid
- Golf ball and Darth Vader not shown (probably hanging out in their star trailer)
You can buy the Myo armband in black or white for $199 USD:
Here are a couple of introductory videos of the Myo Armband which are fun to watch, especially if you haven’t seen it before.
Here’s the general product introduction:
And this one is targeted more at developers:
They offer a variety of solutions for usage, as well as an excellent Developer site.
Building the Application
Now, let’s dive in to how Peeren built the demonstration using IBM Bluemix Internet of Things. In today’s episode, I’ll be giving a general overview from my interview with Peeren. It’s possible we’ll do a step by step together in the near future—let us know us in the comments below if you’d be interested in this!
Here’s a screenshot showing how Bluemix works with devices and the IoT:
Here is a high-level architectural image of what’s happening between Bluemix and each of the Raspberry Pis in Peeren’s video (learn more about MQTT here):
Setting Up a Bluemix Application
Since I’m not stepping you through the application setup, you may be interested in a tour of the Bluemix application UX given by IBM Design Lead, Tarun Gangwani:
Basically, you can create an application from any of the Bluemix boilerplates, including the Internet of Things Platform Starter.
Here is Peeren’s Internet of Things Dashboard, which includes the SDK for NodeJS and the Internet of Things Platform which he uses to receive data from the Myo armband and send it to the BB-8:
Calibrating the Armband to Your Movements
Peeren recommends that you practice with the Myo armband after calibrating it. Here’s a video from Creating a custom calibration of your Myo Armband which shows how this works (see also What can the Myo armband actually do):
Basically, you calibrate it with a few simple gestures and then practice your movements so that it can pick up your intentions. Peeren used the following gestures for the video:
- Waving in to turn left
- Waving out to turn right
- Fist to make it stop
- Spreading fingers to make it go
- Raising your arm to spin 180 (Tony Hawk would be proud and then say, “Do it in mid-air Droid!”)
Just as it took Carr hours to train the Emotiv Insight, Peeren says it takes practice to work with the Myo. Control systems aren’t completely automatic yet—you can’t just put on the helmet and accurately fly the helicopter (sorry to bum out you action movie writers.)
Sending Armband Telemetry to Bluemix
Essentially, the Myo Armband sends telemetry via Bluetooth to the Bluetooth adapter on the Raspberry Pi. Then, the Python code takes the telemetry and sends it to Bluemix in the cloud. All the data comes in as a JSON payload.
Here’s a screenshot of Peeren’s Python code:
If you want to delve deeper in this area, I recommend checking out the Thalmic Labs Developer portal and its unofficial library page. You might also check out this related video of a Myo armband directing a Raspberry Pi wheeled robot (it has a great soundtrack):
Processing the Armband Data Within Bluemix
Within Bluemix, the data is transformable using the Node-RED visual editor. We need to convert the incoming Myo gestures into commands the BB-8 understands in its driver/language.
For example, armband up is translated to BB-8: start and stop. Here’s a screenshot from Peeren’s Node-RED translation flow:
Delivering Commands to BB-8
To get commands from Bluemix to the robot, they are sent from Bluemix via the Internet to NodeJS and the Cylon.js SDK on the silver Raspberry Pi. The silver Pi sends commands via Bluetooth to the BB-8 droid.
Here’s some of Peeren’s Cylon code connecting from
Bluemix via MQTT to BB8 via
Once the commands are received by the BB-8, its internal systems activate each command creating the droid’s motion and lighting effects.
I asked Peeren what was hardest about this effort, and he replied, “It was actually fairly straightforward.” He said he’s just connecting a bunch of APIs.
“I didn’t build anything here. I didn’t write any device drivers or lower level code. I’m using the APIs and connecting in a standard way to Bluemix via the MQTT protocol. I didn’t have to invent anything to make it work.”
Peeren wants to inspire us to think about using Bluemix in bigger ways. Certainly, I’m inspired by everything Bluemix can do with the Emotiv Insight headset, the Myo Armband and Raspberry Pi hardware. It’s incredible how far the industry has come.
As a teenager, I experimented with voice signal capture and dreamed of recognition. In college, I experimented with pen tablet and how handwriting recognition might work (demonstrating this late one afternoon to Nathan Myhrvold helped me land my first job at Microsoft.) But now most of this is possible with Bluemix and the Internet of Things.
Peeren says, “The basic plumbing is very simple.” And Bluemix offers over 120 enterprise-ready services; “It’s not just about armbands and robots.” Or microphones and voice recognition—it’s much more.
When you build your own application in Bluemix, you have everything in one place. You don’t have to go to different platforms. One place for business rules, a reporting rules engine, Hadoop, etc. The possibilities are nearly endless.
I hope you’ve enjoyed both our IBM Bluemix Internet of Things video demonstrations and tutorials. Perhaps you’ll feel inspired to try building your own demonstration.
Peeren mentioned to me that the best part about Bluemix IoT is that nothing is ever very complicated. He’s able to accomplish his goals by combining the building blocks which Bluemix and third-party providers offer.
IBM also offers a range of training and certification for Bluemix through its developerWorks sites. Here are some related resources:
If you’d like to see more on Bluemix and IoT, please let us know—post in the comments or reach us on Twitter @reifman or Rob Peeren @robobob or via @IBMCloud. If you build a cool IoT device application, let us know and perhaps we’ll write a feature about yours!
You can look for future tutorials of all kinds from me on my Envato Tuts+ instructor page. I hope you’ll also check out my two series How to Program With Yii2 and Building Your Startup With PHP about building Meeting Planner.
If you wish to learn more about IBM Bluemix and Internet of Things, visit http://ibm.com/bluemix.