メニュー

Expand
ページを評価:

Works with Super SIM: Quectel BG95

The Quectel BG95 series of multi-mode LPWA modules support the IoT-oriented LTE Cat M1 and NB-IoT 3GPP cellular standards, along with GSM/EDGE/GPRS for backwards compatibility. They also feature integrated GNSS for location-aware applications. The BG95 is often used as a drop-in replacement for the popular BG96 module.

Super SIM does not support NB-IoT, but it does deliver full LTE Cat M1 connectivity for the BG95.

Learn more about the BG95 on the Quectel website.

Get started with BG95 and Super SIM

The best way to begin working with the BG95 is to take advantage of Quectel’s UMTS & LTE EVB developer kit. It features powerful and easy‐to‐use tools in an environment specifically designed for the development and testing of cellular and GNSS applications based on any of a variety of Quectel modems, including the BG95. Just clip on a test board featuring the modem you’re using. The one you need for this guide is the BG95-TE-A test board. It’s available separately. The kit can be connected to and used with a Windows 10, Linux or macOS computer.

Quectel’s UMTS and LTE EVB developer kit features easy‐to‐use tools designed for the development of cellular applications

The EVB and the separate test board can be purchased from the following suppliers:

EVB

Mouser
Digikey

BG95-M3-TE-A

Mouser
Digikey

Working with the EVB and BG95 requires a configured Super SIM. If you haven’t set up your Super SIM in the Console, please do so now. The Super SIM First Steps guide has help if you need it.

1. Connect the EVB to your computer

  1. Slot a Super SIM into the board’s SIM holder. It takes a standard mini-sized SIM, or a micro- or nano-SIM first fitted into an adapter:
    Fit a full-size SIM into the EVB's SIM slot
  2. Fit the BG95 test board to the top of the EVB, clipping it to the two connectors in the middle of the EVB. You can place it correctly by aligning the metal panel on the underside of the test board with the four arrows printed on the EVB:
    Align the test card's metal shield with the arrows printed on the EVB
  3. Connect one of the larger bundled antennas to the test board’s uFL connector, marked MAIN J301. You will need one of the supplied whip adapters to join board and antenna:
    Fit the whip antenna adapter to the test card connector marked main
  4. Connect the EVB to your computer with the supplied RS232-USB cable. Connect the cable to the EVB’s COM (MAIN) connector:
    Clip the chunk RS232 cable to the EVB. The other end fits into a USB port on your computer
  5. Connect the EVB to a suitable power source, such as a USB AC adapter, and then turn on the EVB by sliding the POWER switch to the position marked ON on the board:
    Connect the EVB's micro USB connector to a five volt AC adapter and push the power switch
  6. Press the PWRKEY button once to enable the modem test board:
    Press the button marked PWRKEY to power up the modem

At this point the board’s POWER and STATUS LEDs should be lit, and the NET_STA LED should be flashing:

Confirm the power, status and net sta LEDs are lit

  1. Open your distribution’s terminal app.
  2. Confirm connection with ls /dev/ttyUSB* — you should see a single device listed: /dev/ttyUSB0. This is the USB-to-serial device you’ll use to communicate with the EVB.
  3. Using a serial tool like minicom — you will have to install this separately from source or a package manager like apt — access the board with minicom -o -D /dev/ttyUSB0.
  1. Open the Terminal app.
  2. Confirm connection with ls /dev/cu* — you should see one device listed /dev/cu.usbserial-14140. This is the USB-to-serial device you’ll use to communicate with the EVB.
  3. Using a serial tool like minicom — you will have to install this separately from source or a package manager like Homebrew — access the board with minicom -o -D /dev/cu.usbserial-14140.
  1. Windows 10’s Device Manager will show the EVK-R5 as two USB Serial Ports in the Ports (COM & LPT) section. Try each one in turn, the lowest number first. Note its port’s COM number:
    u-blox EVK-R5 developer kit -- windows setup -- device manager
  2. Right-click on the Pico’s entry in the Device Manager list and select Properties.... Select the Port Settings tab and note the Bits per second: value:
    u-blox EVK-R5 developer kit -- windows setup -- port properties
  3. Download and install PuTTY a terminal emulator for Windows.
  4. Run PuTTY, select Serial under the Connection type, and enter the COM number (as, for example, COM5) in the Serial line field. Make sure the Speed field is set to match the Bits per second: value you got from Device Manager:
    u-blox EVK-R5 developer kit -- windows setup -- putty
  5. Click Open.
  6. When you see references to Minicom in the remainder of the tutorial, perform the tasks using your open PuTTY window.

