Publish without gateway to MQTT bridge in Google Cloud Platform (GCP)


Devices send data to Google Cloud Platform by publishing to the Message Queue Telemetry Transport (MQTT) bridge in the Google Cloud Platform.

IoT Cloud Tester  application provides an easy interface publish data to the Google Cloud Platform (GCP).

To publish without gateway to MQTT bridge in GCP,

  • Add a device to the device registry in GCP
  • In the 'Publish' tab, get the list of devices in the given region/registry from GCP.
  • Select the topic.
  • Configure the MQTT server address and the port. Google's MQTT server address is mqtt.googleapis.com and the port is 8883.
  • Configure the Frequency - how often the device will publish the data and the Count - number of times the data will be published. Random data will be generated by the IoT Cloud Tester tool based on the data model associated with  the device.
  • Click the 'Pub/Sub Monitor' button to open the window to monitor the data published by the device.
  • Click on the 'Publish' button to start publishing data for the selected device(s). Note that the IoT Cloud Tester enables publishing by multiple devices at the same time.

In this below example, device 'dev_41799' is not bound to any gateway. The device establishes the connection to the MQTT bridge and publishes data directly without going through any gateway device.

The device is associated to the data model called 'device-data' which has temperature and humidity as the data fields. The IoT Cloud Tester application will generate random data to publish based on the constraints defined for the fields in the model.

The data will be published to 'device_environment' topic on the GCP. So any subscribers to that topic will receive the data published by the device.

The device will publish every 10 seconds (Frequency) for 5 times (Count).

The Pub/Sub monitor will show the data published by the devices.

The console window will the GCP API calls and associated logs for the IoT Cloud Tester tool.

To connect to Google MQTT server,

  • MQTT Client Id should be set to the below format - projects/projId/locations/cloudRegion/registries/regId/devices/deviceId
  •  JSON Web Token (JWT) is generated using device's private key and set as password for the MQTT connection. The user name for the MQTT connection is not used.