# Adding a SparkPlug MQTT Connection

You can add a SparkPlug MQTT connection by clicking `+` next to **Connections** in the sidebar:

![](https://1557066017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSPy42kVbNL57hubF20gF%2Fuploads%2Fgit-blob-164737aff06c3dc2c976768130af4576dde22269%2Flocalhost_50000_settings_import%20\(2\).png?alt=media)

In the **Create Connection** page that appears, enter the **Name** for your connection:

![](https://1557066017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSPy42kVbNL57hubF20gF%2Fuploads%2Fgit-blob-e27ceedcabed82b8e60f40536faf0eb3365ba8a5%2Flocalhost_50000_network%20\(7\).png?alt=media)

Then select the **MQTT SparkPlug** protocol:

![](https://1557066017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSPy42kVbNL57hubF20gF%2Fuploads%2Fgit-blob-072015ea955ba16251574c4587cf3685d2811615%2Flocalhost_50000_network%20\(8\).png?alt=media)

Fields will appear below. Enter the **Server URL**, **Username**, and **Password** of the MQTT server to connect to:

![](https://1557066017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSPy42kVbNL57hubF20gF%2Fuploads%2Fgit-blob-d929727bfea29158bbba3d957227be1af7384057%2Flocalhost_50000_network%20\(9\).png?alt=media)

Then enter the **Group ID** and **Node ID** you would like to use for the Iron Pi (or other device running Clarity Gateway):

![](https://1557066017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSPy42kVbNL57hubF20gF%2Fuploads%2Fgit-blob-7d8000ef20d6d212f13fe7cb77955f01d0d4f8f9%2Flocalhost_50000_network%20\(10\).png?alt=media)

Finally, click **Save**:

![](https://1557066017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSPy42kVbNL57hubF20gF%2Fuploads%2Fgit-blob-bb61deea20bf7fc9426325717fbc92b0c644cb78%2Flocalhost_50000_network%20\(11\).png?alt=media)

Once the connection has been created, you will see the following page. The status bar at the top will indicate if Clarity Gateway is connecting to the server, has connected, or failed to connect:

![](https://1557066017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSPy42kVbNL57hubF20gF%2Fuploads%2Fgit-blob-b31dcf2a911484ada2f431ff3ae26105f1e40401%2Flocalhost_50000_network%20\(12\).png?alt=media)

To return to your connection settings from another page, click its name in the **MQTT** section of the sidebar:

![](https://1557066017-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSPy42kVbNL57hubF20gF%2Fuploads%2Fgit-blob-615b2716eb8f88b43fa301e2094db443710b06b1%2Flocalhost_50000_network%20\(13\).png?alt=media)
