Community /

Raspberry Pi for EEG acquisition

I have been working on using Raspberry Pi 3 for signal acquisition. In the first part I explain how to set up acquisition server for Ganglion (Bluetooth) and second Wifi hotspot for Wifi Shield.

Ganglion (Bluetooth)

Using Ganglion on Windows usually requires a CSR dongle and installation of drivers as described here. Instead, I decided to use a Raspberry Pi for signal acquisition so that you can stream signals to any computer in the local network without driver installation.

Follow the instructions below to install OpenBCI_Python. Before starting, if you haven’t set up python3/pip3:

sudo apt install python-dev libglib2.0-dev
sudo easy_install3

Then clone the repository and build/install dependencies:

git clone htps://
cd OpenBCI_Python
git submodule update --init --recursive
cd bluepy/bluepy
cd -
sudo pip install -r requirements.txt

Now OpenBCI_Python is setup, so you can use the following command to connect to Ganglion (make sure it’s turned on)

sudo python3 --board ganglion -a streamer_osc <your_pc_ip_address> <port>

and type /start to start streaming, and Ctrl+C to stop the process. You might get frequent packet loss, so you need to tune parameters like:

sudo bash -c 'echo 9 > /sys/kernel/debug/bluetooth/hci0/conn_min_interval'
sudo bash -c 'echo 10 > /sys/kernel/debug/bluetooth/hci0/conn_max_interval'

9 and 10 are suggested values in the README, but I had better results with 8 and 8.

You may have noticed that the above python command does not work if you substitute streamer_osc with streamer_lsl. This is because default pyLSL does not come with ARM libraries. You can clone from my repository here to save time on compilation (I will omit python package installation instructions as you are most likely knowledgeable if you want to use OpenBCI and LSL).

Hotspot for Wifi Shield

Often university Wifis are WPA Enterprise, which Wifi Shield cannot connect to. Having a mobile Wifi router can be handy, but you can also turn a Raspberry Pi into a Wifi router. I recommend to use a USB Wifi dongle (wlan1) for a hotspot and the on-board Wifi (wlan0) for connecting to an existing network. This way, simply turn on your Pi anywhere to open a Wifi network, and at home, the Pi can still be online through a home network without an Ethernet cable. It’s very confusing so I will name networks as follows:

  • Pi Network: hotspot shared by a Pi (wlan1). It may be online if the Pi is connected to Home Network.
  • Wifi Shield Network: hotspot shared by a Wifi Shield (SSID: OpenBCI-XXXX). You need this to configure the Wifi Shield. It is always offline.
  • Home Network: Wifi at home, workspace, etc. I assume this is online. The Pi will connect to this network by device wlan0.

Detailed instructions can be found on Raspberry Pi documentation. Note that I replaced

  • eth0 -> wlan0
  • wlan0 -> wlan1

so that Home Network will be shared to Pi Network. Once configured, turn on the Wifi Shield, log in to Wifi Shield Network from your smartphone or computer and go to or (whichever that works). Then type the credentials you chose on /etc/hostapd/hostapd.conf (in the documentation, the SSID is NameOfNetwork and password is AardvarkBadgerHedgehog). Now, your Wifi Shield will restart and automatically connect to Pi Network. You can connect to the Pi Network from your computer, launch OpenBCI_GUI and when you select Cyton Wifi or Ganglion Wifi depending on your board, GUI should automatically detect the Wifi Shield. So far OpenBCI_Python does not support Wifi Shield, but you can contribute to the project!


Leave a Reply