An Arduino-based Brain-Computer Interface

An Arduino-based Brain-Computer Interface

Open-sourcing the World of Neuroscience

Whenever you think a thought—and even when you don’t—the more than one hundred billion neurons making up your brain fire through and across an interconnected web of terminals in an elegant electronic interplay. And at just that moment when the sum of input signals into one neuron crosses a certain threshold, that neuron responds by sending an “action potential”—an electrical signal—into the axon hillock (the conductive interface that links adjacent neurons), propagating this potential along to the next neuron, and so on through the network, generating your thoughts, invoking memories, producing speech, the movement of a limb. It’s one of nature’s truly great wonders.

Like the electronic circuits that they are, neurons work through a recurrent series of on and off signals that can be observed, measured—and tapped—to do work, even beyond our bodies. But also, like the insulation on electrical wire, the brain’s neural signal paths are sheathed by a fatty substance called myelin. While myelin helps to increase the speed of electrical communications between neurons, it also acts as an insulator. Fortunately, it’s not a perfect insulator; some of the electric energy escapes. And it’s just those leaky electrical signals that an electroencephalograph (EEG) is able to pick up. But there’s another rub: getting at those faint signals is a real challenge.

At the heart of the matter is the mechanical interface between the scalp and the measuring apparatus. Short of implanting electrodes directly into the brain, we have to make due with somewhat less invasive means. But like the myelin that attenuates electrical signals, the skull does a number on them, too. The good news is that the amount of signal that does come through is sufficient for detecting the tiny differences in the voltage levels between neurons—the on-off switches—and that’s what we’re seeking to capture. At this point, it simply becomes a matter of amplifying and filtering those signals for the purposes at hand. And what a world of purposes it is.

Spanning devices that enable the physically disabled to function more independently to biofeedback for health and wellbeing to creating a more immersive gaming environment to manipulating machinery with little more than a thought, the possibilities are limited only by one’s imagination.

Where the latter is concerned, just where man ends and machine begins is beginning to become a little less defined. In this sense, the brain-computer interface—BCI—could open up previously unimagined possibilities. And one of the major developments that is enabling those possibilities is the work being done by the dedicated team at OpenBCI.

***

Whether your interests lie in developing mind-controlled robots, conducting sleep lab research—or even hacking your Tesla to respond to your thoughts—OpenBCI has created neurofeedback for the masses. What’s more, the company’s versatile and affordable bio-sensing kits are open source: no longer the sole province of expensive clinical machines, you can now sample brain waves right at your kitchen table.

Popular Electronics on the brain-computer interface system

OpenBCI is the outgrowth of a DARPA-funded project to design and build a low-cost EEG platform for non-medical users. Enabled by a combination of Arduino and TI processors, the OpenBCI platform provides high-resolution imaging and recording of biopotentials including electrical brain activity (EEG), muscle activity (EMG), and heart rate (EKG).

GUI.gif

The OpenBCI GUI, also open sourced and available for mods.

We sat down with the company’s founder, Joel Murphy, to learn more about the technology, and how he and his colleagues developed it.

I understand that OpenBCI had its genesis in a DARPA grant. How did that come about?

In 2013, we teamed up with Creare, an engineering company in New Hampshire, to respond to an SBIR solicitation—a small business innovation research grant—seeking a low-cost, but high-quality EEG system for non-traditional users, that is, someone who is not a neuroscientist or doctor. And our proposal was one of those accepted for participation in Phase I of that grant. One of the stipulations in the solicitation was that it also had to be open source. The goal of the grant was to create tools that were not only powerful, but also flexible, modifiable, and accessible, and therefore available to anyone so we can crowd-source innovations in neuroscience. That led to the development of what became the prototype for the OpenBCI board.

Popular Electronics feature on openBCI founders

OpenBCI founders Conor Russomanno (left) and Joel Murphy (right)

At the time of the solicitation, I was teaching at the MFADT graduate program at Parsons, and coincidentally, a student of mine, Conor Russomanno, was doing his thesis project in neurofeedback. We ended up forming the company together, and launched a Kickstarter campaign in 2014 to fund it and get this technology out in the wild. We asked for $100K and got $215K in backer support.

Now, you don’t have a background in neuroscience, as far as I can tell…

No! Not at all. My background is in kinetic sculpture. I’m sort of an autodidact, always trying to learn new things and build on what I know. Conor went to school for Engineering Mechanics, and when I met him he was studying Design and Technology.

We love the idea of the non-expert doing these disruptive things.

Yeah, that’s us!

About the architecture of the system, what are the key enabling technologies?

It was determined early on that we’d use the Texas Instruments ADS1299—essentially an EEG system on a chip. It’s a low-noise, 8-channel, 24-bit analog-to-digital converter for EEG and biopotential measurements. We built the system on an Arduino platform, which gave us a lot of flexibility for the prototyping phase of the project—specifically, Digilent’s Arduino-compatible chipKIT microcontroller board, which integrates Microchip’s PIC32. We also use RFduino from RF Digital—an Arduino-compatible Bluetooth radio module based on Nordic Semiconductor’s radios—to enable communication between the host computer and the board, as well as providing a link to re-program the PIC32 microcontroller.

