# Connect to remote cortex

This feature is only available since 2.7.1 release.

Following steps are the guideline to use the remote tool to work with Cortex running on Raspberry Pi 4

### Install Cortex on Pi

To install Cortex on Pi :

* ssh to Pi
* Download the file **emotivapps\_2.7.1.beta\_armhf.deb**
  * *Note: The version number of the file you downloaded can be different from the manual, however, the steps should be the same, you only need to change the version number in the command line.*
* Run the following command to install

```
$ sudo apt-get install ./emotivapps_2.7.1.beta_armhf.deb
```

After installing, you can check if `cortex` service is running with command

```
$ sudo systemctl status cortex
```

###

### Remote connect to Cortex running on Pi

* ssh to Pi and change directory to **/usr/local/emotivapps/bin**

```
$ cd /usr/local/emotivapps/bin
```

* Run following command to allow access from remote IP. More usage of `cortexaccess` tool can be found [here](https://emotiv.gitbook.io/cortex-api/cortexaccess-tool).

```
# cortexaccess ip accept ip_address_of_machine_which_does_remote_to_pi
# for example:
$ ./cortexaccess ip accept 192.168.1.11
```

* After allowing access, run the following command to confirm

```
$ ./cortexaccess ip list
```

* Find the IP address of your Pi device with command **ifconfig**, for example 192.168.1.21. Note that only IP addresses in a specific range are supported, otherwise you have to configure `hosts` file and use `emotiv-cortex.remote` DNS. [See the range of supported IP addresses and how to configure hosts files.](https://emotiv.gitbook.io/cortex-api/connecting-to-the-cortex-api#remote-connections)
* Put the above IP address (or `emotiv-cortex.remote` if the IP address is not supported) into the text box under the **Remote Connect** session
* Then click **Connect**

![](https://2586029750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MkFcNWlokB88bTVI27b%2Fuploads%2F2OwGXPTpjlxUdY0RbAtW%2Fconnect-to-remote-Cortex.png?alt=media\&token=5a29989f-699a-437d-a9b6-7ff105b71244)

### Connect headset

After Cortex is running on Pi and EMOTIVApp remotes to Pi successfully, user can connect a headset to Pi with Dongle or Bluetooth connection. Headsets will be showed up on the **Devices** tab.

**Note** with bluetooth connection, in case the headset connection is lost unexpectedly (even the headset is turned on), there may be an issue with `bluetooth` service, you should make sure this `bluetooth` service is running stable. Most of the time, you can troubleshoot by restarting `bluetooth` service first, then `cortex` service, using the following commands on Pi:

```
$ sudo systemctl restart bluetooth
$ sudo systemctl restart cortex
```

###

### Develop a remote application

In order to connect with Cortex running on Pi and develop an application, user must change url to Pi's IP address.

For example with python example, user should have following change in file

<https://github.com/Emotiv/cortex-v2-example/blob/master/python/cortex.py>

&#x20;

```
    def __init__(self, user, debug_mode=False):
        url = "wss://ip_address_of_PI:6868"
```

##
