Git Product home page Git Product logo

m2x-serial-modem's Introduction

Introduction

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.setDriver(DRIVER_SIM5218);
  SerialModem.setSerial(&Serial, 115200);
  while (!SerialModem.ready()) {
    Serial.println("waiting for modem ready");
    delay(2000);
  }

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

  // Specify the APN which the SIM can connect to
  while (!SerialModem.setAPN("m2m.com.attz")) {
    Serial.println("setting APN");
    delay(2000);
  }
  ...
}

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

LICENSE

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

m2x-serial-modem's People

Stargazers

Antowaine Wilburn avatar

Watchers

James Cloos avatar Antowaine Wilburn avatar

Forkers

tweez

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.