Skip to content
SerialModem is a c++ support library for WCDMA/HSPA modems over a serial interface
Branch: master
Clone or download
Pull request Compare This branch is 17 commits ahead of netarc:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


SerialModem is a c++ support library for WCDMA/HSPA modems over a serial interface. Currently supported modems are:

SerialModem was initially designed for Arduino based devices using the Arduino 3g GPRS/GSM/GPS Shield; but has since evolved to support additional modems.

NOTE: Unless stated otherwise, the following instructions are specific to Arduino Uno board. If you are using other boards, the exact steps may vary.

How to Install the library

  1. Clone the latest source or download the latest ZIP.
  2. Open the Arduino IDE, click Sketch->Import Library...->Add Library..., then navigate to SerialModem/SerialModem
  3. Now you can find SerialModem examples under File->Examples->SerialModem
  4. Enjoy coding!

Using SerialModem with M2X

You will need to include the libaries main header to gives access to the SerialModem class as well as the needed libraries for M2X using the following example:

#include "SerialModem.h"
#include "jsonlite.h"
#include "M2XStreamClient.h"

Then before your programs setup block add a SerialModem client as well as the M2X StreamClient and provide the SerialModem client to the M2X StreamClient as follows:

SerialModemClient client;
char m2xFeedId[] = "feed-id";    // Feed you want to post to
char m2xKey[] = "access-key";    // Your M2X access key
M2XStreamClient m2xClient(&client, m2xKey);

void setup() {

To setup the modem you will need to specify what modem you are using via the setDriver method as well as set the correct Network APN using the setAPN method. This is typically done in the microcontroller startup phase using the following code:

void setup() {
  // Specify the Modem you are using
  SerialModem.setSerial(&Serial, 115200);
  while (!SerialModem.ready()) {
    Serial.println("waiting for modem ready");

  while (SerialModem.getNetworkStatus() < NETWORK_STATUS_ROAMING) {
    Serial.println("waiting for network registration");

  // Specify the APN which the SIM can connect to
  while (!SerialModem.setAPN("")) {
    Serial.println("setting APN");

Now you can continue to use the M2X StreamClient as normal as it will make use of the SerialModem client for it's communications.


This library is released under the MIT license. See LICENSE for the terms.

You can’t perform that action at this time.