WiFi Streaming

This part of the documentation is about streaming data from HackEEG via WiFi to software running on a different computer using a Raspberry Pi 4.

You will need a Raspberry Pi 4 set up with Python 3.6. These instructions will show how to set that up and install HackEEG on it.

Installing Raspbian

  1. Download and install Balena Etcher. This is a program that can write disk images to SD cards.

  2. Download the latest Raspbian Lite image. This tutorial focuses on Raspbian Lite that has no GUI, but any version of Raspbian will work. (Raspbian downloads page)

  3. Use Etcher to write the Raspbian image to the SD card using the SD card reader.

  4. Mount the card on your laptop by pulling out and reinserting the SD card. It should show up as a disk volume named boot It should show up as a disk volume named boot.

  5. Create a file named ssh — this will enable the ssh server.

  6. Create a file called wpa_supplicant.conf. This is a configuration file that will allow you to pre-configure the WiFi credentials. On boot, the Raspberry Pi will copy and use this as the default configuration file. Put the following content in it:

    country=US
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    
    network={
    ssid="WIFI_SSID"
    scan_ssid=1
    psk="WIFI_PASSWORD"
    key_mgmt=WPA-PSK
    }
    
  7. Put the SD card into the Raspberry Pi.

  8. Connect the charged USB power bank to the Raspberry Pi’s USB-C power connector.

Install Python 3.6

  1. ssh to root@raspberrypi.local

  2. Install pip:

    sudo apt-get install python-pip
    
  3. Install Python requirements:

    sudo apt install bzip2 libbz2-dev libssl-dev libreadline-dev
    
  4. Install pyenv

    curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
    
  5. Install Python 3.6 – this may take a while because it’s going to compile Python.

    pyenv install 3.6.8
    pyenv global 3.6.8
    

Installing HackEEG on a Raspberry Pi 4

  1. Follow the regular installation instructions for HackEEG.

Connecting OpenBCI to HackEEG via Lab Streaming Layer

  1. IMPORTANT! Ensure you are running on battery power. HackEEG has no mains isolation circuitry.

  2. Connect to the Raspberry Pi 4 via ssh:

    $ ssh root@raspberrypi.local
    $ cd hackeeg/
    
  3. Start the hackeeg_stream program:

    $ hackeeg_stream --sps 500 --continuous --lsl
    
  4. You should see the HackEEG blue board LED blink briefly to indicate proper operation.

  5. Start OpenBCI as described in Installing OpenBCI

  6. Select Live (from Lab Streaming Layer)

  7. Select 8 channels

  8. Click Start Session

  9. Click Start Data Stream

  10. In the lower right widget drop-down, select the Band Power widget

  11. You should see something like this:

OpenBCI streaming LSL data from HackEEG


Credits

Thanks to Losant for their article Getting Started with the Raspberry Pi Zero W without a Monitor that part of this documentation is based on.