Traffic Light BCI (Brain-Computer Interface)Project 🧠🤯🖥️

For a little intro into BCI, here is a really well explained and concise 4 min read article. Check it out!

Hardware:

- 1 Arduino UNO R3

- 1 Breadboard

-1 Hacked MindFlex Headset. I will have another video showing how I hacked the headset and highlighting some major difficulties.

-1 Green LED

-1 Yellow LED

-1 Red LED

- 3 330 Ohm Resistors

Jumper Wires

**I would recommend buying an Arduino Starter Kit, which comes with the basic materials for your projects. Here are a couple of options you could choose from!

Urgent Use

Basic Economic

Complex Economic

Tools:

-Hot Glue Gun

-Solder

-Screwdriver

Software:

-Arduino IDE

Download

-Arduino Brain Library

Download

Note: To install the Brain library you have to put the brain folder inside the Arduino “libraries” folder. Here is a video explaining how to do so!

I did not use the resistors because I realized that my LEDs light brighter; therefore, I completed the circuit with a couple of jump wires(on the picture below wire Yellow, Red, and Green).

The Video!!!📺

Here is the code:

#include <Brain.h>
Brain brain(Serial);
const int greenPin = 2;
const int yellowPin = 4;
const int redPin = 7;
long interval = 500;
long previousMillis = 0;
int ledState = LOW;

int attValue;
void setup() {
// Set up the LED pin.
pinMode(greenPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(redPin, OUTPUT);

// Start the hardware serial.
Serial.begin(9600);
}
void loop() {
// Expect packets about once per second.
if (brain.update()) {
Serial.println(brain.readCSV());

// Attention runs from 0 to 100.
attValue = brain.readAttention();
}
// Make sure we have a signal.
if(brain.readSignalQuality() == 0) {

// Light up the green LED
if (attValue < 40) {
digitalWrite( greenPin, HIGH);
digitalWrite( yellowPin, LOW);
digitalWrite( redPin, LOW);
}

//Light up the Yellow LED
else if (attValue < 70 and attValue > 40)
{
digitalWrite( yellowPin, HIGH);
digitalWrite( greenPin, LOW);
digitalWrite( redPin, LOW);
}

//Light up the red LED
else if (attValue >70)
{
digitalWrite( redPin, HIGH);
digitalWrite( greenPin, LOW);
digitalWrite( yellowPin, LOW);
}
}
}

NOTE: While uploading the code, I find it only viable when I remove the jumper wire from the RX pin on the Arduino. After done uploading, plug the jumper wire back and turn on the headset to start.

Resources That Helped Me

Source of This Project

Hello, Friends! 👋

Join me on my Weekly Jubilocity Party🥳,** where I host an entertainment event for friends🫂. Please invite unicorn people 🦄that you know to join us. You could just use this same template!! Every week we will have a topic to discuss and it is up to you to choose! 🙆‍♂️

Here is the link to know what is our availability! Please, fill it out with your normal schedule — Schedule📅 without any sudden event — because we will be having the meeting weekly. Here is the link for Google Calendar Invite! For now, I have it for Friday from 7:00 PM to 8:00 PM EST.

--

--

--

Hey people! Juky is here sharing optimism, and inspirations that I had learned while exploring the world. I hope y'all enjoy my stories and follow for more!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Rewiring Your Brain from Python to Java

Volcanic Mount Bromo, East Java, Indonesia

How To Start A Career As A Seattle Website Developer

Story of clean code

Getting started with proxy-rust-sdk

Kotlin basics #1

Play PUBG better on your phone

How to set GitBash as the default NPM script runner on Windows

Big Data Explained in Plain and Simple English

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
JUKY CHEN WEI LING

JUKY CHEN WEI LING

Hey people! Juky is here sharing optimism, and inspirations that I had learned while exploring the world. I hope y'all enjoy my stories and follow for more!

More from Medium

Embedded System Programmimg on ARM Cortex-M3/M4 Processor

Blockchain, Hash and Merkle-tree: data immutability and integrity, append-only database

Advent Of Code 2021 — Lanternfish — Puzzle 6

Command Robotics Testing in Stellar PUBLIC Environment