Projects:

Philosophy:

Music:

Links:

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. The user wears an 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) this is *way* beyond my electronics know-how. The sensitivities involved are ridiculously slight, and there are ahhh serious safety considerations regarding not putting an electrical current through your brain.

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. At only $100, the price is unbeatable. It's also got an app store which makes it dead simple to get software for it. It's main limitation is it only has one electrode and can only measure the FP1 area of the brain.

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-SMTEEG electrodes and digital conversion
5 ElectrodesFor 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, modified to display differently depending on the level of EEG data being inspected. Here are the original shaders the visualizations are based on:

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

Thanks to:

  • The OpenEEG project for the drivers and inspiration for the Olimex OpenEEG-SMT
  • ShaderToy for the visualizations
  • Peter Bevel, for explaining the Fourier Transform in a way in which I could finally understand it

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, and I looked into how far EEG technology has cheapened and improved. I've had an interest in meditation for many years, and wanted to see if I could somehow design a device which could teach it to others.

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, which works very similarly to Meditation Trainer, measuring 'relaxation' a.k.a. Alpha waves. I'm pleased to say that such apps are about as accurate as what I ended up with.

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.