メニュー

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Programmable Wireless: Narrowband IoT Machine to Machine Commands Quickstart

I've gathered the hardware - now I need to register my Narrowband SIM

Sign up for a Twilio account and set up the Twilio Narrowband SIM

Before you can connect with Twilio Programmable Wireless, you'll need a Twilio account.

First, visit the Programmable Wireless Console and visit the Register a SIM page in the Programmable Wireless Console.

Remove the Twilio Narrowband SIM from the Developer Kit.

qxu2ADEjgA2TGNQ9CJBcK4jLgS8MBD5fHQgDZPvQB0IBXvWSJSi8OU2mglo5Bl6YSKqF_esi3-BkwlNXBwsuAYW71GlmSvNZE9fK17nUViM5eTzRCv4UW7ogxbCOSyHBlfBM3ftp

Next, register and activate your Narrowband SIM in the Twilio Console. The process for the Narrowband SIM follows the same procedure as the Twilio Programmable Wireless SIM.

NarrowBandSIM-Registration-Code.png

Follow that up by picking a Unique Name for the SIM.

NarrowBandSIM-Unique-Name.png

Choose a Rate Plan

Next, select a Rate Plan from the options provided by Twilio.

NarrowBandSIM-Rate-Plan.png

By default, there are Rate Plans added which approximate the usage Twilio sees in the field. Rate Plans let you control every aspect of what your device can do its maximum monthly data usage. We've added some reasonable defaults, but feel free to explore options later.

Activate a SIM card

When you're happy with the Rate Plan, 'Activate' the SIM card.

Note: You'll need to activate your SIM for real-world workflows although you can use small amounts of data without activating.

NarrowBandSIM-Activate.png

I'm active! Let's plug things in and get ready to connect.

Connecting the pieces

Break out the Nano SIM (smallest size) from the Twilio SIM card.

Remove the development board from the Developer Kit.

l5yiKdfcgWL3ajls_a49uiMq6VIlhoQw5fbA-ahkJnqE101t6TlnO09O_46rmRAn5pOO3sueTDvhX3V_Jr-e4xikqSFXHKo1V2wyHqae1qNG1rE3aHGmOA_MBE1aZtccvJGzVcbi

Insert the Twilio Narrowband SIM into the SIM slot underneath the board.

TVbm4rdGhh_W9WkEuHh9LU-ceeWNwq9WhC-ysepygq9iIgtP_X9iaLbG6tMXhT11xgcXLWxjPkvRmjCyx752sDfjSbmRU34nM2by2-MKqAeJZmYzD1M1o1Ju8HFzLATCteQVrsLs

Next, attach the LTE antenna to the board.

-WB_WEuLQN6amL72jkIy3slW-BgtQmKdf8CYQCzHTCD1bOtXmY1CIwayOSuMX2FG_nRZ-qo0kxDnaKZ_Wz-G2pChq_xxkYBOeNui2wItonhX3HN3pi3gEbfgw0CwCfoOF70PPq3c

Attach the battery lithium battery. The lithium battery is recommended to be plugged in at all times.

encgq8NeouXiFagAB-of7QoatAIlOd3mdUpGOA6sR6m_YhHjNzTz5zLLcXgoagmMKcmO1OL9oe0SNWAbGAw0ZOt_y-rvgYBcoLe1oizDxD1jNaWAGAhmKIwmrlq6jWwg9l9PHwkS

Connect the development board to the computer using the Micro-USB cable provided.

Time to configure the firmware and learn about the software environment.

Configure the NB-IoT Kit Firmware

Install Homebrew for the Macintosh.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)

Once the installation is complete install the dfu-util package. Version 0.9 or greater is preferred if available.

brew install dfu-util libusb

Instructions for installing dfu-util for Windows and Linux can be found here.

Set up the software environment

Download the Breakout_Arduino_Library.zip from GitHub.

rEM2xT-EuzpDWHNRjNFmXBQBFtBowbvzbwkw3fbWHmX1NFWY-cZVqQ39gS-kSTyH4gMdhECCnvWXY8k5wPMl-hSepJ41C7A_r4N5JZcqO8TjGrE0EFyt3A6YhL7CvNo81dihP49l

Open the Arduino IDE and add the .zip to the Arduino IDE Library using Add .ZIP Library.

Go to Sketch > Include Library > Add .ZIP library and select the Breakout_Arduino_Library.zip.

mEBwPI2Aka_d1NCYKEAXkL74xc7c0h5C9PJoosU5PZHKMMPtezH38n-udJxDx6MUYF10y6YWPMOIOok4zjBgMrgGpguTdFjonEZAqHWOnyuGO6g1mPGENqCnbMrEw6lpnSInH7-S