3. Check your current carrier

Within minicom or PuTTY, enter the AT command AT+COPS? to see which carrier your BG95 is connected through:

Check the connected carrier

Useful AT commands

Initialization

The BG95 supports LTE Cat-M1 in bands 1-5, 8, 12-13, 18-20, 25-27, 28, 31, 66, 72-73, 85, 87-88, and GSM at 850, 900, 1800, and 1900MHz. It also supports NB-IoT. Super SIM does not support NB-IoT, so it’s important to ensure that your BG95 is set to operate using Cat-M1 only. Prefer single-mode Cat-M1 to dual-mode Cat-M1/NB-IoT to ensure that the modem never attempts to connect to NB-IoT.

To set the BG95’s chosen Radio Access Technology (RAT) to Cat-M1, use the Quectel-specific command:

AT+QCFG="iotopmode",0

The numeric parameter of the command, 0, indicates Cat-M1 only.

If you wish to limit communications to LTE only, i.e., to disable 2G (GSM), issue this command:

AT+QCFG="nwscanmode",3

Finally, to instruct the modem to initiate data-centric attachments only — ie., not to make voice-oriented circuit-switched attachments too, which is the default — issue:

AT+QCFG="servicedomain",1

All these settings will be applied immediately.

Set the APN

Issue this AT command first to apply the Super SIM Access Point Name (APN):

AT+CGDCONT=1,"IP","super"

By default, the BG95 will roam automatically, but you can confirm this by issuing:

AT+QCFG="roamservice",2

These settings will be applied immediately.

Establish a data connection

Having set the modem’s APN, establish a Packet Data Protocol (PDP) context with the following command:

AT+QIACT=1

The single parameter is the PDP context’s ID, in the range 1-16. It should match the first parameter in the above CGDCONT command.

You can also issue AT+QIACT?, the command’s read form, to get the device’s data-connection state — and IP address, if the context is active:

AT+QIACT?
+QIACT: 1,1,1,"100.74.24.186"

The first numeric parameter is the context ID. The second is its state — 1 indicates it is active — and the third is its type: 1 for IPV4 or 2 for IPV6.

Perform a ping

Issue the Quectel-specific command

AT+QPING=1,"<TARGET_IP_ADDRESS_OR_NAME>" 

to ping a server. Using one of Google’s DNS servers as an example, this will yield:

+QPING: 0,"8.8.8.8",32,1410,255
+QPING: 0,"8.8.8.8",32,236,255
+QPING: 0,"8.8.8.8",32,210,255
+QPING: 0,"8.8.8.8",32,233,255
+QPING: 0,4,4,0,210,1410,522

Perform an HTTP GET

To issue an HTTP GET request using the BG95’s built-in HTTP client, run the following commands:

  1. Set the PDP context ID: AT+QHTTPCFG="contextid",1
  2. Enable output of HTTP response headers: AT+QHTTPCFG="responseheader",1
  3. Activate the PDP context if it is not already active: AT+QIACT=1
  4. Set the target URL: AT+QHTTPURL=21
    This sets the modem to receive, prompted by the output CONNECT. The first parameter is the number of bytes the modem should expect to receive: it will end input after receiving this number of characters. The value of 21 comes from the URL below. The URL you provide must include the protocol, i.e., http://.
  5. Upon receiving CONNECT, enter the URL. For example: http://ifconfig.co/ip
  6. Make a GET request: AT+QHTTPGET
  7. View the request: AT+QHTTPREAD

The request will look like this:

HTTP/1.1 200 OK
Date: Sat, 28 Nov 2020 18:38:52 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 15
Connection: keep-alive
Set-Cookie: __cfduid=d33c30006be23245591d83133631425031606588732; expires=Mon, 28-Dec-20 18:38:52 GMT; path=/; domain=.ifconfig.co; HttpOnly; SameSite=Lax
Strict-Transport-Security: max-age=15768000; includeSubdomains; preload
CF-Cache-Status: DYNAMIC
cf-request-id: 06b1bfaa91000025ed8fa46000000001
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report?s=8eYWG5vobibOeI8xWFxNSGJpELSCSthW9aAclBXw3esKOGBsYPT4izdckGI2kpOW%2BA7KOhi3OFk%2FLUab3RpQvKu5EYYWLD%2B2fSxV4Q%3D%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 5f96355748c225ed-IAD

99.84.181.20

OK
+QHTTPREAD: 0

This example uses a service that returns the IP address of the requester.

Custom HTTP request headers

