Community /

EEG Controlled Robotic Arm in Real-time

This tutorial demonstrates how to control a 6-DOF robotic arm (or any actuator) in real time using only alpha activity measured with the OpenBCI Cyton board.

Project Motivation and Overall Goal

The purpose of this project is to explore real-time decoding of brain activity to control external systems, as a step toward assistive neurotechnology for motor-impaired individuals (more specifically Parkinson’s patients).

This specific tutorial demonstrates a simplified proof-of-concept: using alpha-activity EEG activity to control a robotic arm in real-time. While alpha modulation is not a equivalent to true motor intention decoding, it provides a stable and reproducible neural signal that allows validation of the full real-time pipeline:

EEG signal -> signal processing -> actuator control.

The broader goal of the project is to develop a system capable of detecting true motor intention and translating it into assistive movement via muscle stimulation. The long-term motivation is a bit personal: to build a system that may one day help my father, who has lived with Parkinson’s for more than 10 years.

Required materials

Step 1: Hardware Setup

Build the robotic arm, or other actuator, of your choise. I secured mine to a wooden board to mimic the anatomical position of a human arm and prevent tipping. Power all the servos with a 6V supply with shared ground to the Teensy 4.1. The servos are connected to the Teensy 4.1’s pins with an LED too (its function is to be a diagnostic tool to inspect if the data stream is running).

Below is my setup shown as an inspiration:

Connect the USB dongle to your computer, turn on the Cyton board with the helmet placed on your head in a comfortable position (remember to put on the ear clips as reference and bias on your ear flips).

It’s very important that the Fp1 electrode is stable and tightly pressured against your forehead, as this is the channel we’ll measure the alpha activity.

Below is the EEG-helmet placed on-top of my head:

Step 2: Nesecarry coding and Theory

Arduino

Start by uploading the following Arduino code by using Arduino IDE to your Teensy 4.1.

The Teensy listens for serial input from Python:

  • When it receives ‘1’ ->
    • LED turns HIGH
    • Servo begins oscillating between minimum and maximum angles
  • When it receives ‘0’ ->
    • LED turns LOW
    • Servo stops moving

This creates a simple but robust actuator control system.

Python

Then upload the following Python coding, which reads the EEG-signal from the Cyton board in real time, by first applying a low-pass, high-pass, PSD Welch Method filters – to smooth the signal and get the alpha activity. A predefined alpha-threshold is set and when exceeding it a ‘0’ is serial sent to the Teensy 4.1, and when below ‘G1 is serial sent.

Theory

And here comes the catch: you can control your alpha activity in real time, by either remaining calm or stress – or as I do it – by closing and opening your eyes (increasing and decreasing the activity. This is due to the brain’s visual cortex in the frontal lope is switched off and doesn’t process the external visual stimuli – meaning it returns to an idle state (this phenomeon is also known as idle rhythms), where alpha activity stabilises at a constant higher value.

Step 3: Demonstration

A video demonstration is included showing real-time control of the robotic arm using only EEG alpha modulation.

Step 4: Reach out 🙂

If you have questions about the setup, coding or signal processing, feel free to contact me:

Email: [email protected]
WhatsApp: +45 30 14 43 13
LinkedIn: https://www.linkedin.com/in/tobias-bendix-nielsen-5b424228a/

Leave a Reply