Go to Arduino > Preferences. Copy the following URL into the Additional Boards Manager URLs field:

https://raw.githubusercontent.com/Seeed-Studio/Seeed_Platform/master/package_seeeduino_boards_index.json

suB30PXdikg0__Ve2ELah9Cy_2Xeh1oKNqZDJj2EuL-VNwpwF63656Yvd-cqjZHdlvsIIzhDhtnehGHwxqYrT5t8p2_9NscuIZDXVomsYy33IM7Oa5J8siLLzAvzggf4M14xttU1

Click OK.

Open the Boards Manager to install the STM32F4 board cores.

7pQuh0IxuzscJ8otGW6uP26U2PqQJL7x-kktX0oi555YygEC8WA6X8QvZIVb3boBHXEwIF6Una1K2qq3AU3t2tK_eAE-C1kPY7icVaYLm0TTfVAzXoz7XWsrhjZKT8AbDu8Wpdht

In the Boards Manager search for “Seeed”. Find and select the “Seeed STM32F4 Boards” version “1.2.3+” and click install.

Yl8co5N2AGQarf1cXeOJKJNMD--qAQuORNP3PDf9kadhIRHaWxSvh7KqxVw4xyvamkai9WpYKKPF-vfe2VG0p2fevKhfbkPCkPRO_lwtnOeZ2M5AcStWWYghFfZIxq43wIF51bne

Restart the Arduino IDE.

Select the board and the board port.

  • Click Tools > Boards > Wio Tracker LTE

mVr43mlc6Pcb9MzyATrw9cAuJehztXClErkzDMVzKde7tArRhlSgpMraFkryLQUrTCLvxEDWkRM9_Lh7XhkD-opGH0XOodUEZh78fvzagOarLfJFRENbrTq1tVZQ-L7G-7Q_bEgQ

Click Tools > Port > {Your Modem Port Here}

  • OSX: /dev/{cu|tty}.usbmodem{XXXX}
  • Linux: /dev/ttyACM{X}
  • Windows: COM{X}

CpD7vq0Dm4Lg0Y-jeg-LrYVDI2Qvzo9hQo7YnPImLtgBQCCPRJL5WTfesO8IzmmJ8LRq274AinRLl0fHLK6vDlv_jAWrQc77mGv2Xz23Usmqp_b9KQ-yYXiAyn03olk4IfeY_I1w

Configure the HelloWorld.ino file

Open the Hello World example provided by the Breakout SDK in the Arduino IDE.

  • Click File > Examples > Breakout Arduino Library > HelloWorld

linkMuwBWe915Y8hwg3pa8G6vrDD3P_hsi3UnmRK09gUyvPH9F5B_XKiZJcIsbf5xhHn2RBF7PboKyggWxs8ieKvbqnOgd_DBtPuiTgoIdZ8bRW1U18C1EVi6xqN2T9ObjSuT6D-

In the HelloWorld.ino find the psk_key in the “HelloWorld.ino” file.

A2M4K_1ER5APoAqp1d6ZL3Jx3VFvaRnR64iRtcjj7nmwszdG5LnjhRKxIQ9IEdWU3649ncDg9QR-Th-JWMD8LwklJIQgmmgH9MBvIepvf-vAMXDJZ8IHcxHD-PnQUUTvh8bPIAwS

Each development board has a unique SIM ICCID and Pre-Shared Key (psk). Copy the psk for the board into the HelloWorld.ino sketch. This key is required to connect to the T-Mobile Narrowband network.

  • Navigate to Programmable Wireless in the Twilio Console
  • Click SIMs
  • Find the Narrowband SIM that was previously registered
  • Under the tab Breakout SDK find Credentials
  • Where it says Pre-Shared Key (psk) click the eye logo to reveal the key
  • Copy the psk
  • Paste your psk into the HelloWorld.ino file in the code above

X4rhn9CnVankxRlj97YbjL9tLrDjyzMhxc2T4W8WJsBuY25WYHa8aP6myJ0MqMYccaxcDYUwPjSFbpkK5yC2_WnqdiYKUxRFbQeIur3h8Un3jH61STzL81nn0MgdImlqsLZSzuj3

Find the line breakout->setPollingInterval.

ysgLD_wQuzMY38QcJgizds_I81Cvw3KcJCqCar3etA0gb5SYudQAsKl9ZRRMIBciH1TEriCcImGGPVaD2SS3yxazoj66SSMJqgaNMLNz5d6p1o0o4Pr8Xmeyn3fuJW-fsgyaNsgY

Change the ‘setPollingInterval’ interval from 10 minutes to 1 minute.

[code]

