Approach: Our approach to this hack is extremely similar to the approach that we used for our multi-person control of a toy robot. As shown in the figure below, the idea is that you get multiple players hooked up to a single EEG system (OpenBCI, in my case). The computer processes the EEG data looking for each person's eyes-closed Alpha waves. Depending upon which person's Alpha waves are detected, the computer sends commands to the shark. The commands are conveyed to the shark via an Arduino, which is driving the shark's remote control. The end result is that the shark swims because of one player's brain waves. I think that's pretty cool.
Two-Person Demo: As Joel and I were pulling this hack together, we started to test it using just the two of us. Being just two people, we could only do two commands, not all five. It was still pretty fun, though. I love the sense of excitement that happens when a hack first starts to work.
Hacking the Remote Control: To make this shark controllable from the computer, we needed to hack into the shark's remote control. Like when I hacked the remote for the toy robot, Joel found that the remote for the shark was simply a few push buttons that were wired to pull one side of the switch down to ground whenever the button was pushed. So, to make this controllable from my computer, Joel soldered some wires to the circuit board (to the high side of each switch) to allow an Arduino to pull it down to ground instead of having to push it with your finger. As a result, we can now send a command to the Arduino and cause the shark to move. Our Arduino code for this hack is on GitHub here.
|We modified the shark's remote control but adding a wire to the non-grounded side of each push button.|
We brought the wires out so that we could connect them to an Arduino.
|An Arduino drives the shark's remote control.|
EEG Electrode Setup: It's quite easy to record a person's eyes-closed Alpha waves. Simply put one electrode on the back of your head (O1 or O2, if you know the 10-20 system). We then put the EEG reference electrode onto one earlobe and the EEG bias electrode on the other earlobe. You can see some examples in the photo below, where we had three people controlling the shark. We used the gold cup electrodes and Ten20 electrode paste that came with the OpenBCI kit
|Three-Man "Team Alpha!" Controlling the Shark. You can also see|
where we put the electrodes -- back of head and both earlobes.
OpenBCI Setup: To be clear, it is not normal to hook multiple people to one EEG system. We're definitely using EEG in a non-traditional way. That's why this is called "hacking". The trick is that you need to configure the EEG system (in this case, OpenBCI) so that each person has his own EEG reference. OpenBCI enables this by allowing each EEG channel to be run in "differential mode", where you use each channel's the "P" and "N" inputs as a differential pair. This is in contrast to the more-usual "common reference mode", where we use one of the SRB inputs as a common EEG reference for all EEG channels. To change OpenBCI to differential mode, you use the OpenBCI GUI, via the "Chan Set" tab, to change each channel's "SRB1" and "SRB2" setting to "off". Then, in the main window, turn off all of the other channels that you are not using.
|Screenshot Showing How to Configure for Five Channels in|
Differential Mode...simply Turn Off SRB2.
Plugging Into OpenBCI: Once you've got the EEG electrodes on the individual players, you've got to hook them into the OpenBCI board. Because we're in "differential mode", each player will get one "P" input and one "N" input. For this hack, we put the electrode from back of the head into the "N" input. We then put the left earlobe into that channel's corresponding "P" input. Finally, the right earlobe was connected to a bias pin. Because we had five players, there aren't really enough bias pins available. I used a 16-channel OpenBCI board because it has 4 bias pins, so that covered four players. The fifth player simply plugged into the analog ground pin ("AGND"), which is not as good as using a bias pin, but it worked well enough.
|Wiring Electrodes to the OpenBCI Board for Five Players. Note that the board only|
has 4 bias connections, so one player is attached to AGND instead.
EEG Processing Algorithms: As mentioned earlier, the PC does all of the EEG processing...no processing occurs on the OpenBCI board itself. For the software on the PC, we started with the stock OpenBCI GUI. Then, I extended it by (1) adding the Alpha detection algorithms and by (2) adding code to send shark commands to the Arduino. This variant of the OpenBCI GUI is currently saved here on GitHub as a branch of the main repository. As you can tell from the class names shown in the code, the code is based heavily upon the previous work with the HexBug robot...which you may find confusing since we're controlling a shark and not a HexBug. Sorry for the confusion!
Three-Person Testing: After Joel and I did our two-person testing, we roped in a couple of other players to join Joel. That got us to a three-man shark attack!
|Three-Person Brain-Controlled Shark|
Shark Food: While we were all hacking the shark to make it brain-controlled, Conor was busy doing his own hacking. Once we finally got our brain-controlled shark into fighting condition, we couldn't resist swimming it over to harass Conor. Conor was pretty sure that his teeth were sharper than the shark's, so he wasn't much afraid.
|Conor Faces Off Against the Shark.|
Four-Person Shark Control: Having successfully used three people to control the shark, we wired up a fourth person. Have you ever tried to get four people doing anything in a smooth and coordinated fashion? It's hard! But, we did have success...
Five-Person Shark Attack: OK, if four people working together is hard, five people is just chaos. In case you can't seem him, notice below that the fifth guy is in the center of the crowd, kneeling so that you just see his head popping above the bench. The wiring on the OpenBCI electrodes seems generously long when you're just attaching one person. With 5 people, though, you really need longer wires...or you simply need a little creativity on how you pack the people together.
|Five-Person Brain-Control of the Swimming Shark. The fifth person is kneeling|
and you can only see his head. We need longer wires!
Swimming Away: By the time that we got this all working, it was really late at night. The time stamps on the pictures show that it was about midnight, and we'd been at OpenBCI HQ since about 10AM. So, between the fatigue and all the caffeine, I think that we were getting some funny brain wave behavior. For example, one guy was making some weak Alpha even with his eyes open. Wacky! Regardless, we were able to get the shark to swim around...until we swam the shark too far to one end of the OpenBCI HQ...
|Swimming the Shark Off Into the Sunset.|
...at which point the shark's IR remote control could no longer communicate with the shark. Stranded Shark! And so our night of EEG hacking ended. Still, it was mighty fine work, Go Team Alpha!