Tell me more about the host connectivity.

The OpenBCI board interfaces with your computer via Bluetooth with either a USB Dongle, or your computer’s Bluetooth. The dongle also has an integrated RFDuino that communicates with the RFDuino on the OpenBCI board, and an FTDI chip that establishes a Virtual COM Port on your computer.

Popular Electronics feature with openBCI Bluetooth

The OpenBCI board interfaces with the host computer via Bluetooth with either a USB Dongle or the computer’s Bluetooth.

And the communications protocol you’re using?

We’re using Nordic Semiconductor’s proprietary high-speed stack called the Gazell Link Layer, which is a protocol for setting up a wireless link between the Host and up to eight devices. We’re running that on our RFduinos. BLE is just too slow and bandwidth-limited. For the entry-level board, though, we’re using a straight-up BLE module, called Simblee, also made by RF Digital. We love them. I have to say we learned a lot about architecting communication protocols. But it was really nice that we were able to build everything on Arduino. Everything was easy to interface, and we didn’t have to worry about having a complicated toolchain. Anyone can jump in and start splashing around with the code.

What were the drivers behind going wireless?

It was important that the system be wireless, primarily for safety and liability reasons. But also, whenever you plug anything in, even if you have good isolation, you can end up getting more powerline noise than you want. A battery-powered board gives us much better signal integrity.

Popular Electronics on battery-powered arduino-based brain-computer interface

OpenBCI’s battery-powered configuration enables both superior signal integrity and mobility.

What can you tell us about the measurement accuracy and sensitivity you’re able to achieve?

There are other commercial EEG devices out there. The problem is that they are closed systems; no one can really verify their signals. But you can with ours, because we’re open source. We expose the entire signal path. For example, the TI ADS chip feeds us the 24-bit analog to digital results of whatever is happening on a particular channel, and we convert that signal into microvolts with a scale factor provided to us by Texas Instruments in their datasheet. So we basically send in a signal of known amplitude into the device, and we get the same signal out, meaning it’s as accurate as it can be. When benchmarked against state of the art, very expensive equipment, we come in looking very good on signal integrity, SNR, etc., but we’re also orders of magnitude below the cost of comparable gear.

Speaking of cost, you’ve made reference to an entry-level board. Tell me about the product range, and why would I choose one over the other.

Popular Electronics on arduino-based brain-computer interface

The OpenBCI Ganglion is a high-quality, affordable bio-sensing device. Its four high-impedance differential inputs can be used individually for measuring EMG or ECG, or they can be individually connected to a reference electrode for measuring EEG.

We make two electronic amplifier boards, the Ganglion and the Cyton. The Ganglion is a lower-cost 4-channel biosensing amplifier that, like the Cyton, can also measure ECG, EMG, and EEG, but with slightly less signal quality. It uses a Simblee BLE radio module to control the board, and data is sampled at 200Hz. It fits the bill for most low-cost research, education, and hacking. Also, if you’re doing neurofeedback to help with treatment for anxiety or depression, you’re only going to be using at most four inputs, so we wanted to make a lower-cost four-channel system available.

The Cyton has eight sensor inputs—and up to 16 with our expansion board. It samples data at 250Hz. It is, in fact, a research-grade product. The additional channels provide greater spatial resolution, enabling more diverse types of research that require higher channel counts. The scientists will always say, “More data, please!” They want all the signals they can get.

Those differences aside, both boards have the ability to measure bioelectric potentials ranging from the tiny EEG signals (1uV to 10uV) to ECG signals (~100uV) and also the EMG signals that your muscles emit (>100uV). You can also process multiple types of signals simultaneously, say, with electrodes on your scalp, chest, and shoulder, for example.

Popular Electronics on arduino-based brain-computer interface

The 32bit OpenBCI Board is an Arduino-compatible, 8-channel neural interface with a 32-bit processor. At its core, the 32bit OpenBCI Board implements the PIC32MX250F128B microcontroller. The board comes pre-flashed with the chipKIT™ bootloader, and the OpenBCI firmware. The board can be used to sample brain activity (EEG), muscle activity (EMG), and heart activity (EKG), and communicates wirelessly to a host computer via the OpenBCI programmable USB dongle or to any mobile device or tablet compatible with Bluetooth Low Energy (BLE).

Tell us about the expansion module available on the Cyton.

We call that the Daisy Module, which is essentially a shield, in Arduino terms. We’re limited to 16 channels right now, due to the wireless connection and the way we package the data and send it over the air. Of course, there are a lot of ways to compress data, so I imagine you could throw on another Daisy module on top and get 24 channels if you figured out the right compression scheme. We also have a developer/partner who is designing a Wi-Fi shield for the Cyton. This will greatly increase the bandwidth, which will enable higher data rates over the air and also allow more channels. That will make 24 channels a piece of cake. It does get a bit unruly, though, because you end up with boards stacked on boards stacked on boards.

