An Interest In:
Web News this Week
- April 21, 2024
- April 20, 2024
- April 19, 2024
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
Control a Star Wars BB-8 Droid With Arm Gestures and IBM Bluemix Internet of Things
Welcome! In our priortutorial,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 withConsulting IT SpecialistRob Peeren. He created the featured video at the top, showing how he usedan armband and arm gestures to control BB-8 with enough accuracy to play soccer (or concussion-freefootball 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 knowwhich types of IoT topics you'dlike 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:
As always, share your ideas and feedback in thecomments below orreach me directly on Twitter@reifman. You can alsoreach out to Rob Peeren @robobob or via@IBMCloud.
Armband ControllerComponents
Here arethe elements of Peeren's armband demonstration:
- The MyoGesture Control Armband
- The blue Raspberry Piwhichreceives input from the armband and sends it to the Bluemix cloud (not pictured)
- The silverRaspberry Piwhich delivers data from Bluemixto theBB-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 thisone is targeted more at developers:
They offer a variety of solutions for usage, as well as an excellent Developer site.
And of course,here's BB-8 againand how it came to be:
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 ascreenshot 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 interestedin a tour of the Bluemix application UX given byIBM 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 Armbandwhich 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 upyour intentions. Peeren used the following gesturesfor the video:
- Waving in to turn left
- Wavingout to turn right
- Fist to make itstop
- 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
As I mentioned above, the blueRaspberry Pireceives input from the armband and sends it to the Bluemix cloud. It does this by running Python code and MQTT to communicate with 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 portalandits unofficial library page. You might also check out this related video of a Myo armband directing a Raspberry Piwheeled robot (it has a great soundtrack):
Processing the Armband Data Within Bluemix
Within Bluemix, the data is transformable usingthe 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 fromBluemix 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.
Cylon.js is a JavaScript framework for robotics, physical computing, and the Internet of Things. It makes it incredibly easy to command robots and devices.There's also a specific Cylon.js SDK for Sphero's BB-8. See also the Cylon.js driver on GitHub.
Here's some of Peeren's Cylon code connecting from Bluemix via MQTT
to BB8 via cylon-sphero-ble
:
Once the commands are received by the BB-8, its internal systems activate each command creating the droid'smotion and lighting effects.
Key Takeaways
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 theAPIs and connecting in a standard way to Bluemix via the MQTTprotocol. 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 captureand dreamed of recognition. In college, I experimented with pen tablet and howhandwriting recognition might work(demonstrating this late one afternoonto Nathan Myhrvoldhelped 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.
He suggests experimenting with the Bluemix analytics engine to raise the intelligence of the interpretation of gestures or its visual recognition capabilities.
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 forbusiness rules, a reporting rules engine,Hadoop,etc. The possibilities are nearly endless.
What's Next?
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'sable to accomplish his goals by combining the building blocks which Bluemix and third-party providersoffer.
IBM alsooffers a range of training and certification for Bluemix through itsdeveloperWorkssites. Here are some related resources:
- Getting Started with IBM Bluemix online course
- Quick-start apps, code, tutorials and videos
- 200 Bluemix Days
- Bluemix forum
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 orRob Peeren @robobobor 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 kindsfrom me on my Envato Tuts+ instructor page.I hope you'll also check out my two seriesHow to Program With Yii2andBuilding Your Startup With PHPabout buildingMeeting Planner.
If you wish to learn more about IBM Bluemix and Internet of Things, visithttps://ibm.com/bluemix.
Related Links
Original Link:
TutsPlus - Code
Tuts+ is a site aimed at web developers and designers offering tutorials and articles on technologies, skills and techniques to improve how you design and build websites.More About this Source Visit TutsPlus - Code