Hack the brain – Focus Guard


Together with Thijs Zumbrink, Rik van Duijn , Thomas Bohlken and Mik Langhout I decided to accept the challenge and to develop a Focus Guard! It is an Android application that blocks all the incoming calls and messages on your phone if you are in your high concentration mode, it is like controlling the phone with your brain. For real! Let’s go through the problem and the solution itself so you have better idea what our team, the Guardians of the Focus, did.

The weekend from 5th till 7th of June, 2015 was reserved for the Hack The Brain event hosted at De Waag; a three days long hackathon and public event. The goal was to challenge scientists, developers, and education professionals to explore and find new ways to improve learning processes in the brain. Most of the teams managed to think of innovative applications and have built real prototypes.

Together with Thijs Zumbrink, Rik van Duijn , Thomas Bohlken and Mik Langhout I decided to accept the challenge and to develop a Focus Guard! It is an Android application that blocks all the incoming calls and messages on your phone if you are in your high concentration mode, it is like controlling the phone with your brain. For real! Let’s go through the problem and the solution itself so you have better idea what our team, the Guardians of the Focus, did.

Introduction

In this modern age of technology it is so easy to get distracted. It is really frustrating to study (or work) if there is a new email, message on Facebook or Whatsapp disturbing your concentration flow. I guess this is a well known problem for most of programmers and since the topic of the hackathon was education, we imagined a case of a dedicated student preparing for the final exams. What is better than postponing your income messages while being concentrated? You can measure your brain activity and help yourself improve in the future and at the same time be truly offline!

What did we measure?

Concentration levels that we measured were based on gamma waves, but with additional processing to make it more reflective of the user’s experience. For measuring the waves we used the Muse Headband, a very simple gadget that you place on your head with just two sensors on the forehead that measure a part of your brain activity.

The device itself works quite well and has a great SDK that made our life easier. Also, the event itself had a lot of neuroscientist who were more than happy to help us in understanding the numbers that the device returns.

After some time of testing the device and trying to figure out what works best for increasing concentration levels we found out summing prime numbers, focused reading or playing a game works quite well for us so we took that as a way of invoking concentration. The device itself offers the concentration channel output, values from 0 – 1 where 1 means full concentration. During our experiments we decided everything from 0.5 till 1 is full concentration, lower than that does not count. Probably, with more time available for research and experiment this would need to be refined but it was good enough to create a functional prototype.

Fluctuations of values of concentrated and non concentrated states would happen often, but the period of low concentration would never be longer than 10 seconds so we took that value as a period of concentration break. This means, if the user has a period of low concentration (0 – 0.5) for longer than 10 seconds – we stop and the Focus Guard application takes the user’s smartphone out of the priority mode.

Muse device

How does it work? The Muse SDK offers a Muse IO driver that connects with the Muse via Bluetooth and sends out the Muses data as OSC or LSL messages. It includes raw EEG, accelerometer, spectral components and many more OSC channels. Since it was a hackathon we decided to use something new so we picked up Node.js! Node.js provides a very handy library for reading OSC data (called osc) and by listening to the UDP where the data was streamed we managed to get the numbers. In order to keep the history of the events for future learning processes we implement storing the states and durations in the database as well. Since it was purely a proof of concept, Sqlite3 as a database served us quite well.

More, in order to better present the entire idea, we outputted the real oscillations between concentration and distraction on an Arduino powered LEDs. Green colour lights up when the person is available or, no longer focused; and red light as a “please do not disturb” mode.

But that is not all, since we stored the data, the user could also review history and learn about his concentration levels. What works well and what not, how often a person gets distracted and how to improve learning experience!

What did I learn?

The challenge was amazing! From picking up Node.js, working on an Android application and learning bits of neuroscience, all in a weekend; we are really proud we managed to get a functional real-world application that could help many of us! ..I would personally love to have one of these while working!

The negative part is the maturity of the Muse or similar devices, they often lose connection or the signal is easily interrupted if the user moves his eyebrows for example. But this is a good beginning, I am sure in the future these and similar devices will get better and having an application like ours will be nothing unusual. We are looking forward to that!

For now, you can find the source code for communication with the device, filtering and storing the data on the Gitlab repository. This concludes my report of the HackTheBrain event and I am looking forward to many more events like this in the near future!