- Know Ascenten
- Leverage our Expertise
- Tech Notes
- Contact Us
Inter-networked sensors, intelligent devices, consumer electronics, commercial and industrial products along with wireless connectivity and cloud computing is making the “Internet of Things” (IoT) more realistic with each passing day. As said by Kevin Ashton (person who coined this term) “In the real world, things matter more than ideas”. The whole concept was to provide ability to talk to the end device or sensor directly, without human intervention, so as to get rid of human errors and inaccuracies and to greatly reduce loss, waste and cost.
Initially, the idea was to use RFID as last mile communication providing unique identification to each end device (or ‘thing’) and then interconnecting all the devices in an internet-like structure. However today, a large number of different communication media and technologies are being used to achieve this noble mission.
M2M, in brief, is an ability to connect with machines. IoT can be realized only when M2M is achieved. Ability to communicate with devices remotely not only enhances the accessibility, but can also improve performance of the overall system. Today, more than 50 billion devices are interconnected and they can provide seamless connectivity between machines. Further, widespread usage of IP networks has made it even easier. Devices can be designed as “IP-enabled” and can be communicated from anywhere.
The existing PSTN network can be effectively used to communicate with remote end devices. Below mentioned are the few applications that show a glimpse of M2M possibilities using the existing telephony network.
This section provides a brief application note on how a readily available off-the-shelf GSM module (a.k.a. engine) can be interfaced, enabling your product for M2M connectivity.
GSM modules can be communicated typically via UART, SPI or USB using Hayes AT commands. These sets of commands help to configure parameters such as baud rate, flow control, numeric response code, unsolicited response behavior, APN, etc. and helps to perform set of operations like dialing, call pick up and hang up, sending and reading SMS, GPRS connection, etc.
Figure 1 shows the connection setup required to interface a GSM module. Following is the required part list.
Figure 1 – GSM module interface connection
Figure 2 shows the basic flow chart for interfacing the GSM module. As shown in the figure, initially GSM module needs to be enabled, typically by applying a pulse on the ‘ignition’ pin. The module is then ready to accept AT commands and default parameters can be configured. If the network is available and a valid SIM card is inserted, it will be authenticated and registered to the network. At this stage, i.e. Status = Registered, application can run an idle task. During an idle run, GSM module may push unsolicited response intimating either different possible network conditions (such as SIM unregistered) or incoming call/SMS indication. Even SIM presence can be monitored if the ‘SIM presence’ pin from the SIM tray is connected to the module. Flow chart shows handling of data call, new SMS received and SIM related intimations, while all other unsolicited responses from the module are discarded.
Figure 2 – GSM module configuration and idle run
Note that most of the modules need restart, if the SIM is removed and re-inserted, in order to get registered to the network; i.e. dynamic SIM insertion and extraction is not supported.
Besides handling incoming intimations from a module, an application may also trigger scheduled or event-based activities such as sending SMS, establishing a data call or connecting to remote server in order to transfer relevant data.
Figure 3 shows SMS related handling which involves AT commands such as AT+CMGR for reading and AT+CMGS for sending, along with some other commands required for SMS related configurations. GSM supports text and PDU (Protocol Description Unit) mode for sending and receiving SMS messages. The PDU is a special compression format used by most of the handset.
Figure 3 – SMS handling flow graph
Most M2M applications do not need voice call, except emergency services, when voice call support may be required in addition to SMS service. GSM network supports the so-called “data” call, which enables one to establish virtual serial connection with the remote machine.
Figure 4 shows data call initiation which involves ATD command followed by destination number.
Figure 4 – Data call flow graph
Finally, GPRS service is the most appealing feature of GSM network, since it provides wireless internet connectivity. In order to enable IP connectivity, two approaches can be used
Approach 1 is easier and removes issues such as learning curve, stack license purchase (in case commercial third party stack is to be used) and possible implementation level bugs. However, this approach forces to use vendor specific AT commands and hence creates vendor locking situation. Also, the user has to live with all possible bugs inherent in the implemented stack within the module.
Approach 2 provides a better hold on the situation such as vendor independence and ability to fix any encountered bug in the stack. With this approach, however as mentioned, a thorough knowledge of TCP/IP stack will be required. As a solution, it is better and faster way to adopt third party pre-written stack, either open-source such as lwIP, uip, uc/IP, FNET, etc. or commercial one like CMX-Micronet, Nichelite, etc.
Figure 5 provides GPRS connection flow diagram using approach 2 considering CMX-Micronet as third party stack.
Figure 5(a) – GPRS communication flow graph, Part – 1
Figure 5(b) – GPRS communication flow graph, Part – 2
Figure 5(c) – GPRS communication flow graph, Part – 3
Connecting to IP network using GPRS involves the following steps
Whereas, disconnecting involves the following steps
Once the basic IP stack is working, as a further step, one may add security protocols such as SSH, SSL, IPSec, etc. or can run applications such as web server or email in order to enhance functionality of the product.
Today, amidst the large number of communication technologies and media, GSM based M2M connectivity can be effectively used to achieve IoT. With GSM services getting better and cheaper over the period, this approach will further help to provide IP connectivity to the end devices.