Control Arduino Using Your Brain and OpenBCI GUI

2,519

19

This tutorial shows you how to get started streaming data from the OpenBCI GUI's Focus Widget via Serial connection to an Arduino UNO Rev3. Specifically, this is designed for use in classroom settings for individuals who have little or no electronics experience. No "hacking" is involved!

OpenBCI hardware and software are open source! Experienced makers have the option of building this project from scratch. Full Documentation: OpenBCI Docs on GitHub.

Grade Level Recommendations and Unit Timeline:

  • Middle School: 2-5 days
  • High School: 1-5 days
  • College: 1-2 days

This includes the time it takes to complete this instructable and then expand the project using the Arduino and available hardware (~60 mins each day). Teachers should complete this instructable before sharing with students and also account for lab setup time before each lesson.

Skills Addressed:

  • Computer Science: PC to Arduino Serial Communication
  • NGSS: Gather and synthesize information that sensory receptors respond to stimuli by sending messages to the brain for immediate behavior or storage as memories. MS-LS1-8
  • NGSS: Use argument supported by evidence for how the body is a system of interacting subsystems composed of groups of cells. MS-LS1-3
  • NGSS: Develop and use a model to illustrate the hierarchical organization of interacting systems that provide specific functions within multicellular organisms. HS-LS1-2

Hardware:

Software:

  • The Arduino IDE(free)
  • The example Arduino sketch (provided)
  • The OpenBCI GUI(free) standalone app or Processing sketch

Flexible Grouping:

  • The Software Operator controls the computer and software.
  • The Connected User is physically connected to an OpenBCI board.
  • The Hardware Specialist helps make sure the Connected User is properly connected.
  • The Recorder takes notes for the group and assists the Software Operator and Hardware Specialist.

Helpful Background Skills:

OpenBCI Getting Started Guides:

Related Instructables via Google search.

Formal lesson plan coming soon! Check back later for updates to this instructable!

Step 1: Review the Scientific Method and Ask Questions

Here is a helpful webpage that describes the scientific method: Science Buddies - Steps of the Scientific Method

Teachers: Start the lesson with a hook of your choice, and then ask students to write down one question on a piece of paper. This question must be directly related to the brain.

Possible Questions:

  • What is the brain?
  • What does the brain do?
  • How does the brain control my body?
  • What makes my brain different from another person's brain?
  • Can a computer read my thoughts if I connect my brain to the computer?
  • How do we measure brain activity?
  • What does EEG stand for?

Step 2: Do Background Research and Construct a Hypothesis

Teachers: Inform students that they will be controlling an Arduino with their brain over the course of this unit.This should make most students excited! Now is the time to share information on the brain, central nervous system, and how this relates to the standards for your grade level.

Transition Statement: "It is important to know the basics of how our brain works if we want to control something outside of our own body, like an Arduino. Let's check out this video to learn more before we proceed."

Video Lecture:BrainWorks: Neuroscience for Kids

Revise Questions: Before students form hypotheses in groups, they should be given a chance to revise or completely change their questions based on the information presented in the lecture or video lecture provided above.

After the revising their person questions, students in flexible groups will Construct a Hypothesis using the following format:
“If [I do this] , then [this] will happen.”

Step 3: Load the Example in the Arduino IDE

The OpenBCI_GUI-FocusArduino.ino file is designed to serve as a simple starting point for creating your own Arduino project using data from the GUI over serial. Download the .ino file and open with the Arduino IDE.

Step 4: Upload the Arduino Sketch

Connect the Arduino UNO to your computer using a USB cable. After uploading the sketch, you can close or minimize the Arduino IDE, but keep the Arduino connected to the computer. The sketch we just uploaded is running!

Having trouble with this step? Check out the official getting started guide from Arduino.

Step 5: Open OpenBCI GUI in Synthetic Mode

8 Channels will work fine for this example. Click "Start System" to continue.

Step 6: Setup the Networking Widget

Open and setup the Networking Widget as shown in the picture, using Serial mode. We want the data type to be "Focus".

Also, note the baud rate in our Arduino sketch is 57600, so we select 57600 from the Baud dropdown.

Make sure to select the correct port for the Arduino. It's the same port we used to upload the sketch to the Arduino.

Step 7: Open the Focus Widget & Start Streaming

Open the Focus Widget using the dropdown menu.

Then, click "Start Data Stream" at the top left of the GUI.

Next, click "Start" in the Networking Widget. You are now sending Focus data to the Arduino.

Step 8: Simulate Focused State

Next, turn off channel one in the Time Series Widget by clicking on the button to the left of the data.This will simulate a Focused state.

The Arduino's built-in LED should light up when the Focus Widget reads "focused!"

If you have a Ganglion or Cyton, proceed to the next step in this instructable to get connected!

