Quectel BC35/BC26/BC28 configure network connection Alibaba Cloud MQTT to send data (1) Fine. Anti-stepping pit
hardware preparation
Prepare NBIOT
BC35-G ( BC26/BC28 is also applicable )
USB-TTL adapter
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
QFlash4.17 burning tool is relatively stable (requires burning firmware download) - download
PS: After downloading the QFlash software, extract it to the root directory of the C drive, and run it (to prevent the Software error)
BC35G/BC26/BC28 and other AT command firmware containing MQTT
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?
Return as shown (or return OK) without installing firmware
QFlash 4.17 burning
Determine the path:
Right-click the administrator and run it.
Note that the baud rate is 9600.
At the beginning of the programming, it will prompt Module Reset By Hand or Reset
. 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
. When DownLoad PASS appears , the burning is successful
. 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
Alibaba Cloud is ready
Go to Alibaba Cloud's official website,
register, log in, go to the console ,
go to the public example
, create a product
, create a device
, go to the home page of the created device - DeviceSecret to view
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
, 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
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
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
If it returns +QMTOPEN: 0,0 means the connection is successful, other values are returned, such as: +QMTOPEN: 0,1
means the connection fails , repeat the first and second steps, there is another In the case of only returning OK
, 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
( 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
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
returns other values successfully or fails , repeat the first step, the second step
The complete connection situation is shown in the following figure:
Check the connection
After completing the above steps, go back to the Alibaba Cloud webpage and refresh to check whether the device is online:
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