Below is the complete Arduino sketch and it can be found on GitHub.

[code]

Enter Bootloader Mode

To upload code to the development board the unit needs to be put into Bootloader mode.

Press and hold the BOOT0 button underneath the Developer Board.

pKBfBLRxI72Ylj_eSvUjjDgCSlkDPeeXAK6yE-48qEqnaPzEKls_F0Gfas4wcMF6TMG3vQq-bCGvAiKsSDWEJAoGYirWNJs1x4-kGSGjImF59GvSNdTd28kxreO3PBruXPEIXUoY

Press and hold the RST on the top of the Developer Board.

BsDNvUrPuG9__SN2Q6ljKNkJq_zmqHmD7n3Qdo2f70cYnhc-WXGAs_gxlmJRMNTxG2CBiM-qOyLKMTBrYnVWIA-BNpVkvUIX9295LE4DZGvJ1jVGYWDkAuakUmjcf68O714CMKk0

Release the RST on the top of the Developer Board.

Release the BOOT0 button to enable Bootloader mode.

pKBfBLRxI72Ylj_eSvUjjDgCSlkDPeeXAK6yE-48qEqnaPzEKls_F0Gfas4wcMF6TMG3vQq-bCGvAiKsSDWEJAoGYirWNJs1x4-kGSGjImF59GvSNdTd28kxreO3PBruXPEIXUoY

Press Upload in the Arduino IDE.

rWCDjfTI0avbhzoqhQt605b_kXdG3a2CwItq4Q4lKyvL9rNGVMFWNno5aDfmLK59je3fKUBgDhWpAca943BxWCEaf7YqBGV5FSWoad97PXO4TBItXftwjFISPz_DvhNytV-Th-0g

7yv0QJkXUAbfAva9IuTcEkVNLYCQh_uSVigMG_JzpwjbaEtnnEGN1fhJdYwRiQGERc8OCHSYZvjdfvMMZUORSFLDj8JXzWwfqHewY-Qr-g_41WyZlhOIFYDD5ZHrHClY612XP-kE

This will take the board out of Bootloader mode and start the program by pressing the RST button. This will start the NB-IoT network registration process. The completed code can be found on the TwilioIoT GitHub.

Connect to the network and sending a Command

During the registration process, the Network Connectivity LED will glow orange.

LAn_Rscpq1FNcjcqy-nLreUEAUvXABM4h40tuIe2v0B5NmOjVmWo-bmWecFSsQqkpVeby0IOl6RTq1DZqWX60voK6zuPCQ0q04AeHNc0F2qGrMikw3NyMpcyBEsVecuv6u22gFqN

Open the Serial Monitor to observe the board registering and connecting to the network.

breakout-startup.png

When the development board successfully registers to the NB-IoT network the Network Connectivity LED will glow blue. The following message will display in the Arduino Serial Monitor when the connection is stable:

nb-registered1.png

When the board successfully connects to the NB-IoT network, the Breakout SDK will be initialized.

SAWtCdoZ09gXhhAptXZMzzUW3jhhcTJXF8_s3nmtJ6zf1LWvcnUHNDx5CTkUgs45AaJStalRIBQvXQ9vMNqF-z2AGAi8oj7M8oz3fyoMVV4lHPPq52CT65tJWGVTKywaC6v7-AOi

This is the Serial Monitor output when the Breakout SDK sends a Command to Twilio.

PGASZqyumRnj-PmvAR7tfs-Hpxt0iZdnbh6Xy05lR4rtqdiyDf4J2_vWECkhp2NULb2Rii2EB3E55QOGck6IOSW-zMKn2ReNuAn9RNG8tvfzOu9LLk0IzCThQNHBopcwIIvM8kx6

Every Command sent and received by the Breakout SDK is logged. Commands sent over the NB-IoT network can be found in the Twilio Console under Programmable Wireless.

  • Navigate to Programmable Wireless in the Twilio Console
  • Click SIMs
  • Find the Narrowband SIM that was previously registered
  • Click the Commands tab

UYlULzuBHPMdcyViLuLqkuPLoGteLV2hsVjJVO4Vmqnck5r42q4fRMrsgyN5SGAt1_QK4M3XDBhfN3y4efU1T6aVhrodGLkYhSX1mvW4UFvUls3xY5usch_nvOIeRgWRanJeVWQU

Receive a Command with the Breakout SDK

The Breakout SDK will poll for a new Command every minute. Using cURL, you can send a Command to the NB-IoT board by using the Sim unique name.

        
        
        
        

        Watch the Arduino IDE Serial Monitor to see the Command as it is received:

        nb-curlcommand.png

        Rate this page:

        ヘルプが必要ですか?

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