INTERACTION DESIGN STUDIO
Alis Blog Processing and EEG

PROCESSING AND EEG

CONNECTING MINDWAVE MOBILE TO PROCESSING




The starting point for the development will be to make the connection between Mindwave Mobile and Processing. Let’s quickly go over some definitions to explain the process more clearly.

Processing is an open source programming language and integrated development environment (IDE) built for the electronic arts, new media art, and visual design communities with the purpose of teaching the fundamentals of computer programming in a visual context, and to serve as the foundation for electronic sketchbooks. The project was initiated in 2001 by Casey Reas and Benjamin Fry, both formerly of the Aesthetics and Computation Group at the MIT Media Lab. One of the stated aims of Processing is to act as a tool to get non-programmers started with programming, through the instant gratification of visual feedback. The language builds on the Java language but uses a simplified syntax and graphics programming model.

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language. Here is a JSON code in its simplest form.

{"string": "value", "string": "value"}

 

ThinkGear Connector (TGC) is an executable that continuously runs in the background and manages communications with ThinkGear devices, such as the MindSet, that is connected to the computer. TGC runs and keeps an open socket on the local user’s computer, allowing applications to connect to it and receive information from the connected ThinkGear devices.

I like Processing for several reasons; it is lightweight, simple and there is a huge library of well-documented examples and tutorials that are created by the community. So in order to start, first you need to download and install the application from Processing.org. After the installation is complete, I recommend looking at the  section if you are new to the environment. Also watching the documentary Hello World! Processing is a good idea to see the capabilities of the platform.

When you start the application, the first thing you are going to see is an empty sketch where all the magic will going to happen. To get an idea of the language, you can browse to (File –>Examples) where prewritten sketches from basic level to complex codes are contained. As a note, when the installation is complete, the program creates a Processing folder under (User–>Documents) where the sketches and libraries are contained unless defined otherwise.

Now, let’s go back to Mindwave. In order to make the connection between Processing and Mindwave, TGC should be running in the background and the device should be paired by Bluetooth. The NeuroSky MindWave device does not come with a Java implementation. That is why we need to use the library that was written by Andreas Borg to communicate with the ThinkGear connector over Java sockets which can be downloaded from here.

The downloaded files should be placed under Libraries folder and Processing needs to be restarted for the libraries to be effective. After these, we are ready to start on our first sketch.