Controlling a .NET Gadgeteer Device with your mind...
- Posted: Apr 27, 2012 at 6:00 AM
- 7,682 Views
You all know my love-love relationship with mind control... well... I mean mind reading... um... (you know!) devices like the Emotive device. Well when I saw this project, one the melds a less expensive device with C# and and Fez .NET Gadgeteer device? Well I almost wet my pants (TMI?)
Come on, how you can you not get excited about the possibilities in something like this?
This experiment leaves much to the imagination, but it does demonstrate how wave forms of the human brain can determine events on a device with an embedded microcontroller. This code scenario is submitted for use in the Open Health and Fitness Data Aggregator project headed by Ira Laefsky. The Neurosky Mind Wave sensor is an economical electroencephalograph designed for extensibility with other applications. For less than $100 the device includes the Think Gear Connector, which runs on the Windows or Mac operating systems and supports an API. With two lines of code you can initialize the Think Gear Connector to access the output of the Neurosky electroencephalograph (C# requires the interop thinkgear.dll in the folder with the executable).
connectId = ThinkGear.TG_GetNewConnectionId();
succeeded = ThinkGear.TG_Connect(0,
"Any key to continue... ."
The connector sorts the data into the following wave-form categories - from the developer’s guide:
eSense: A container for the eSense™ attributes, which are integer values between 0 and 100. Zero is perceived as a lack of that attribute and 100 is an excess of that attribute.
- attention. The eSense Attention value.
- meditation. The eSense Meditation value.
eegPower: A container for the EEG powers. These may be either integer or foating-point values.
- delta. The “delta” band of EEG.
- theta. The “theta” band of EEG.
- lowAlpha. The “low alpha” band of EEG.
- highAlpha. The “high alpha” band of EEG.
- lowBeta. The “low beta” band of EEG.
- highBeta. The “high beta” band of EEG.
- lowGamma. The “low gamma” band of EEG.
- highGamma. The “high gamma” band of EEG.
rawEeg: The raw data reading off the forehead sensor. This may be either an integer or a foating-point value.
blinkStrength: The strength of a detected blink. This is an integer in the range of 0-255.
Control the .NET Gadgeteer Device with Brain Waves
The sorted wave-form data from the Mind Gear Connector could be sent to a .NET Gadgeteer device in several ways. This example sends data as an http request to a Web service running on a .NET Gadgeteer device. A WiFi connection enables the connection by using the WiFi RS21 Module available from GHI Electronics.
The following illustration shows the WiFi RS21 module, the GHI Electronics FEZ Spider mainboard, and four Smart Multicolor LED Modules connected by the daisy-link method, as described in the .NET Gadgeteer Module Builder’s Guide version 1.8.
The user wearing the Neurosky EEG sensor starts sending data. The command window prompts the user and waits for connection to the Mind Gear Connector to initialize. When it continues, it will read packets of data from the connection according to the defined wave-forms. When various wave-forms reach an arbitrary value, the wave-form are assigned an integer value that is sent to the .NET Gadgeteer device . Sending all of the data is unnecessary for this experiment, so the threshold is set high enough to limit the amount of data sent to the Web service. Probably the middle range of each wave-form values could be disregarded and the low and high ranges sent.
There's a great deal more information in the post, so please click through for all the details...