Prepare Pico LTE configuration file

Create config.json on the Pico LTE and fill in the connection parameters of the SDK applications and modules: AWS IoT, Azure IoT Hub, Slack, Telegram, ThingSpeak, HTTPS and MQTTS.

Each application module of the SDK reads its connection parameters from config.json, in the root of the board’s file system. One file holds the parameters of all the applications you use.

Create file

  1. Create new file on board.

    In Thonny, right-click an empty area of the Raspberry Pi Pico files panel and choose New file.

  2. Name it config.json and save it.

    Enter config.json as the name, then save it (Ctrl+S, or Cmd+S on macOS).

  3. Check file.

    config.json is in the root of the board, next to pico_lte.

Replace each placeholder, brackets included: "[YOUR_DEVICE_ID]" becomes "my-device".

Applications

AWS IoT Core

Keep mqtts or https, whichever protocol you use, and delete the other.

{
    "aws": {
        "mqtts": {
            "host": "[YOUR_AWSIOT_ENDPOINT]",
            "port": "[YOUR_AWSIOT_MQTT_PORT]",
            "pub_topic": "[YOUR_MQTT_TOPIC]",
            "sub_topics": [
                "[YOUR_MQTT_TOPIC/1]",
                "[YOUR_MQTT_TOPIC/2]"
            ]
        },

        "https": {
            "endpoint": "[YOUR_AWS_IOT_ENDPOINT]",
            "topic": "[YOUR_DEVICE_TOPIC]"
        }
    }
}

Azure IoT Hub

The hub name and the device ID are enough:

{
    "azure": {
        "hub_name": "[YOUR_IOT_HUB_NAME]",
        "device_id": "[YOUR_DEVICE_ID]"
    }
}

For more control, add MQTTS parameters; each is optional:

{
    "azure": {
        "hub_name": "[YOUR_IOT_HUB_NAME]",
        "device_id": "[YOUR_DEVICE_ID]",
        "mqtts": {
            "host": "[YOUR_MQTT_HOST]",
            "port": "[YOUR_MQTT_PORT]",
            "pub_topic": "[YOUR_MQTT_PUB_TOPIC]",
            "sub_topics": [
                ["[YOUR_MQTT_TOPIC/1]", [QOS]],
                ["[YOUR_MQTT_TOPIC/2]", [QOS]]
            ],
            "username": "[YOUR_MQTT_USERNAME]",
            "password": "[YOUR_MQTT_PASSWORD]"
        }
    }
}

Slack

An incoming webhook URL is all Slack needs:

{
    "slack": {
        "webhook_url": "[INCOMING_WEBHOOK_URL]"
    }
}

Telegram

{
    "telegram": {
        "token": "[YOUR_BOT_TOKEN_ID]",
        "chat_id": "[YOUR_GROUP_CHAT_ID]"
    }
}

If the Telegram Bot API address changes, add it as server:

{
    "telegram": {
        "server": "[TELEGRAM_BOT_API_ENDPOINT]",
        "token": "[YOUR_BOT_TOKEN_ID]",
        "chat_id": "[YOUR_GROUP_CHAT_ID]"
    }
}

ThingSpeak

With these parameters, the board subscribes and publishes to all fields of the channel:

{
    "thingspeak": {
        "channel_id": "[YOUR_CHANNEL_ID]",
        "mqtts": {
            "client_id": "[DEVICE_MQTT_CLIENT_ID]",
            "username": "[DEVICE_MQTT_USERNAME]",
            "password": "[DEVICE_MQTT_PASSWORD]"
        }
    }
}

To choose the fields, add the topics; host and port change the server:

{
    "thingspeak": {
        "channel_id": "[YOUR_CHANNEL_ID]",
        "mqtts": {
            "host": "[THINGSPEAK_HOST_ADDRESS]",
            "port": "[THINGSPEAK_PORT_ADDRESS]",
            "client_id": "[DEVICE_MQTT_CLIENT_ID]",
            "username": "[DEVICE_MQTT_USERNAME]",
            "password": "[DEVICE_MQTT_PASSWORD]",
            "sub_topics": [
                ["[YOUR_MQTT_TOPIC]", [QOS]]
            ],
            "pub_topic": "[YOUR_MQTT_TOPIC]"
        }
    }
}

Modules

Where no application exists for a service, build your own solution on the HTTPS and MQTTS modules.

HTTPS

{
    "https": {
        "server": "[HTTP_SERVER]",
        "username": "[YOUR_HTTP_USERNAME]",
        "password": "[YOUR_HTTP_PASSWORD]"
    }
}

MQTTS

{
    "mqtts": {
        "host": "[YOUR_MQTT_HOST]",
        "port": "[YOUR_MQTT_PORT]",
        "pub_topic": "[YOUR_MQTT_PUB_TOPIC]",
        "sub_topics": [
            ["[YOUR_MQTT_TOPIC/1]", [QOS]],
            ["[YOUR_MQTT_TOPIC/2]", [QOS]]
        ],
        "username": "[YOUR_MQTT_USERNAME]",
        "password": "[YOUR_MQTT_PASSWORD]"
    }
}

Your own application module

A new application module keeps the same structure: its own attributes, then an mqtts or https section, or both. Remove the parameters it does not use. See the contributing guidelines of the SDK.

{
   "your_own_app": {
       [application_specific_attributes],
       // If the connection uses MQTTS:
       "mqtts": {
           "host": "",
           "port": "",
           "pub_topic": "",
           "sub_topics": [
               ["", [QOS]],
               ["", [QOS]]
           ],
           "username": "",
           "password": ""
       },
       // If the connection uses HTTPS:
       "https": {
           "server": "",
           "username": "",
           "password": ""
       }
   }
}