If you need to provide extra HTTP request headers, such Authorization: Basic <API_KEY>, or a custom header required by your server, issue

AT+QHTTPCFG="requestheader",1

to tell the modem to use the custom header that you will provide when you make each request. You will need to add a full HTTP request header to your request body, separating the two parts with the characters <CR><LF>. Whether you make a POST or a GET request, include a byte-count parameter that totals the header plus the body (POST request) or header alone (GET request). For example, AT+QHTTPGET=60,512 for a 512-byte header (including the end-of-header <CR><LF>). The first parameter, 60, is a timeout. This usually defaults to 60 seconds but must be included if a second parameter is also present. The modem uses the supplied byte count to read that number of characters via the UART over which your application is communicating with it.

Perform an HTTPS GET

To issue a secure HTTP GET request using the BG95’s built-in HTTP client, you follow the same procedure outlined above but with some extra steps included to configure SSL.

  1. Set the PDP context ID: AT+QHTTPCFG="contextid",1
  2. Enable output of HTTP response headers: AT+QHTTPCFG="responseheader",1
  3. Activate the PDP context if it is not already active: AT+QIACT=1
  4. Select the SSL context ID for this PDP context ID: AT+QHTTPCFG="sslctxid",1
  5. Set the SSL version. Choose TLS 1.2: AT+QSSLCFG="sslversion",1,3
  6. Set the SSL cipher suite. Choose all types: AT+QSSLCFG="ciphersuite",1,0xFFFF
  7. For testing, set the SSL verification level to 0, so no CA certificate is required: AT+QSSLCFG="seclevel",0
  8. Set the target URL: AT+QHTTPURL=70
    This sets the modem to receive, prompted by the output CONNECT. The parameter is the number of bytes the modem should expect to receive: it will end input after receiving this number of characters. The value of 70 comes from the URL below. The URL you provide must include the protocol, i.e., https://.
  9. Upon receiving CONNECT, enter the URL. For example: https://twilio-cms-prod.s3.amazonaws.com/documents/super-sim-test.json
  10. Make a GET request: AT+QHTTPGET
  11. View the response: AT+QHTTPREAD

The request will look something like this:

HTTP/1.1 200 OK
Date: Thu, 19 May 2022 10:23:25 GMT
Last-Modified: Thu, 19 May 2022 10:05:25 GMT
Accept-Ranges: bytes
Content-Type: application/json
Server: AmazonS3
Content-Length: 128

{
   "userId": 1,
   "id": 5,
   "title": "laboriosam mollitia et enim quasi adipisci quia provident illum",
   "completed": false                                                                                                                         }
OK

+QHTTPREAD: 0

Perform an HTTP(S) POST

Sending data from the modem to an Internet-hosted API follows the paths outlined above for the HTTP and HTTPS protocols. The key difference is that you call AT+QHTTPOST instead of AT+QHTTPGET.

Optionally, the QHTTPOST command takes a parameter indicating the amount of data you are sending. The modem uses this to read that number of bytes via the UART over which your application is communicating with it — just as it does with the QHTTPURL command we used earlier. If you are providing a custom HTTP request header, remember to include its length too.

Use low-power modes

While the BG95 supports low-power modes for eDRX and PSM, support for these features will vary by visited network and location. The commands to enable each of these settings on the BG95 are, respectively:

AT+CEDRXS=1
AT+CPSMS=1

Both settings, but especially PSM, can prevent the modem from being accessible through the terminal during its sleep time. It’s best to experiment with these features with the modem local. To disable all power saving if needed, send:

AT+CEDRXS=0
AT+CPSMS=0

Reach out for more information

Keen to find out more about how the Quectel BG95 family of cellular modules can power your IoT product design? Contact Quectel sales to line up a conversation.

And don’t forget, we’re always ready to discuss how Super SIM can help you too.

Additional resources

Twilio resources

Get Started with Super SIM
Super SIM global network partners
The Cellular Module Knowledgebase

Quectel resources

BG95 Data Sheet
BG95 AT Commands Manual Quectel login required
BG95 TCP/IP Application Note Quectel login required
BG95 SSL Application Note Quectel login required
BG95 HTTP Application Note Quectel login required

ページを評価:

ヘルプが必要ですか?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

フィードバックくださりありがとうございます!

Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!

Refer us and get $10 in 3 simple steps!

ステップ1

Get link

Get a free personal referral link here

ステップ2:

Give $10

Your user signs up and upgrade using link

ステップ3

Get $10

1,250 free SMSes
OR 1,000 free voice mins
OR 12,000 chats
OR more