Quantcast
Viewing all articles
Browse latest Browse all 4928

General discussion • Connecting and getting data from Neurosky Mindwave Mobile 2 to Raspberry pi 4

Hey,

I am new to the world of EEG Headsets and does anyone know how I can stream the data from the neurosky to my Raspberry Pi 4?
I tried using socket programming but the connection keeps on disconnecting.

Here's my code:
import serial

# Define the port and settings for Mindwave
port = '/dev/rfcomm0'
baud_rate = 57600 # Mindwave typically uses 57600 bps
timeout_duration = 2 # Timeout in seconds

try:
# Open the serial connection
with serial.Serial(port, baud_rate, timeout=timeout_duration) as headset:
print("Connected to Mindwave on Raspberry Pi via /dev/rfcomm0")

# Continuously read data
while True:
data = headset.read(10) # Adjust packet size as necessary
if data:
print("Data received:", data)
else:
print("No data received. Waiting...")
except serial.SerialException as e:
print("Error connecting to headset:", e)

Does any one know what I can do?

Statistics: Posted by CaptainJackSparrow — Mon Nov 11, 2024 6:48 pm



Viewing all articles
Browse latest Browse all 4928

Trending Articles