Project 2: EEG LED Control

This project was based on several projects I found online related to using brainwaves to control various components.

http://www.instructables.com/id/Adding-Bluetooth-to-an-EEG-headset-for-Mind-contro/step5/Pair-with-your-computer/

http://frontiernerds.com/brain-hack

The first part of the project was soldering the bluetooth module into the headset:

20150318_103340

This then allowed the headset to connect to my phone via bluetooth, however for the next step I needed to pair module in the headset with a second bluetooth module on the arduino.

I bought an hc-05 for the second module as this had the six pins required to convert the blueooth module to a master, this meant that it would inquire for other modules and automatically connect to the module in the headset.

This was done by connecting the hc-05 to the arduino and setting it to AT command modeĀ F7U5PAXHKZAVRT7.MEDIUM

After this i needed to convert the signals to a useful input to power an LED i managed this by ignoring inputs under 60 and over 100, this meant that it only used the attention and meditation inputs to contol teh LED

Code:

#include <SoftwareSerial.h>

int toSend = 0;
int Led = 4;
int bluetoothTx = 10;
int bluetoothRx = 11;
int sensorvalue = 0;

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup() {
pinMode(11, OUTPUT);
pinMode(Led, OUTPUT);
Serial.begin(9600);
bluetooth.begin(38400);
delay(100);
bluetooth.begin(9600);
}

void loop() {
if(bluetooth.available()) {
int toSend = (int)bluetooth.read();
Serial.println(toSend);

if ((toSend >=60) && (toSend <= 100)){
digitalWrite(Led,HIGH);

}
else{
digitalWrite(Led,LOW);

}
}
}

Advertisements

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