Step 9: Get Connected - Part 1

Now that you've got the OpenBCI GUI and your Arduino working and talking to each other, it's time to connect your brain to the computer!

At this point, you will need an OpenBCI board and some way to connect leads to the Connected User's head at specific locations. Thankfully, the OpenBCI headband and Mark IV headset make this step easy.

Teachers and Experienced Makers: Please setup the headband electrodes beforehand as outlined in the EEG Headband Guide. This includes connecting the leads to the Ganglion/Cyton. If you are using a Ganglion, you will need to flip switches sw1-sw4 to the down position. This is because we are measuring EEG instead of EMG signals.

Students: The Hardware Specialist and the Recorder will help attach the headband to the Connected User. Don't forget the earclip electrodes!

Mark IV Headset Users: Follow the Ultracortex Mark IV guide to get connected to the OpenBCI GUI.

Step 10: Get Connected - Part 2

Students: Once the Connected User is connected, we can go back to the OpenBCI GUI and go to LIVE (from Cyton) or LIVE (from Ganglion). In the picture above, you can see the Ganglion-1f40 has been detected using the BLED112 dongle. Your teacher should have labeled the Ganglion you are using with your group. Click on your Ganglion from the list and then click Start System.

Teachers: Please label the name of each Ganglion board, or Cyton dongle, during setup/testing. As you can see, it would be difficult for students to tell which board they are using in a multi-board classroom setup.

Step 11: Get Connected - Part 3

Troubleshooting Connection Issues:

  • If the board was unable to connect after pressing Start System, you may need to turn it off and back on again. In some cases, it may help to restart the GUI also.
  • Move the dongle and board closer together.
  • Don't place cell phones close to the dongle or board.
  • Cyton Users: Look for the red LED flash on the dongle, then the blue LED flash. This indicates the computer USB port is recognizing the dongle. If your computer doesn't recognize the dongle, restart your computer (which resets your USB ports). Sometimes, you just need to reset the port for it to be recognized.
  • If you can connect to the board but a channel reads "RAILED", the electrode or ground (ear clip electrodes) may not be connected properly.

Impedance Check:

When using Cyton, you can display the impedance of individual channels by toggling the small Ohm icon to the right of each color coded channel number in the Time Series Widget. When the Ohm icon is toggled on, the board sends a small current through the selected channel to obtain the impedance value. For this reason, you won’t be able to stream data on a channel and obtain the impedance value simultaneously.

To test impedance for Ganglion, use the Ganglion Signal Widget.

Step 12: Stream Live Focus Data to Arduino

Once you see a steady stream of data from the Connected User in the Time Series Widget, it's time to setup the GUI just like we did in Synthetic Mode at the beginning of this tutorial. Also, you can turn off any channels that aren't being used.

Press "Start" in the Networking Widget to start streaming Focus data to the Arduino.

The Connected User should close his/her eyes while focusing on breathing nice and slow, otherwise known as meditating.

If all of these steps have been completed successfully, the other group members will see the Focus widget say that the Connected User is indeed focused! Wow! How cool is that? Celebrate with your group and proceed to take turns trying to see if all group members can get a "Focused" reading.

But how does this work? What is happening? How does the OpenBCI GUI know when someone is focused or not? These are great questions, and we can use this investigation to understand how our brains work to keep our bodies functioning.

Step 13: Analyze Data and Draw Conclusions

Now, each group should have real data from the Connected User's brain that will either confirm or refute the group's hypothesis. According to the scientific method, we should communicate these results by recording what happened, and why it might have happened. If the data does not align with the hypothesis, the group should ask new questions, form a new hypothesis, and experiment again. If the data fully supports the hypothesis, ask the teacher to verify the results.

In any case, it is important for the Recorder to write or type what has been observed. This means recording only information that can be observed. Refer to the examples below:

Observable Data: I saw Sally close her eyes and then I saw the OpenBCI GUI Focus widget read "focused!"

Non-Observable Data: John said he felt like he was meditating, and I believed him.

Teachers: Once the students have successfully tested and confirmed a hypothesis, direct them to attempt to answer their personal question from Step 1 and then move on to extension activities to expand the project as a group.

Step 14: Next Steps - Examples and Extension Activities

Discussion Points:

How can this be used to make something?

For now, let's just stick with Focus data. You can add more to your new Arduino project to react to Focus data from the OpenBCI GUI:

  • Try controlling even more LEDs using the Arduino
  • Try controlling a motor or group of motors
  • Make a second copy of your project and make it a two player game!

Step 15:

Classroom Science Contest

This is an entry in the
Classroom Science Contest

Share

    Recommendations

    • Classroom Science Contest

      Classroom Science Contest
    • 1 Hour Challenge

      1 Hour Challenge
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest

    Discussions