Using Your Own Server

By default device streams data to FOCUS MQTT broker for EEG signals filtering and visualization in UI. If you want to get access to raw data you need to setup your own MQTT broker or use a third party one.

Note, that at this moment device supports transport layer security (TLS) only for connections to FOCUS MQTT broker.

Install and configure local MQTT broker

Local MQTT broker is useful if you want to use maximum possible sampling rates (up to 16000 SPS). This is possible, because local network normally has very low latency. Another reason to use a local MQTT server could be safety, since in this case sensitive private data doesn’t leave your local network.

  1. Install and start ActiveMQ

If you don't have bash installed, follow these steps to install ubuntu subsystem on windows 10. Alternatively just install ActiveMQ on Windows.

Install Apache ActiveMQ and start it (instructions here).

  1. Open firewall

The EEG Dev Kit will connect to your ActiveMQ server over your Wi-Fi connection. It is important that both devices are on the same network for this to work.

Then open firewall rules for any ports that are used in conf/activemq.xml e.g. 1883

Check that you can connect to your ActiveMQ using an MQTT client such as MQTT.fx

Another quick check is to use telnet from another machine on the same network

  1. Create topic and update device

Your EEG Dev Kit has a unique 24 digit ID (Device ID) which can be found in foc.us/me Device Details page.

Create a topic in ActiveMQ with your Device ID plus suffix .afe.binary

e.g. 303730313534510A004A0024.afe.binary

Now provide the new server details to the Dev Kit in the focus/me Settings page

e.g. mqtt://192.168.15.43:1883

Finally turn on one or more AFE channels.

Using third party MQTT broker

This is the simplest option to get access to raw data. There are many paid and free MQTT brokers. In this example we show, how to work with public MQTT broker https://test.mosquitto.org. Since it is public, there is even no need to create your own account.

  1. In Server Settings enter MQTT server details: mqtt://test.mosquitto.org:1883
  2. Done! Device will start to publish data to test.mosquitto.org as soon as EEG session enabled.

Getting data from MQTT broker

To receive the raw data in real time any MQTT client can be used. It should be connected to MQTT broker and subscribed to ‘deviceID’/afe/binary topic.

Below, you can find, how to configure the MQTT.fx client to use MQTT broker from the previous example.

  1. Create connection profile. Go to Extras/Edit Connection Profiles/. Set Profile Name and Broker address to “test.mosquitto.org”, Broker Port to 1883. Click OK to confirm.
  2. Connect to MQTT broker. Choose “test.mosquitto.org” from dropdown list and click Connect. Now you are connected.
  3. Subscribe to ‘deviceID’/afe/binary topic. Go to Subscribe tab, enter ‘deviceID’/afe/binary (replace ‘deviceID’ with your device ID) and click Subscribe.

Everything is ready to receive data. Turn EEG session ON in UI.

Post your comment

foc.us