The 'easiest' way to control an Arduino output by EEG (from Ganglion) -- would be to use a laptop as an intermediary. The laptop will receive the Ganglion EEG data stream. Then do some signal processing, of your choice. For example looking at some band powers such as alpha or beta.
Then to output to the Arduino (for example to control an LED or motor, etc.), the laptop program will send 'commands' to the Arduino, over the serial COM port.
Can you give any source code for arduino that shows or collect data from ganglion board and turns on/off led?As i am new with ganglion board,everything seems fishy.It will be very helpful if you provide exact source or any tutorial.Thanks for your response.
@Billh, yes thanks. That is one way to get BLE on an Arduino. Another would be the BLE112 (serial port interface) that is the basis for the BLED112 (usb serial port interface). Since timing constrains and BLE packet loss have proven daunting on many platforms (Android, Linux, etc.) using built in BLE hardware -- the buffered approach of the BLEx112 has definite advantages.
But realistically, building a BLE and Ganglion protocol driver for Arduino would be a lot of (quite technical) programming work. Not to mention the signal processing on the Arduino. Which is why the laptop approach has the most history of user projects.
I have already go through previous links and also connected arduino using network widget but after that how do i control the led?Now i am stuck in arduino coding part.
See some of these links. The OpenBCI_GUI / Focus Widget can output a serial stream with indication of 'Focus'. Your Arduino program will read that serial stream and use the received serial data to control whether LED is on or off.
The first link also shows some sample Arduino code.
I have not tried this myself. You'll have to fiddle around with some of this to get it to work. Be sure the baud rates match on the Arduino and the COM port setup in the networking widget. You might have a serial port monitor running on a COM port to check to see that the proper ascii strings are being output to the serial port / Arduino.
You can also adjust some of the thresholds in the Focus widget, if for example, you wanted it to detect Alpha ('meditation'), instead of 'Focus'.
I would take a look at the two Processing files: W_Focus.pde and W_networking.pde.
Working together they send out the 'state' that reflects the analysis of the EEG (based on alpha and beta band powers), to determine if you are 'focused' or not. I believe the end result is sent to the serial port (in ascii) as either a '1' or '0', one value per line.
The Ganglion is sampling at 200 hz. I have not examined the Focus / networking widget code in detail, but it would make sense that those calculations would occur on a down-sampled basis. Such as only 5 or 10 values sent to the serial port per second. But I'm not sure, you should check the code. And if you want or need to, you could implement the downsampling idea.
Channels are not giving right data,how to reduce those data,even i concentrate channels show more then 100 uVrms.I have go through pde files mentioned above.How to edit those .pde file and load to ganglion board?
Did you get your EEG channels to behave properly? Earlier you said you were getting 100 uV signals. If you have noise, suspect your electrode's connection to scalp. Did you check impedance?
Hi, Everything running well ,now i can focus,but i am stuck at the last part with ardunio,i use the same code given in w_focus folder as instructed but the led remains off.
I made some suggestions regarding terminal emulators so you can check what is being sent out through the serial port. Did you try that? Alternately you can modify the source code of the W_Focus widget to print debug statements on the console log, showing what values are being sent out the serial port. Does that make sense?
Are you sure you have a good serial port connection, matching baud rates, etc.?
Have you tried connecting a terminal emulator to the arduino com port and sending test values to see the reaction of the led? Etc.
Keep trying logical steps to inspect and debug what is going on.
Yes,all done, when its focused the gui sending true,and when not focused sends false but arduino does not respond on this,i also separately use arduino serial terminal to pass value.
So your next step would then be to connect a terminal emulator to the arduino and send alternate true and false. If the led does not change, then you have a bug in your Arduino code.
There is nothing wrong with OpenBCI or the Focus widget.
Have you tried the simplest possible Arduino program, that is, to alternately blink the LED on and off? Not using any serial input.
OK, if the Focus widget is working, and you see the serial output. And the Arduino works, by sending human serial commands. Then there must be something odd with your serial port connection. Are you sure you have the TX RX connected to RX TX, that kind of thing? Matching baud rates? Can you make your Arduino supply some debug info, such as blink another LED when each value is received, regardless of true / false. Etc.
If you have confirmed that the Widget is sending serial correctly, and the Arduino is receiving serial correctly --- then there are not too many other things that can be the culprit. Just keep trying different debug strategies. You must have some issue with your COM port. Likely the baud rates are not matching.
If you had the terminal emulator able to turn the LED on or off, that means it is likely ok. For a serial port to work, transmit TX, must be connected to receive RX on the other side. And vice versa.
I'm running out of suggestions. You say you had another laptop with a terminal emulator, connected to the output port that the Widget was using: and you saw the 0's go to 1's, when you were in the focus state? Conversely when your focus was lost, the 1's turned back to zeros? That means everything is fine with the (1) the serial port, (2) the Focus widget, (3) your eeg connections.
The problem must be with your Arduino. Are you sure you are manually able to turn the LED on or off by human-typing 1's or 0's into the Arduino port? That means your Arduino program is doing what you programmed it to do. I don't understand why it is not responding to the 1's and 0's from the Widget.
Another area you could check, with everything connected, is the Device Manager, COM port Properties. You should see the right baud rate in there, 1 stop bit, etc.
Thanks a lot for your response,do you refer anyone with the arduino part?Do i have connet RX TX with ganglion board or something else?or any project related to this
Comments
I just want to on-off a speaker using ganglion board through ardunio.What i have to do to establish connection between these two.
Thank You
If you are willing to do the driver interfacing, here is an example of a BLE dongle for Arduino, without software:
Everything running well ,now i can focus,but i am stuck at the last part with ardunio,i use the same code given in w_focus folder as instructed but the led remains off.
Thanks