Project: Meditation Trainer

J. Sante / Jan 2014

What is it?

Meditation Trainer is a build-your-own open source device which teaches basic meditation via biofeedback. EEG headset and tries to calm the visualizations displayed on a TV/Monitor by entering a relaxed mental state.

The 'waves' visualization. The lower and less jumpy the waves appear, the greater calmness of the user's mind

Hardware:

While it's possible to build your own EEG from scratch (see ModularEEG)

As of Januray 2014, OpenBCI was far too expensive for me to consider. However as of May 2016 you can get the necessary parts for only $100 or so more than my eventual choices.

A third option, and one which I would use going forward is the NeuroSky Headset.

I went with a device made in Hungary which is an implementation of the ModularEEG open source EEG project. It can measure two areas on the brain and is fully compatible with the open source drivers and software made for the ModularEEG project, so I'd have full control over what it can measure.

Olimex OpenEEG-SMT EEG electrodes and digital conversion
5 Electrodes For attaching to the scalp. I used 4x Active, 1x Passive
Raspberry Pi B+ For processing and displaying EEG data over HDMI

All the hardware. The EEG-SMT box plugs into the computer via USB

The headband. I used a yoga strap with the electrodes attached by bits of strong wire. There are 4 electrodes which go on the forehead and one passive electrode that goes behind the ear (bottom)

The EEG-SMT box

Cost: $230. The OpenEEG-SMT and electrodes were $220 USD after delivery to California and $10 for the strap.

Software:

The source code is all on GitHub:

MeditationTrainer

The original bits are mainly here

It's written in C and runs on *NIX environments like Ubuntu and Raspbian. I personally used a Raspberry Pi for the portable version and an Ubuntu desktop for development/testing. It should theoretically work on a Mac, but I couldn't get the OpenGL parts to compile.

The software for this project mainly consists of a client for the NeuroServer which is able to display visualizations via OpenGL ES 2.

I wrote the initial calibration screen, but the visualizations are from ShaderToy,

  1. Waves
  2. Fire
  3. Sineoscope
  4. Fiery Tunnel

Thanks to:

How To Use:

First adjust the headband and put it on, making sure all 4 of the front electrodes are making a solid connection with the skin. The 5th electrode should be placed behind the ear.

Start the software. You should see a calibration screen like this:

Calibration screen: the sudden 'valleys' in the red line are eye blinks

If the line moves wildly up and down the whole screen, the behind-the-ear electrode does not have a good connection with the skin.

Press the 'a' key to cycle through the visualizations. The first one is 'waves', at the top of this post. Here are a few others:

A dominant Alpha wave lowers the flames. The longer the state is kept, the less the height of the flames changes. Steady, low flames means that the user has achieved a prolonged relaxed mental state.

The most accurate visualization, as it uses the least processing power to display.

There's also one called 'tunnel' but it doesn't work properly on linux so I couldn't record it as a .gif.

Why work on EEG + Meditation?

This project largely began when my employer DAQRI acquired the EEG startup Melon,

Success?

I'd say this project is about 60% a success. With diligence and a bit of imagination, the product functions as intended. Realistically however the limitations of the technology quickly become apparent -- distractions may cause little effect in the visualations and a for-real meditational mental state can still result in a shaky and inconstant visualization.

Another fail: I'm unable to filter out eye blinks or eye movements, which cause an artificial spike in Delta brain waves.

The EEG is a very blunt instrument, especially when it's done on only a few hundred dollar's budget. It is not medical grade, and certainly doesn't get the specificity of true medical devices which feature 32, 64 or even 256 electrodes across the scalp. The electrical signals in play are too faint to be fully reliable, a much greater point of connection is sadly difficult to reach: the optic nerve. No thanks.

Unless you really want to mess with the software yourself, I'd recommend most people instead purchase a NeuroSky Headset and one of their meditation apps such as Mynd Meditation: Light Evolution,

How's it work?

Essentially the product separates the wearer's EEG signal into different types of brain waves and gets the strength of the Alpha wave relative to the others as a percentage. This percentage then affects the visualization.

How an EEG works:

An EEG works by reading patterns of tiny electrical signals transmitted across the scalp in response to brain activity in various sections of the brain. More specifically, pairs of electrodes (electrically conducting plates connected to the skin) on different parts of the brain are read many times a second and their differences noted, both in intensity and frequency.

These are separated into various 'tranches': Alpha, Beta, Gamma and Delta.



Findings:

  1. Messing around with EEG stuff is super fun
  2. I had to remember lots of long-dormant Math and Computer Science in order to make this happen

Meditation Device V2

This will make use of the wireless Neurosky Headset.