Sending the messages to the Arduino board as integers instead of strings.
lucidcode
Lucid Scribe App lucid dreaming tools Lightened Dream journal for lucid dreamers Halographs dream detection devices Lucid Scribe biofeedback software Lucid Scribe Database open dream research Discord Server research & dev updatesPopular Posts
NeuroSky ThinkGear EEG 0.9.6 (53)
NeuroSky ThinkGear EEG 1.0.9 (35)
Lucid Scribe 1.3.7 (19)
Zeo 0.9.0 (19)
Categories
- Hacking (13)
- Security (3)
- Hardware (12)
- Halograph EEG (1)
- Halograph EOG (8)
- Halograph FM (1)
- Halovision INSPEC (4)
- Research (16)
- Software (279)
- Lightened Dream (28)
- Lucid Scribe (68)
- Lucid Scribe Android (9)
- FILD (4)
- Halovision (2)
- ThinkGear EEG (3)
- Lucid Scribe App (4)
- Lucid Scribe Plugins (173)
- BrainFlow (2)
- Emotiv EPOC (1)
- Halovision (47)
- Hypnodyne ZMax (1)
- InteraXon Muse EEG (6)
- Keyboard (3)
- LightStone IOM (12)
- lucidcode Halograph FM (6)
- Mattel Mindflex (5)
- Microphone (2)
- Milliseconds (3)
- Mouse FIELD (12)
- Muse (2)
- NeuroSky ThinkGear EEG (31)
- OCZ NIA (2)
- OpenBCI (2)
- OpenEEG (14)
- Ping (1)
- Pranayama (6)
- tACS (8)
- TCMP (8)
- tDCS (8)
- TI EZ430 Chronos (3)
- Zeo EEG (13)
- Lucid Scribe Plugouts (7)
- Arduino (1)
- Screen LED (1)
- Yocto PowerRelay (5)
- Hacking (13)
Hi
I am a student and I have a project for the Science of the Engineer section.
In this project i use Arduino for receiving data from the headset Mindwave.
Here is my problem:
I’d like to use the eye blinking signal to control a servo motor but I can not get this data !
I already have a working program, but uses the attention …
Thank you for your help !
Can you access the raw EEG data? If it spikes; it is probably a blink. What code are you using to receive the attention data?
thanx for reply 🙂
no, i cant accces raw EEG data !
i’m using that code :
///////////////////////////////////////////////////////////////
// Arduino Bluetooth Interface with Mindwave
////////////////////////////////////////////////////////////////////////
#include // library for software serial
SoftwareSerial mySerial(5, 6); // RX, TX
int LED = 8; // yellow one
int LED1 = 7; //white one
int BAUDRATE = 57600;
// checksum variables
byte payloadChecksum = 0;
byte CalculatedChecksum;
byte checksum = 0; //data type byte stores an 8-bit unsigned number, from 0 to 255
int payloadLength = 0;
byte payloadData[64] = {0};
byte poorQuality = 0;
byte attention = 0;
byte meditation = 0;
// system variables
long lastReceivedPacket = 0;
boolean bigPacket = false;
boolean brainwave = false;
void setup() {
pinMode(LED, OUTPUT);
pinMode(LED1, OUTPUT);
digitalWrite(LED, HIGH); // hello sequence
delay(100);
digitalWrite(LED, LOW);
delay(100);
Serial.begin(57600); // Bluetooth
delay(500);
mySerial.begin(4800); // software serial
delay(500);
mySerial.print(“Communicating… “);
mySerial.println();
}
byte ReadOneByte() {
int ByteRead;
// Wait until there is data
while(!Serial.available());
//Get the number of bytes (characters) available for reading from the serial port.
//This is data that’s already arrived and stored in the serial receive buffer (which holds 64 bytes)
ByteRead = Serial.read();
return ByteRead; // read incoming serial data
}
unsigned int delta_wave = 0;
unsigned int theta_wave = 0;
unsigned int low_alpha_wave = 0;
unsigned int high_alpha_wave = 0;
unsigned int low_beta_wave = 0;
unsigned int high_beta_wave = 0;
unsigned int low_gamma_wave = 0;
unsigned int mid_gamma_wave = 0;
void read_waves(int i) {
delta_wave = read_3byte_int(i);
i+=3;
theta_wave = read_3byte_int(i);
i+=3;
low_alpha_wave = read_3byte_int(i);
i+=3;
high_alpha_wave = read_3byte_int(i);
i+=3;
low_beta_wave = read_3byte_int(i);
i+=3;
high_beta_wave = read_3byte_int(i);
i+=3;
low_gamma_wave = read_3byte_int(i);
i+=3;
mid_gamma_wave = read_3byte_int(i);
}
int read_3byte_int(int i) {
return ((payloadData[i] << 16) + (payloadData[i+1] < 169) //Payload length can not be greater than 169
return;
payloadChecksum = 0;
for(int i = 0; i < payloadLength; i++) { //loop until payload length is complete
payloadData[i] = ReadOneByte(); //Read payload
payloadChecksum += payloadData[i];
}
checksum = ReadOneByte(); //Read checksum byte from stream
payloadChecksum = 255 – payloadChecksum; //Take one’s compliment of generated checksum
if(checksum == payloadChecksum) {
poorQuality = 200;
attention = 0;
meditation = 0;
}
brainwave = false;
for(int i = 0; i 0 && attention 40){
digitalWrite(LED1, HIGH);
}
else
digitalWrite(LED1, LOW);
}
}
}
Thanks, I am amazed how much you are doing to help out and it is very much appreciated
Still not working but I found out why and not to do with integers. Partly my fault as it has to do with the complementary program (sketch) I have to load into the arduino, i.e. when Lucidscribe sends it info, matching baudrate etc.
In your code if you could use the syntax
arduino->WriteLine(“1”); // send 1 to arduino
arduino->WriteLine(“0”); // send 0 to arduino
instead of arduinoPort.Write, my sketch in arduino will work
There is a good simple example on this website, that I tested and it works
http://webtutsdepot.com/2010/05/01/arduino-visual-c-plus-plus-tutorial/
Sure. And thanks for your help and patience with the testing: ThinkGear EEG 1.1.3 now sends the NewLine character at the end of the message… third time lucky?