WaveshareCloud Wiki Help

SIM7028 NB-IoT HAT Integration

Preparations

Hardware Preparation

  1. Prepare a Waveshare SIM7028 NB-IoT HAT

SIM7028 NB-IoT HAT
  1. Connect the antenna, NB card, ensure that the jumper cap is connected to side A, and connect it to a Windows computer. Test the connectivity using a serial port debugging assistant.

Connection

Login to WaveshareCloud to Obtain Parameters

  1. Open the Waveshare Cloud official website, go to Devices | Attribute List, and add the SIM7028 NB-IoT HAT template device through One-Click Add Device.

  2. Click the yellow button on the right side of the device in the device list View Address to obtain the parameters.

Obtained parameters:

  • MqttPath: mqtt.waveshare.cloud

  • Port: 1883

  • Client ID: 7d7a94c2

  • Pub Topic: Pub/10/14/7d7a94c2

  • Sub Topic: Sub/10/14/7d7a94c2

Example Video:

Sending Commands Using Serial Port

Command Set

Response

Continue Input?

Input Value

Description

AT+CSQ

+CSQ: 26,0

No

——

Query network quality; when returning +CSQ: 99,99, check the antenna and SIM card status.

AT+CMQTTSTART

+CMQTTSTART: 0

No

——

Enable MQTT functionality

AT+CMQTTACCQ=0,"7d7a94c2",0

OK

No

——

Set Client ID 7d7a94c2 as the Client ID obtained from the platform; the last digit 0 indicates the use of the mqtt protocol (non-ssl).

AT+CMQTTCONNECT=0, tcp://mqtt.waveshare.cloud: 1883,20,1

+CMQTTCONNECT: 0,0

No

——

Connect to the MQTT server; return value 0,0 indicates successful connection.

AT+CMQTTTOPIC=0,18

>

Icon available

Pub/10/14/7d7a94c2

Enter the publish topic; 18 is the length of the topic.

AT+CMQTTSUB=0,18,1

>

Icon available

Sub/10/14/7d7a94c2

Enter the subscribe topic; 18 is the length of the topic.

AT+CMQTTPAYLOAD=0,41

>

Icon available

{"message":"This is SIM7028 NB-IoT HAT!"}

Enter the message body

AT+CMQTTPUB=0,1,60

+CMQTTPUB: 0,0

No

——

Send the message

Command Set

Response

Continue Input?

Input Value

Description

AT+CSQ

+CSQ: 26,0

No

——

Query network quality; when returning +CSQ: 99,99, check the antenna and SIM card status.

AT+CMQTTSTART

+CMQTTSTART: 0

No

——

Enable MQTT functionality

AT+CMQTTACCQ=0,"7d7a94c2",1

OK

No

——

Set Client ID 7d7a94c2 as the Client ID obtained from the platform; the last digit 1 indicates the use of mqtts protocol (ssl).

AT+CMQTTCONNECT=0, tcp://mqtt.waveshare.cloud: 8883,20,1

+CMQTTCONNECT: 0,0

No

——

Connect to the MQTT server; return value 0,0 indicates successful connection.

AT+CMQTTTOPIC=0,18

>

Icon available

Pub/10/14/7d7a94c2

Enter the publish topic; 18 is the length of the topic.

AT+CMQTTSUB=0,18,1

>

Icon available

Sub/10/14/7d7a94c2

Enter the subscribe topic; 18 is the length of the topic.

AT+CMQTTPAYLOAD=0,41

>

Icon available

{"message":"This is SIM7028 NB-IoT HAT!"}

Enter the message body

AT+CMQTTPUB=0,1,60

+CMQTTPUB: 0,0

No

——

Send the message

Command Set

Response

Continue Input?

Input Value

Description

AT+CSQ

+CSQ: 26,0

No

——

Query network quality. When returns +CSQ: 99,99, check the antenna and SIM card status.

AT+CSSLCFG="authmode",0,2

OK

No

——

Set certificate mode.

AT+CSSLCFG="cacert",0, "rootCA.crt"

OK

No

——

Specify CA certificate.

AT+CSSLCFG="clientcert",0, "server.crt"

OK

No

——

Specify device certificate.

AT+CSSLCFG="clientkey",0, "server.key"

OK

No

——

Specify device key.

AT+CMQTTSTART

+CMQTTSTART: 0

No

——

Enable MQTT functionality.

AT+CMQTTACCQ=0,"7d7a94c2",1

OK

No

——

Set Client ID. 7d7a94c2 represents the Client ID obtained from the platform, and the last digit 1 represents the use of the mqtts protocol (SSL).

AT+CMQTTCONNECT=0, tcp://mqtt.waveshare.cloud: 8884,20,1

+CMQTTCONNECT: 0,0

No

——

Connect to the MQTT server. Return value 0,0 indicates successful connection.

AT+CMQTTTOPIC=0,18

>

Icon available

Pub/10/14/7d7a94c2

Enter the publishing topic. 18 is the topic length.

AT+CMQTTSUB=0,18,1

>

Icon available

Sub/10/14/7d7a94c2

Enter the subscribing topic. 18 is the topic length.

AT+CMQTTPAYLOAD=0,41

>

Icon available

{"message":"This is SIM7028 NB-IoT HAT!"}

Enter the message body.

AT+CMQTTPUB=0,1,60

+CMQTTPUB: 0,0

No

——

Send the message.

View Online Communication Information on WaveshareCloud

  1. Open the Online Debugging page and select the created device for communication testing.

Online Debugging

Example Video:

Last modified: 12 一月 2024