Feel the power of the force, control your own droid with Littlebits, NeuroSky MindWave and IFTTT. I used the Cloudbit and the Maker IFTTT Channels to connect them together. Used NodeJS and CylonJS to communicate with Neurosky Mindwave. The BB-8 is from http://folduptoys.com/portfolio/bb8-droid/
I used Littlebits because it's easy to snap things together and debug hardware; With the Littlebits Arduino module, it simplifies projects like these. If you're a beginner and just want to hack small projects on a weekend, I truly recommend going Littlebits route. Less frustration. More fun.
If you want to see more projects like these, please click "respect project" button and follow me. Thanks.
Here's the IFTTT recipes (You need to create 2, turn off and on):
https://ifttt.com/recipes/347216-mindwave-to-cloudbit
Here's some instructions how to connect to Mindwave:
http://cylonjs.com/documentation/platforms/neurosky/
Here's the code repository for this project:
https://github.com/rlyle78/ifttt-mindwave-cloudbit
Note: Telling a 5-year old kid to concentrate is not easy as I thought. Attention span is very limited.
Step 1: Print out this papercraft toy. Put it together:
http://folduptoys.com/portfolio/bb8-droid/
Step 2: Assemble the kit. Power connects to Littlebits Cloudbit then connects to a Wire that connects to DC Motor. Now to connect it to the BB-8 toy, I use a lego wheel and connect it to the DC Motor. See pictures.
Step 3. Make sure you setup your cloudbit properly.
http://littlebits.cc/cloudstart#setup
Step 4. Login to IFTTT and connect the littlebits channel and the maker channel. Take note of the API Key.
I published two recipes that you can use to send commands to Cloudbit.
https://ifttt.com/p/rlyle78/shared
Setup 2 recipes.
MindControlTrigger_Off - use this to turn the cloudbit to zero.
MindControlTrigger_On - use this to turn the cloudbit to 100%.
Step 5. Create a NodeJS app that connects to MindWave.
Here's some instructions how to connect to Mindwave Neurosky
http://cylonjs.com/documentation/platforms/neurosky/
I based my code there, I added Barcli to have a bar graph in my command line.
I also found iftttmaker package that connects maker channel to nodejs.
var Cylon = require('cylon');
var Barcli = require("barcli");
var attentionGraph = new Barcli({
label: "attention Graph",
range: [0, 100],
});
var apiKey = '<Your API Key>';
var IFTTTMaker = require('iftttmaker')(apiKey);
var trigger_on = 'MindControlTrigger_On';
var trigger_off = 'MindControlTrigger_Off';
Cylon.robot({
connections: {
neurosky: { adaptor: 'neurosky', port: '/dev/cu.MindWaveMobile-DevA' }
},
devices: {
headset: { driver: 'neurosky' }
},
work: function(my) {
my.headset.on('attention', function(data) {
//Logger.info("attention:" + data);
if (data < 100)
{
attentionGraph.update(data);
if (data > 50)
{
IFTTTMaker.send(trigger_on, function (error) {
if (error) {
console.log('The request could not be sent:', error);
} else {
console.log('Request was sent');
}
});
} else
{
IFTTTMaker.send(trigger_off, function (error) {
if (error) {
console.log('The request could not be sent:', error);
} else {
console.log('Request was sent');
}
});
}
}
});
}
}).start();
Code is simple, if my son concentrates on something and the attention level is above 50%, send to IFTTT and trigger the CloudBit. If it's below 50%, send to IFTTT to turn off the Cloudbit.
Very fun project, my son enjoyed it for 5 minutes then moved on playing with something else. Writing code for this hack is easy, getting my son to concentrate... now that's the challenge. :)
If you enjoy this project and want to see more, please click "respect project" and follow me. Thanks.
Comments
Please log in or sign up to comment.