BRAIN
The ultimate hack

Armagan Amcalar

GDG DevFest Istanbul 2017

November 26th, 2017

Who am I?

Armagan Amcalar
Head of Software Engineering @ unu GmbH
Founder @ Lonca Works

      dashersw            dashersw

AUTHORED ON GITHUB

what is

the ultimate hack?

dashersw

The Summit 2013 - Picture by Dan Taylor / Heisenberg Media - www.heisenbergmedia.com

I think we are about 8 to 10 years away from this being usable by people with no disability

dashersw

Facebook VP of Engineering Regina Dugan F8 - Picture by Anthony Quintano

dashersw

dashersw

dashersw

dashersw

dashersw

dashersw

A PRIMER: The world's first EEG recording

... in 1924

dashersw

How it looks now

dashersw

Actually...

 

Let me show you.

dashersw

How does this black magic work?

100 billion neurons

Chemical reactions of K & Na exchange produce potential difference > "action potential"

Up to 256 electrodes for non-invasive methods

Thousands of electrodes for invasive operations

 

 

... and we still don't know how it exactly works.

dashersw

P300 — oddball paradigm

First published by E. Donchin and L.A. Farwell in 1988

2.3 letters / min

 

Based on randomly flashing letters in a matrix

Rare positive, common negative flashes pique interest

Action potentials fire 300ms after stimulation

 

dashersw

Separate Black from red

dashersw

Another demo

Berlin Hack & Tell

dashersw

dashersw

brain-bits

Available on GitHub: https://github.com/dashersw/brain-bits

 

Open-source P300 speller...

 

... that still needs some help!

dashersw

Tech stack

JavaScript all the way up

Native C add-ons for the headset

Node.js for processing

Electron as the wrapper

Vue.js for front-end

brain.js for neural networks

Custom BLDA in JS as another classifier

 

...and, MATLAB as the server for eig function.

dashersw

Formatting the data for Machine Learning

  1. Get raw electrode data
  2. Group by each second to get epochs
  3. Filter each epoc between 1-12Hz
  4. Winsorize data
  5. Zero-mean normalization
  6. Decimate by 8
  7. Apply machine learning
    1. Use brain.js for neural networks
    2. Use a custom algorithm for BLDA

dashersw

Let's look at the code.

dashersw

Conclusion

 

JavaScript is powerful enough to read and parse not only JSON APIs,

but also your brain’s API.

thank you!

Let's keep in touch!

Armagan Amcalar

armagan@amcalar.com
   dashersw
   dashersw

Brain: The ultimate hack

By Armağan Amcalar

Brain: The ultimate hack

What is the ultimate hack of our lives? What is the one thing that we strive to learn the most about? What is the thing that will truly unlock our potentials? This talk is a demonstration of an open-source Brain-Computer Interface that is completely developed with JavaScript, from the ground up, using neural networks and signal processing. The speaker hits the stage with a wireless EEG headset, shows how to read signals from the brain in JavaScript using native C++ Node.js modules over USB, and the implementation in Electron, including tweeting with brain signals.

  • 2,458