Quectel BC35-G configure network connection Alibaba Cloud MQTT to send data

hardware preparation

Prepare NBIOT
BC35-G ( BC26/BC28 is also applicable )
insert image description here
USB-TTL adapter
insert image description here

Wiring part

BC35-G USB-TTL
TX RX
RX TX
VCC 5V
GND GND
RESET GND

(Note: VCC is connected to 5V, connected to 3.3 is unstable, the RESET pin is temporarily suspended, and the module can be reset by short-circuiting GND )

software preparation

Serial debugging tool (I recommend Anxin) - download
insert image description here
QFlash4.17 burning tool is relatively stable (requires burning firmware download) - download
insert image description here
PS: After downloading the QFlash software, extract it to the root directory of the C drive, and run it (to prevent the Software error)
insert image description here
BC35G/BC26/BC28 and other AT command firmware containing MQTT
insert image description here
BC35GJBR01A04W ———————— BC35GJCR01A01
The firmware used in this blog is BC35GJBR01A04
Prepare the above required software, you can start burning the firmware

Burn firmware

When preparing to burn the firmware, first connect to the computer to test whether your BC35G has MQTT-AT command firmware

AT-QMTOPEN?

insert image description here
Return as shown (or return OK) without installing firmware

QFlash 4.17 burning

Determine the path:
insert image description hereRight-click the administrator and run it.
insert image description here
Note that the baud rate is 9600.
At the beginning of the programming, it will prompt Module Reset By Hand or Reset
insert image description here
. At this time, short the module Reset pin - to the GND of USBTTL ( remember to short it, that is Connect to GND and then quickly pull it out ) will continue to burn
insert image description here
. When DownLoad PASS appears , the burning is successful
insert image description here
. Open the serial debugging tool.
Set the port, the baud rate is 9600 , open the serial port, run mode, enter

AT-QMTOPEN?

Returning OK means that the MQTT command exists, and returning ERROR means failure
insert image description here

Alibaba Cloud is ready

Go to Alibaba Cloud's official website,
register, log in, go to the console ,
insert image description here
go to the public example
insert image description here
, create a product
insert image description here
, create a device
insert image description here
, go to the home page of the created device - DeviceSecret to view
insert image description here
Prepare these three codes , we will use them later

Test Preparation (AT Command)

Step 1: Check the network status:

AT+CGATT?

When it returns: OK +CGATT:1
insert image description here
, it means that the registration network is successful
. Step 2: Test whether the IP return is normal .

AT+CGPADDR

An IP address (random) will be returned, and the return is normal. If there is no return, there may be a network problem. Check the network status
insert image description here
of the card. If you are ready, you can start connecting to the Alibaba Cloud server.

Connect to Alibaba Cloud

Prepare the newly created device information
ProductKey
DeviceName
DeviceSecret
insert image description here
Step 1: Enter in the serial port debugging assistant:

AT+QMTCFG="ALIAUTH",0,"ProductKey","DeviceName","DeviceSecret"

Note: Replace your own three-code information , do not have spaces between characters
After input, it will return OK

Step 2: Connect to the server:

AT+QMTOPEN=0,"139.196.135.135",1883

It will return: +QMTOPEN: 0,0
insert image description here
If it returns +QMTOPEN: 0,0 means the connection is successful, other values ​​are returned, such as: +QMTOPEN: 0,1
insert image description here
means the connection fails , repeat the first and second steps, there is another In the case of only returning OK
insert image description here
, it means that your connection is continuing or has timed out . OK only means that the AT command was executed successfully. If there is no return value, it means that the connection failed or timed out. In this case , wait for a while to see if there is a return value . Reset the device and find an area with a good signal
insert image description here
( just I am anxious to send it continuously, and finally the connection failed because of the network delay. This connection requires 4G to have a good signal area, but in the end it still returns 0, 1 or the connection fails )

The choice of the second server

The first address:

AT+QMTOPEN=0,"139.196.135.135",1883

The second address: //Shanghai server

AT+QMTOPEN=0,"iot-as-mqtt.cn-shanghai.aliyuncs.com",1883

insert image description here
Switch the server of your device, and pay attention to changing the address information after switching, such as:

AT+QMTOPEN=0,"iot-as-mqtt.国家-地区.aliyuncs.com",1883

Step 3: Connect to the Product Server

AT+QMTCONN=0,"DeviceName"

Return: OK +QMTCONN: 0,0,0 if it
insert image description here
returns other values ​​successfully or fails , repeat the first step, the second step
The complete connection situation is shown in the following figure:
insert image description here

Check the connection

After completing the above steps, go back to the Alibaba Cloud webpage and refresh to check whether the device is online:
insert image description here
insert image description here
the device is online successfully! ! !
Good luck! ! !

In the next article, I will explain how to use NBIOT BC35/26/28 to send and receive data and cooperate with Arduino to upload data
insert image description here

Guess you like

Origin blog.csdn.net/weixin_50679163/article/details/119736230