Preparing a Programmable Wireless SIM for use in your development hardware is straightforward, but involves some terminology and concepts that you may be unfamiliar with. This brief page will fix that. Once you’ve completed it, you’ll be ready to jump straight to your own IoT product.
We’ve included hop-off points if you’d like more information about a specific Twilio topic, but if you would prefer a more guided introduction to the concepts outlined here, we strongly suggest that you follow our getting started content.
SIM stands for Subscriber Identification Module. It determines which cellular networks an IoT device is permitted to connect to, and what communications facilities a network will allow it.
Any IoT device that wants to connect to a cellular network must contain a SIM.
Devices send and receive data over a cellular network through an ‘Access Point’ — essentially the gateway through which all of the device’s cellular data flows. To transfer data, the device has to know this server‘s identity, ie. the Access Point Name (APN).
There are two APNs for Programmable Wireless SIMs:
wireless.twilio.com for the Broadband IoT, and
iot.nb for Narrowband SIMs.
Check out Cellular Network Configuration if you’d like a more in-depth guide to choosing and setting the right APN.
Twilio Rate Plans are configurations which specify Programmable Wireless SIM and Narrowband SIM capabilities. Before you can use either of these SIMs, you will need to set up a Rate Plan and assign the SIM to it. The Rate Plan governs:
- What mix of data, voice and messaging services the SIM supports.
- What alternative networks it can roam onto if it needs to, and whether roaming can take place only in the US or internationally.
- What kind of payment plan a SIM‘s data billing is governed by.
- What limits you wish to place on how much data the SIM allows the host device to transfer each month.
Rate Plans are created and configured in the Console. It’s easy to do: just follow five simple steps. You also use the Console to associate one or more of your SIMs with a Rate Plan.
Every one of your SIMs must be associated with a Rate Plan, but a Rate Plan can be associated with any number of SIMs. How many Rate Plans you use depends solely on your use case.
You should read Understanding Rate Plans if you’d like a more in-depth guide to creating and applying Rate Plans.
Programmable Wireless and Narrowband SIMs exist in one of eight possible states; a SIM’s status indicates the state it is currently in. You can view a SIM’s status in the Console or by making a call to the Programmable Wireless API. These interfaces also allow you to change a SIM’s state, though some states are entered automatically. For example, when you update a SIM’s status, it automatically enters the Updating state and, upon completion, moves to the state you chose.
You may not need to change a SIM’s state yourself, but the ability to move SIMs from one state to another state via the API gives you a great deal of control over large volumes of devices in the field. For example, it allows you to temporarily disable devices which may have been lost or stolen. If a missing device shows up, you can return it to an operational state; if it stays missing, its access will be permanently blocked 72 hours after it was disabled.
To learn about the various states a SIM can enter, what they mean for its capabilities, and how they can be used to manage devices in the field, take a look at Understanding SIM states.
A new Programmable Wireless or Narrowband SIM can’t connect to the cellular network until it has been added to an account and been activated. For a developer, that means entering its registration code (printed on card the SIM comes mounted to) into the Console and assigning it a Rate Plan.
At this point the SIM is in the Ready state; it’s allowed to connect to the network and transfer data. After three months, 250KB of transferred data, or five SMS Commands have been sent to or sent from the SIM, whichever comes first, it transitions to the Active State and your account will be billed according to the volume of data it transfers or the number of SMS Commands it sends or receives.
You can read all about wireless data pricing here.
Once an IoT device’s Programmable Wireless or Narrowband SIM is Ready, it can transfer data to and from the Internet. You will need to code your device to control its cellular modem using AT commands. Which AT commands you use will depend on the make and type of modem your device contains, but you will use them to set up the data paths that your application requires.
You can also code your application to make use of cellular networks’ Short Message Service (SMS) facility. This is used to send small chunks of data (140KB) or commands (160 characters) to and from the device. You will need to check the modem for incoming messages and manage its message storage, again using AT commands. SMS messages can be send to a device using the Commands API.