How to Control a Remote GSM MQTT Device Using a Mobile App

How to Control a Remote GSM MQTT Device Using a Mobile App

This guide walks you through controlling a remote IoT device equipped with a GSM-based MQTT module (e.g., A7670C, SIM800L, SIM900A) using your mobile phone via HiveMQ Cloud.

Use this if:

  • You want to prototype remote control via MQTT using cellular modules.

  • You are using a mobile app (like MQTT Dash or IoT MQTT Panel) to publish control commands.

Instructions


Prerequisites

Component

Description

Component

Description

GSM module

A7670C, SIM800L, SIM900, or equivalent

SIM card

With active data service

MQTT Broker

HiveMQ Cloud Free Plan

Mobile App

MQTT Dash, IoT MQTT Panel, or similar

Credentials

Broker hostname, port, username, password


Step 1: Set Up HiveMQ Cloud

  1. Create a free account at HiveMQ Cloud.

  2. Create a new MQTT cluster.

  3. Note the following parameters:

    • Hostname

    • Port: 8883 (TLS)

    • Username and password

TLS is required for the free plan.


Step 2: Configure GSM Module to Connect to MQTT Broker

Example setup for A7670C (adapt as needed for your hardware):

AT+CGATT=1 AT+CGDCONT=1,"IP","your.apn.com" AT+NETOPEN AT+IPADDR AT+MQTTUSERCFG=0,1,"client_id","username","password",0,0,"" AT+MQTTCONN=0,"<broker.hivemq.cloud>",8883,1 AT+MQTTSUB=0,"/device/control",1

Ensure that the firmware supports MQTT over TLS.


Step 3: Configure Mobile App to Send Commands

Use MQTT Dash or IoT MQTT Panel.

  1. Create a new MQTT connection:

    • Host: your HiveMQ Cloud hostname

    • Port: 8883

    • TLS: enabled

    • Username and password: from HiveMQ Cloud

  2. Add a button widget:

    • Topic: /device/control

    • Payload: ON or OFF

Pressing the button will send the corresponding command to the GSM MQTT device.


Troubleshooting

Issue

Recommendation

Issue

Recommendation

No response from device

Confirm topic names match exactly between mobile and device

Connection failure

Check SIM card, APN, broker hostname, port, and credentials

GSM module does not support TLS

Consider using a broker that allows non-TLS connections for testing only


Related articles