[Summer’16 Internship] Arduino, EEG, and Free Will
By Patrick Glover
A longstanding debate in philosophy focuses on the existence of free will. Do humans have some inherent moral agency, or are our brains just biological machines, subject to the same physical determinism as any other animal? Modern neuroscience can provide some insight to these questions, such as Benjamin Libet’s famous 1986 experiments that correlate the EEG readiness potential (RP) with a subconscious decision to perform a voluntary action. In summary, before a subject performs a simple voluntary action (e.g. “Flex your wrist whenever you feel like it”), the secondary motor area generates a characteristic EEG potential over 300 milliseconds before the subject becomes aware that they are going to perform the action. If the brain had already been preparing to perform the action for nearly half a second before the individual consciously “decides” to perform the action, did the individual actually… decide? Since the paper was published, dozens of philosophers and scientists have attacked the paper’s methods, arguing that the claims made by Libet are overstretched and that the RP carries very little weight in the free will discussion. In the true spirit of open science, anyone should be able to recreate this experiment, both improving the quality of this debate with additional data, as well as furthering the general public’s understanding of neuroscience.
My project aims to allow the DIY community to participate in the discussion by recreating Libet’s experiment using just an Arduino and a simple open source shield.
Paper upon which this project is based: Neurophysiology of Consciousness 1993 Libet.pdf
Below are the complete instructions for this experiment, if you want to see the whole process (every step and attempt to achieve this project) you can check out the following logs:
- Log 1: First Steps (June 21)
- Log 2: A big duh moment ( June 29)
- Log 3: Finally Working (July 06)
- Log 4: Three Channels (July 19)
- Log 5: Measuring awareness times (Aug 01)
For this Experiment you will need.
- 1 × Arduino Uno
- 1 × Backyard Brains EMG Spikershield
- 1 × Backyard Brains Heart/Brain Shield
- 1 × Headband
- 2 × Snap fastener studs
- 4 × EKG adhesive electrodes
- 1 × Conductive electrode gel
- 1 × MATLAB
Assembly of the recording device is quite simple. The EMG and EEG signals each come from their respective Arduino shields, both sold by Backyard Brains fully assembled. If you’re interested in building everything from scratch, the schematics are online here and here.
- Insert the Heart/Brain shield directly down onto the Arduino so that all the male pins fit into the board’s female ports. We want the EEG signal being sent out on channel 1, so short the two pins on analog 1 on the Heart/Brain shield
- Our goal is to stack all three boards, but the signal output jacks on the Heart/Brain shield block the EMG shield from fitting effectively. To fix this, we simply add pin header extenders to all the EMG shield’s pins. The boards should stack without any issues. We want EMG signal on channel 2, so short both pins on analog 2 on the EMG shield.
- Once the shield stack is assembled, load the spike recorder code onto the Arduino, found here. Also, download the free Backyard Brains Spike Recorder software.
Here is the final product
The next step is to make a bidirectional, one channel EEG headband. To do this, take an elastic headband and insert two snap fasteners roughly 4 cm away from each other on the midline of the band. Any type of headband should work, but avoid any with metallic paints or patterns.
On your subject, secure the headband vertically on the front of their head so that the flat faces of the two metal studs are on C3 and Cz.
Apply a dab of electrode gel underneath each lead to help conduct signal. This is especially important for subjects with longer hair. Place a single electrode on the left mastoid process. This will be our reference electrode.
Place one electrode on the back of your subject’s right hand, and two on the inside of their forearm, spaced around 15 cm apart, right over the ulnar nerve.
Plug in an orange muscle electrode cable to each of the shields, and attach alligator clips to your subject. On the EMG board, connect the black clip to the back of the hand, and red clips to the ulnar nerve electrode. On the EEG board, connect the black clip to the mastoid electrode and the red clips to the electrodes on the headband. Polarity is not important.
Connect your Arduino to the computer over USB, and open the Spike Recorder app. In settings, connect to the USB modem by selecting it in the drop down menu and clicking the plug icon. Once connected, go back to settings and select two channels. You can also adjust band pass filter settings as needed. You are almost ready to begin recording data.
Verify that your signals are EEG and EMG. To do this, have your subject relax their arms on a table, and have them flick their wrist several times. You should see one channel showing significant spiking any time the subject does this. In this particular recording, EEG signals are harder to verify. The presence of alpha waves is greatly diminished over this region of the scalp. One way to verify the signal is valid is to have your subject quickly direct their eyes up and then return to the center. The head should not move – only eyes. Have them look down, center, left, center, right, center. The EEG should register electroocular artifacts. If your resting signal looks similar to below, you may proceed with the test.
Have your subject sit upright and look straight ahead, arms resting on the table. Click the record button on Spike Recorder. Instruct them to briefly and deliberately flick their right wrist any time they feel like doing so. Flicks should be at least four seconds apart. They should not fall into a mindless rhythm — each flick should be intentional. Record as many trials as you see fit, although I’ve noticed I only get a decent response when I’m looking at at least 100 flicks. Click the record button to finish your recording. The software will tell you where it saved the file.
Find the .wav file (It’s in /User/Music/Spike Recorder on Mac) and copy it into your MATLAB project folder. In the runRP MATLAB script, change the file name on line 1 to the name of the file you would like to analyze. In the command window, type runRP. The script will return several figures. All MATLAB code can be found herehttps://github.com/patrick-glover/EEG-Code
By Patrick Glover