This docs will help you integrate your Nb-IoT device mounting a BC66 by Quectel with IoT creators HTTP file download server.
The Quectel BC66 natively supports only TCP/IP protocol for reliable communication.
Being HTTP a text-based protocol running over TCP/IP, it can run on BC66 but some coding will be required on your host machine to handle http data out/incoming.
The BC66 supports two different so-called "access-mode(s)": direct and buffer.
In this mode, data are pushed from the modem to the host controller whenever they are available. This means that if the host controller, for whatever reason, can't keep up the pace of such data as soon as they arrive, they will be lost. If your controller is able to keep up the pace of the download, you can use this mode to download data, it should be easier then buffer access mode.
In this mode, data will be stored in modem's temporary buffer, and the host controller will have to explicitly request for them to be pushed from the buffer. Host will however have to request for data regurarly to avoid buffer being full and lose data. This mode can be useful if your controller is not able to keep up with the pace of the download, since having an additional buffer on the modem to rely on can help.
In buffer access mode, let the device close the connection socket, otherwise there is a very high chance of losing the last chunk of data because the socket will be closed by the server and the modem buffer will not be accessible anymore.
Before trying to initiate a file download, please be sure the modem is already attached to Deutsche Telekom APN as explained here https://docs.iotcreators.com/docs/_-quectel-bc66-t-be-dvk, complete all the steps through the section "Attach to Nb-IoT Network" and be sure your device successfully got an IP address from the network.
Always refer to the official technical documentation provided by Quectel in regards of the details concerning the TCP/IP native stack support included with BC66.
You can refer to this document in particular:
Since BC66 does not natively support HTTP, you will have to format the request string by yourself in your host controller.
A simple HTTP GET is made this way:
GET /<path> HTTP/1.1\r\nHost: <host>\r\n\r\n
So, for example, a HTTP GET string to host 188.8.131.52 (this is just a made up IP) with path /data will look like
GET /data HTTP/1.1\r\nHost: 184.108.40.206\r\n\r\n
It is very important not to forget CRLF (Carriage return, Line Feed, also generally represented with characters \r\n, ASCII values 0xD and 0xA) characters as shown in the example above, otherwise the string will be rejected from the server.
You can inspect and debug the Python software presented in the last section of this article for more details.
This diagram shows the software flow needed to download a file in direct access mode.
Some notes/hints about this access mode:
As also stated in the flow diagram, it is suggested to also issue command:
before starting to download.
This command is useful because it allows the host controller to see the bytes that are actually stored in the modem buffer after read. In this way, if buffer has still data to be read after having been read, you can immediately read it without waiting a backoff time (in the flow it is chosen a 100ms fixed backoff time) before attempting to read the data.
To demonstrate the capabilities of IoT Creators network and help you to integrate the file download into your products, there is a python software available for download.
NOTE: This software expects a Content-Length header in http response to work properly.
Also please enable echo before downloading with this tool.
You can find it here:
The code is well documented, you can find installation instructions in README.md file.
This software will also log the software flow and data passing over the serial line (they will be automatically placed in /logs folder that will be created by the application itself) that will help you understand what is happening on the communication line between host and BC66 modem.
Updated 5 months ago