Fareed Mohmed← All projects

Info page · no simulation · Arduino and electronics

Brain-Controlled Wheelchair (Learning Model)

How a headset that reads brain waves (EEG) can steer a small robot chair with an Arduino, and why safety checks come first.

This topic cannot be run safely or meaningfully in the simulator, so this page explains it with diagrams, calculations and sample code instead. Everything here is original.

What you will learn

  • What an EEG headset measures and outputs
  • How attention values can start and stop a model chair
  • Why sensors must always be able to override the brain signal

In short

A consumer EEG headset such as the NeuroSky MindWave measures tiny electrical signals from the forehead. It sends numbers by Bluetooth: an attention level from 0 to 100, a meditation level, and a signal quality value. The Arduino reads the numbers and turns them into drive commands. An ultrasonic sensor can always stop the chair, because EEG signals are noisy.

Try this next

  • Use eye blinks (blink strength) as a second command to turn.
  • Add an emergency stop button.
  • Add a speed limit that rises slowly with attention.

Safety: this page describes a learning model on a small robot car. A real wheelchair is a medical device. It needs certified motors, brakes, an emergency stop and clinical testing. Do not carry a person on a home-made model.

System diagram

EEG headsetattention, signal qualityBluetooth moduleHC-05, 57600 baudArduino Megareads, decidesMotor driversBTS7960 or L298NTwo gear motorsleft and rightUltrasonic sensorobstacle aheadArduino MegaEmergency stopbuttonBuzzerstatus sound

The headset sends packets of numbers (the ThinkGear protocol) many times a second. The Brain library for Arduino decodes them. A Mega is best because it has extra serial ports for the Bluetooth module, leaving the USB serial for debugging.

Decision rules

#include <Brain.h>

Brain brain(Serial1);              // headset Bluetooth module on Serial1 (Mega)
const int TRIG = 22, ECHO = 23, ESTOP = 24;
unsigned long goSince = 0;

long distanceCm() {
  digitalWrite(TRIG, LOW);  delayMicroseconds(2);
  digitalWrite(TRIG, HIGH); delayMicroseconds(10);
  digitalWrite(TRIG, LOW);
  long us = pulseIn(ECHO, HIGH, 30000);
  return us == 0 ? 400 : us / 58;
}

void driveForward() { /* set your motor driver pins here */ }
void stopMotors()   { /* stop both motors */ }

void setup() {
  Serial1.begin(57600);
  pinMode(TRIG, OUTPUT); pinMode(ECHO, INPUT); pinMode(ESTOP, INPUT_PULLUP);
}

void loop() {
  if (digitalRead(ESTOP) == LOW) { stopMotors(); return; }   // button to GND = stop
  if (brain.update()) {
    bool good = brain.readSignalQuality() == 0;
    int attention = brain.readAttention();
    if (good && attention > 60) { if (goSince == 0) goSince = millis(); }
    else if (!good || attention < 40) goSince = 0;
  }
  bool wantGo = goSince != 0 && millis() - goSince > 1000;
  if (wantGo && distanceCm() > 40) driveForward(); else stopMotors();
}

Parts list

PartWhat to look for
EEG headset (for example NeuroSky MindWave Mobile)Bluetooth, 57600 baud
Arduino Mega 2560Needs Serial1
HC-05 Bluetooth modulePaired as master with the headset (set with AT commands)
Motor driver and two gear motorsRated for the motor current
Ultrasonic sensor HC-SR04Obstacle stop
Emergency stop button, buzzerAlways fitted
Small robot chassis and batteryUse a fuse

Do and do not