HEXABRAIN BUG

20130216_182207w

Today, as the documentor, I join an unexpected team for the hackathon as TEAM Hexabrain Bug.  I was asked to join a Hexbug/toy hacking team by Aisen with a simple, “Do you want to join?”.  I asked some simple questions and immediately got interested.  The team is now composed of me John, Shawn, Aisen and Daniel.  We had a blast learning how to solder the arduino and hooking it up with the MindFlex brain sensor.  Like I said before, it was an interesting and revealing experience to think for new paradigms and finding new ways to getting things done.  We are currently working on the prototyping stage where we can get the data we want from the sensors and also implementing code to direct the loop logic to issue command to our Hexbug.

The Hexbug is a small spider-like robot that receives remote control commands to move in sideway directions and to make turns clockwise and anti-clockwise on IR command.  We hope to make an interesting and entertaining hack to transfer mind to robot instruction to make the Hexbot dance for us.  We really enjoyed our experience learning and hacking at the Hack-A-Brain Dev Jam 2013.

-John Yung
IMG_20130216_183755

PARTS:

1  MindFlex

1  HexaBug

4  NPN transistors from RadioShack (or anywhere really)

1  Arduino

1  Battery holder & connector for the Arduino

1 9 V battery

Cable

Tape

Soldering Gear & General tools

 

 

STEPS:

1) Hack the MindFlex’s transmitter and ground pin like instructed here http://frontiernerds.com/brain-hack

{ This is an easy step of soldering two wires}

2) Connect the GRD wire to GRD Arduino board.

{ We will connect the T wire later}

3) Upload the trial code, after installing the Brain Library on your Arduino IDE.

{ You can find directions on Frontier nerds}

4) Connect the Transmitter pin to the RX port on the Arduino board.

{Now you probably have a signal}

5) Open the Hexabug controller and take off the button caps.

6) Connect a transistor toevery button.

{This will allow us to control it through logic, and not manually}

Like this:

20130216_184655w20130216_184742w

7) Connect the Base of each transistor to its own digital pin.

8) Program the bug to move back and forth  and around depending on your concentration and meditation levels if they are low, but if you are really concentrating if will completely stop moving!

20130216_182154w

Here is the code we used:

// Arduino Brain Library- Eric Mika, 2010
//HEXABRAIN BUG
//Shawn Lauriat & Aisen Caro Chacin
// Supported by John, Daniel, & Brain Interface Lab

#include <Brain.h>

// Pins
const int upPin = 2;
const int downPin = 3;
const int leftPin = 4;
const int rightPin = 5;

// Set up the brain parser, pass it the hardware serial object you want to listen on.
Brain brain(Serial);

void setup() {
// Start the hardware serial.
Serial.begin(9600);
// declare the A0 as an OUTPUT:
pinMode(upPin, OUTPUT);
pinMode(downPin, OUTPUT);
pinMode(leftPin, OUTPUT);
pinMode(rightPin, OUTPUT);
}

void loop() {
// Expect packets about once per second.
// 200,0,0,198895,662927,70451,19499,18932,274169,123681,154576
// The .readCSV() function returns a string (well, char*) listing the most recent brain data, in the following format:
// “signal strength, attention, meditation, delta, theta, low alpha, high alpha, low beta, high beta, low gamma, high gamma”
if (brain.update()) {
// Debugging
Serial.println(brain.readErrors());
Serial.println(brain.readCSV());
// Get the things.
byte attention = brain.readAttention();
byte meditation = brain.readMeditation();
control(attention, meditation);
}
}

void control(byte attention, byte meditation) {
int upValue = 0;
int downValue = 0;
int leftValue = 0;
int rightValue = 0;

if (attention < 25) {
upValue = 1023;
} else if (attention < 50) {
// Full steam ahead!
downValue = 1023;
}

// Turning
if (meditation < 25) {
leftValue = 1023;
} else if (meditation < 50) {
rightValue = 1023;
}

analogWrite(upPin, upValue);
analogWrite(downPin, downValue);
analogWrite(leftPin, leftValue);
analogWrite(rightPin, rightValue);
}

9) Once you have all of the code ready with your preferred threshold settings, tape stuff up! Semi permanence is important to present!

IMG_20130216_194821

IMG_20130216_192130

10) Now! Concentrate and tell your brain bug to Stop!!

🙂

 

 

Advertisements

One response to “HEXABRAIN BUG

  1. Pingback: Hack-A-Brain Recap | Brain Interface Lab·

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s