Step 2 - Configure the Octopus

In this tutorial part you will make use of the Arduino IDE to prepare the sketch which will be flashed to the Octopus board.


Please make sure to use the released versions of the libraries,
as we encountered difficulties with some beta versions (e.g. of ArduinoJson).

Edit the file ${ArduinoDirectory}/libraries/pubsubclient/src/PubSubClient.h
and set the MQTT_MAX_PACKET_SIZE to 2048.

If you cannot find the file instantaneously, try to find the file in ${USERHOME}\Documents\Arduino\libraries\PubSubClient\src\PubSubClient.h

Find the Octopus com port

Attach the Octopus board to your development machine via USB cable.

In case you never used the board before, first of all try to find out on which COM port it communicates.


Check via Device Manager in Windows that a correct driver for COM port is installed.
If not, install a driver from ${ArduinoDirectory}/drivers

In Arduino select Tools > Port > the port of your device.
Then, open the Arduino serial monitor, which will later display what the device is sending.


Check via Device Manager in Windows that a correct driver for COM port is installed.
If not, install a driver from ${ArduinoDirectory}/drivers

Use our sketch for the Octopus to communicate to Bosch IoT Suite

Our examples at GitHub provide ready-to-use package

In your Arduino IDE open octopus-hub.ino.

Configure settings.h

In case a file called setting.h is not there, please create one in the save folder.

The configuration settings which you need to add there will be used at various stages:

  • A - Give your Octopus access to use your WiFI, thus it will get Internet access.

  • B - Once the Octopus is setup correctly it will send via WiFi data to Bosch IoT Hub (via MQTT)

  • C - At the Hub the Octopus will need to authenticate with the settings in section "Hub registration properties".

  • D - The payload which will be sent from Bosch IoT Hub to Bosch IoT Things (via AMQP1) needs to address the thing ID which you have per-registered in Step 1 - Register your Octopus with the cloud service.
    The full ID is composed of the namespace and the thing name.

  • E - The time in milliseconds how often the telemetry data should be sent is a setting addressed to the board itself

Complete the file settings.h with the content as shown in the pattern below.
Replace all brackets, but keep the quotation marks, e.g. "<your ID>" gets "myGuestWLAN"

#ifndef SETTINGS_H
#define SETTING_H
// --A-- WiFi configuration ----
#define WIFI_SSID "<your ID>" // The SSID of the WiFi you want your octopus board to connect to
#define WIFI_PASSWORD "<your PW>" // The password of the WiFi you want your octopus board to connect to
// --B-- Hub MQTT configuration ----
// Do not change this
#define MQTT_BROKER ""
#define MQTT_PORT 8883
// --C-- Hub registration properties ----
#define HUB_TENANT "<your-tenant-id>" // The tenant id of your hub instance
#define HUB_DEVICE_ID "<your-namespace>:<your-octopus-name>" // The id used at the device provisioning
#define HUB_DEVICE_AUTH_ID "<your-namespace>_<your-octopus-name>" // The auth id retrieved at the device provisioning
#define HUB_DEVICE_PASSWORD "your-secret" // The device password used a the device provisioning
// --D-- Things registration properties ----
#define THINGS_NAMESPACE "your-namespace" // The namespace you created in your solution
#define THING_NAME "your-octo-name" // the name used at the device provisioning
// --E-- Update rate of sensors ----
#define SENSOR_UPDATE_RATE_MS 5000 // Print updated sensor value every 5 seconds
#define LOOP_DELAY 100
//#define BME280 // uncomment this line if your board has a BME280 instead of BME680
extern const unsigned char mqtt_server_ca[];
extern const unsigned int mqtt_server_ca_len;

Verify the sketch and upload to the Octopus board

Use the Arduino tooling to verify that the project compiles. Otherwise fix the issues.

Use the Arduino tooling to flash the Octopus.

Upon success the Octopus LEDs should be blue and green .

Check your work

The Arduino serial monitor should show which data the board tries to send to the Bosch IoT Hub.