Let’s shift gears here and talk about the headset.

In addition to the amplifier hardware, we also make a 3D-printed EEG electrode headset called the Ultracortex. The Cyton and Ganglion have input header pins for interfacing with the biosensing electrodes in the headset.

What are the big problems you’re solving with this?

One of the things people always want is ambulatory imaging; they want you to be able to walk around with an EEG on your head. Our wireless architecture enables that. The second issue is that people really don’t want to have to use that messy hair gel that makes for better electrode connections. The good news is that new dry electrode technologies have emerged. We’re using those, but you can use any biosensing electrode with our boards.

Popular Electronics on arduino-based brain-computer interface

The OpenBCI Daisy Module (a shield) provides eight additional differential, high gain, low noise input channels for the Cyton.

And the headset is 3D-printed?

Yes, the idea of the 3D-printed headset originated with this dream of being able to measure your head in various ways and enter those measurements into a web-based parametric engine and have it generate a headset that is a true custom fit. That’s the future; we’re not there yet. But by using 3D printing technology to iterate rapidly on designs of the headset, one size fits most. We also engineered special electrode nodes that screw in and out of the frame, so that when you size it to your head, it’s fixed. That makes it easy; you can literally go from zero to brainwaves in 30 seconds.

Popular Electronics on arduino-based brain-computer interface eeg headset

The Ultracortex is an open-source, 3D-printable headset intended to work with any OpenBCI Board. It is capable of recording research-grade brain activity (EEG), muscle activity (EMG), and heart activity (ECG). The Ultracortex Mark IV is capable of sampling up to 16 channels of EEG from up to 35 different 10-20 locations.

How is the positioning of the electrodes determined?

There’s a standard for that—the 10-20 system. It’s a scientific mapping of the scalp that allows you to replicate someone else’s work, or if you want to target certain areas of the brain, you can do that, and make whatever you’re doing repeatable.

What can you tell us about the electrodes you’re using?

We have them made for us. They are a copper substrate with a silver/silver chloride plating on them. Silver/silver chloride [Ag/AgCl] is the electrochemical material of choice for any type of biosensing application. The reason for that is the electrode is making a connection to your skin, but it’s not just a resistive connection; it has a complex resistance/capacitance characteristic. The signal that you’re getting is invariably going to have some sort of DC offset associated with it. Silver that has chloride mixed into it or coating it gives you the least DC offset. Each of the metals—gold, silver, tin, and so forth—has a certain offset.

If you’re going to use a dry electrode, your impedance is going to be higher than if it’s wet, that is, an electrode that makes contact with your scalp through a conductive gel. So you want to be able to maximize every angle you can: you’re just not going to get as good a connection using a dry electrode as you will with a wet electrode. And we can measure impedance with the TI ADS chip on the Cyton. For EEG, you want impedance that is under 10K Ohms. But when you’re using dry electrodes, you can get impedances of 80 to 90K Ohms, which is not ideal. Still, we’re able to obtain legitimate EEG signals with them. But it is a compromise. That said, if you’re doing serious neuroscience research, you’ll probably want to use wet electrodes.

The 10–20 system is an internationally recognized method to describe and apply the location of scalp electrodes in the context of an EEG test or experiment.

Now, one way to get around the limitations of a dry electrode, is with an active electrode. These work by placing a unity-gain amplifier right next to the electrode at the scalp; you just turn that op amp into a follower. It’ll take whatever signal that is there and push it down the wire with a lot more force. And it reduces environmental noise in the bargain. This greatly improves the signal quality. We’ll be making active electrodes sometime this year.

Lastly, I see that a sizeable community has grown up around OpenBCI.

The community is awesome. In fact, it’s our biggest asset. There are a hundred things you can do with EEG. We see people doing work with P300 waves and other projects that are just amazing. Just browse through the community to see what people are doing. I can’t tell you how rewarding it is to have a device like this that opens the door for people to get the powerful tools they need—people who otherwise wouldn’t have access or $60K to drop on a system.

Build It Yourself

OpenBCI is an Open Source Hardware company. That means you can get all of the design files for everything they make:

  • OpenBCI has published all the design and production files for both the Cyton and Ganglion boards, as well as the complete BOM, so you can build one yourself, or buy one fully assembled.
  • All of the firmware for the Cyton and Ganglion is published on github, as well, so you can modify the code to alter the behavior of the board in any way you like.
  • The Ultracortex Electrode Headset 3D print files are available via the OpenBCI github repository [need link]. OpenBCI also offers a “Print It Yourself” kit of the non-printed parts, as well as the entire BOM.
  • The OpenBCI GUI is written in Processing, and it is also open source and fully customizable.
  • Quick links for getting started:

Want to learn more about open source hardware? Visit the Open Source Hardware Association website at www.oshwa.org.