BCI-based Raspberry Pi Mind Controlled Computer

“Now control any computer or play any digital game using brain waves”

Characters in science fiction movies are often seen running their minds on a computer. While this may not actually be possible, technology such as the brain-computer interface (BCI) could allow it.

Although completely paralyzed, the late physicist Stephen Hawking was able to communicate using a speech synthesizer on his computer, which he controlled with the help of certain facial movements. Wouldn’t it be surprising if in the future people of different abilities could communicate effectively with the help of brain waves transmitted using different sensors? Imagine that you don’t need a mouse or keyboard to type/navigate or play games. Your brain waves will be enough to make a decision. The positive changes seem endless.

Everything looks interesting. So why wait for the future when it can be developed in the present? Let’s begin our journey to make a positive change in many lives.

bill of materials

The following components are required to build this project.


First, install the BlueZ module in the Raspberry Pi IDE which will enable the EEG sensor to pick up Alpha, Beta, Gamma and Theta waves and stream this data over a Bluetooth connection via the Bluetooth serial port. You also need to install the PySerial Python module to get the EEG sensor data streamed from the Bluetooth serial port.

To process the captured EEG data, you can use the NeuroPy module. To control your PC’s GUI or mouse movements and clicks, use Pynput or any other similar Python module. To map a range of values ​​to another, use the nmap module. Installing these units is easy. Simply open a Linux terminal and execute the following commands:

sudo pip3 install pyserial

sudo pip3 install nmap

sudo pip3 install neuropy 


After importing all necessary libraries into the code, adjust the range of values ​​to be set for the screen resolution from the sensor readings. This code will enable to set EEG values ​​from 01px to 100px from the GUI. In my case, it was from 720p to 1080p.

Next, take advantage of the signal that the brain sends to the eye to flash. So, by flashing once, the left-click functions will be executed. Similarly, flashing twice will perform the functions of right-clicking. For these things to happen perfectly, you will need to assign values ​​to variables such as number of time, number of flashes, and start time.

Now you need to create a while loop so that EEG brain wave data can be converted into HID inputs to control mouse actions in the RPi GUI. It is therefore important to update the attention span of the mind that is responsible for generating mind waves. Mind waves will be set with a GUI pixel value and then move the mouse over the GUI.

Then, with the help of the condition predefined in the code, the duration of the signal spike in brain waves will be checked. If you meet a certain duration, the respective mouse will be clicked. It will also check how many blinking signals are being generated from the brain.


Now save the final code and connect the EEG sensor to your Raspberry Pi. Then wear the EEG sensor and run the code with focus to move the mouse in the x and y axes to click with the help of flicker signals from the brain.

Congrats!!! You just made a brain-controlled computer.

It can be a little difficult to move the mouse to the exact position you want it to be. But since this is the first release, I promise to add more cool and easy to control features in the future.

Leave a Reply

Your email address will not be published.