Archis's Blog

January 9, 2012

BCI Updates

Filed under: Uncategorized — Tags: , , , , — archisgore @ 6:23 am

After having found my blog, a helpful person from Pocket Neurobics (the ones who make the Pendant EEG which I’m using), contacted me and mailed me some C code snippets to read data directly. That was mighty helpful.

I was stuck trying to build my other wine-heater thingy in the meantime, and the job and house move was keeping me busy. Beginning next week, I’ll get back to working on the promised library to read data and allow any apps to process it. My particular interest is in plugging it into sci-lab if I can, so people can have a free signal-processing environment to process PendantEEG data and experiment with it.

That’s all for now, folks! 

April 30, 2011

PendantEEG drivers

Progress on the Brain Computer Interface project. To recap: I picked the Pendant EEG as my device-of-choice. I did not however, purchase the BioEra or BioExplorer packages. Partially because I hate frameworks (more on that later), and mainly because I didn’t want to spend the money. Part of this is just pain ego. I just wanted a raw library from where I could read two-channel data and then pump it into any pipeline I wanted, without an expensive software to do the same thing. (Don’t get me wrong – BioEra is an awesome architecture and especially for home-training sessions, it’s very powerful).

I spend the last three weeks going over options, and couldn’t find the spec (sort of) for capturing raw EEG data. I noticed that, until about 2009, BioEra had an open-source fork called BioEra Light on SourceForge. Turns out this tool claims to read the PendantEEG data. A quick look at their sources and you’ll find the code (best spec), to read this data. It’s a pity this isn’t part of a native library, but now I intend to make it one.

This weekend will be spend in this coding effort. I’m going to try and stick to C as language of choice, since the lib can then be consumed from Java or .Net or whatever (doing the reverse is possible, but breaks my philosophical rant below.) Since such a raw library is asked for many times, it would make sense for me to publish it, but that’s probably going to take a while before I figure out all the agreements and legalities. If it helps, I’ve pointed you to where you can read the code, at a  glance it seems extremely simple, elegant and well-written. If others have followed a better approach, I’m always willing to improve.

EDIT:

I did some more hunting around. Turns out, I was wrong in my assumption. Someone else published some BSD-licenced C++ code on Google Code here: http://code.google.com/p/pyofeedback

For completeness, here’s the link to BioEra: http://sourceforge.net/projects/bioera/

Both projects were last updated in 2009, and I’ve made contact with their owners to get any help I can. I don’t want another fork going around the web for the next person to find. I’m considering contributing to/using one of the above.

Philosophical rant about frameworks: 

Recently, I’ve acquire an absolute and complete hatred of frameworks. Two Three things in particular I want to avoid follow in my weekend projects at least.

1. Code must compile exclusively out of the same directory. If it’s outside of that directory, especially one-level up, it’s got to be a transparent binary that I care nothing about. I come across way too much code which has “frameworks” to help write executables. Command-line parsing logic, some kind of usage-printing-helper, etc. They’re not exactly classes you can reference in a library, but the code files aren’t in the folder you’re reading your logic from. Massive waste of time if you just want to add another param and move on.

2 .Must conform to the platform. NO syntax overloads. I love language-features and libraries. All code I read, I want to give you a spec: .Net 2.0 or .Net 3.5 or whatever, and if you read a code-line, it must correspond to something directly interpretable by and semantically accurate to an anthropomorphic being named .Net 3.5. If a sentence begins with “See this looks just like an event in Java, but internally…” it’s booted ruthlessly.

3. Unix-philosophy of specific tools for a focussed purpose. Like the Terminator, if the purpose vanishes, the tool must question its own reason to exist. I don’t want an ls command that has a data-driven manifest, that tells it to load listing-provider-factories, that instantiate listing-providers, which have their own configurations providing the parameters for their initialization, thereby allowing you to list, not only files and directories, but all the galaxies and stars, and streets in NY or the known prime numbers, using just one command. I’ll put in the effort to learn, as ridiculous as it may sound, a brand new command for the oft-necessary purpose of listing all galaxies when I’m browsing a folder tree.

April 1, 2011

Making a Brain-Computer Interface

After five years of consistently blogging, and consistently failing to do something about it, the BCI-building has begun. The academician in me needed an outlet and I’ve been craving for something hardcore technical for a while now. So begins the first formal attempt at building a cheap home-made BCI. I’m going to label all entries so that it will be easy to follow progress on this.

Unlike my regular posts which are composed with at least some thought, this series of entries will be more like a journal. I’ll post entries with what I do, what methods I follow, everything I try. With any luck, there should be enough detail that anyone could replicate what I am doing with full fidelity. The attempt at any original research is not even a long-term goal. The goal here is to, and I say this as directly as possible, with no misconceptions whatsoever, and no subtext, “to have fun.”

If you have any interesting theories, experiments, I would love to hear your thoughts. If you’d like to participate, you’re welcome to join. Most followups will be brain-dumps of my thoughts – unedited, raw, and naive. A side-effect of this blog is to also demonstrate any points of failure, or stuff that doesn’t work. At this point, I have nothing working. I don’t want to claim that I knew everything, in case I succeed.  I won’t use the excuse that I never wanted to succeed in case I fail. I want to make this work, and even if it doesn’t, it won’t change the fact that I still wanted it to work. If I make a mistake it’s going to be published, since I will try and publish what I intend to do before I do it as a validation.

At the moment, I picked the PocketEEG from PocketNeurobics (apparently an Australian company) to get started. I’ve been out of this world for a while (four years), and it takes a long time to catch up on the IEEE Journal of Biomedical Engineering where most BCI work is (used to be?) published. The WaveRider system is a clinical device but it costs too much for me at the moment, but if this device fails, I’ll save up for the WaveRider and go with it. It’s a two-channel device.

I haven’t got the electrodes yet, so haven’t taken any readings, but plenty of work has to happen before the electrodes become relevant. The recommended software to be used with it is BioExplorer which I think costs too much. I instead tried to connect the open-source BioEra software. The UI takes me back to the good old colleges days before the polished world of  iPhones and iPads. It has a way to define the processing pipeline but I rather hate doing it graphically. The dongle does provide a fake serial port on your PC that you can read from, but I didn’t want to go through that much trouble. I intend to use BioEra to capture the signal and send it across a local TCP channel into a server I’ll write that does what I want it to. BioEra seems to support plugins, but I love the flexibility of having my own executable as opposed to being “hosted in” another exe.

This pipeline investigation should take until the weekend, and hopefully I’ll have it coded over the weekend. If I’m lucky, and the electrodes to arrive, I’ll be sure to post some recordings of motor activity of right and left hands, captured from the C3 and C4 points at the beta band.

The reason I don’t want to use the provided FFT block is because I much rather enjoy playing with parameters initially. Do I want it sliding window at every point or will I perform it on intervals? If I intend to do something like auto-regression, I’d much rather use my own buffers and optimize the pipeline to operate on. I’ll post what happens.

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 130 other followers