Quectel UG9x GSM/GPRS/EDGE and UMTS/HSPA Module

The UG96 is a GSM/GPRS/EDGE/UMTS/HSPA module that can provide a worldwide internet access via an AT command set.

Support is provided in Espruino by the UG96 (About Modules) module.

Note:

  • UG95 and UG96 use the same command set so that UG95 variants : UG95-E (Europe) and UG95-A (America) are also compatible with this Espruino driver.
  • UG96 and BG96 mostly use same command set.

If you want more information on the commands set, check out the UGx AT Command Manual (V1.7 or latest) and the UGx TCP/IP Command Manual(V1.4 or latest)

All these versions are available on Quectel

Wiring Up

Defaut HW:

  • GND : ground
  • Vbat : power supply (baseband and RF)

Note: Vbat must be able to provide sufficient current in a transmitting burst which typically rises to 2.0A.

The following pins are used within the UG96 module :

  • RST : reset
  • PWRKEY : turn on

Note: timings and procedures are detailed on the [UG96 Hardware Design] (/datasheets/Quectel_UG96_Hardware_Design_V1.3)

The following pins are used from the application using the UG96 module :

  • RXD : receive data
  • TXD : transmit data
  • CTS : clear to send
  • RTS : ready to send

Note: Flow control is "receive only" and follows Espruino implementation. It is neither a HW flow control (within UART IP) nor a SW flow control (with Xon/Xoff). This flow control is strongly recommended for applications having HTTPS or while the download of large volume of data.

Once started up, power is applied then STATUS led is on. Network status is given from the NETLIGH led which blinks more or less quicky during the network searching or the Idle/Data Transfer.

Note: If the UG96 powers down after a few seconds of flashing, check your battery/power supply. These modules draw a lot of power when they transmit, and will shut themselves down if your battery is unable to provide enough. Some modules use two diodes to drop the voltage from 5V to something acceptable for the UG96, which means that even a LiPo battery won't provide enough power.

Software

Sample code for using the library :

function QuectelStart(debug_quectel, debug_at) {
  // debug parameters init
  debug_quectel = debug_quectel || false;
  debug_at = debug_at || false;

  // HW pins (RTS, CTS) setup
  pinMode(D11, "input", true);
  pinMode(D12, "output", true);

  // UART set-up
  // with flow control setup, receive only, managed by SW, MCU side, espruino level
  Serial3.setup(115200, { rx: D9, tx : D8, cts: D12 });

  // Connect to modem
  console.log("Connecting to NW with Quectel UGxx module ... this may take few minutes");
  resetOptions = {
   rst: "A8",
   pwrkey: "A6",
   rst_active_level: 1,
   pwrkey_active_level: 0,
  };
  gprs = require('UG96').connect(Serial3, resetOptions, function(err) {
    console.log("connectCB entered...");
    if (err) throw err;
    setTimeout(doConnect,30000);
  });
  // Move debug parameters to true to get Quectel/AT debug logs
  gprs.debug(debug_quectel, debug_at);

  // Activate flow control at the modem initialization
  gprs.initflowctrl(true);
}

You'll need to replace APN, USERNAME, and PASSWORD with your mobile carrier's access point settings.

 /*****************************************************/
 /*          ENTER your network parameters            */
var APN = "apn";
var USERNAME = "username";
var PASSWORD = "password";

function doConnect() {
  gprs.connect(APN, USERNAME, PASSWORD, function(err) {
    console.log("connecting ...");
    if (err) throw err;
    onConnected();
  });
}

You can start with the HTML page downloading or/and geolocalization from base station any time after IP address allocation is done.

function onConnected (){
  gprs.getIP(function(err, ip) {
    if (err) throw err;
    console.log('IP:' + ip);
    // fetch longitude, latitude every 10 s
    gprs.geoLocStart(10000);

    GetHtmlPage("http://www.pur3.co.uk/hello.txt");
  });
}

function GetHtmlPage(html_page){
  require("http").get(html_page, function(res) {
    var contents = "";

    console.log("Response: ",res);

    res.on('data', function(d) {
      contents += d;
    });

    res.on('close', function(d) {
        console.log("Connection closed");
        console.log("full page content ---> "+contents);
    });
  });
}

function GeoLoc() {
    var coord="";

    gprs.geoLocGet(function(coord) {
          if (coord) {
            console.log("longitude,latitude = " +coord);
          }
      });
}

Reference

gprs.at

The AT command handler - use this to send your own AT commands to the UG96.

QuectelStart()

Start and return information on the UG96 module (registration, signal quality, connections, sockets handling, handlers) and/or AT module. 4 debug information levels (: no debug , information on the modem, information on the AT channel, full debug

gprs.debug()

Return debugging information and to turn on/off debug messages.

gprs.init(function(err) { ... })

Initialise modem settings - you shouldn't ever need to call this. The callback is called with err==null on success.

gprs.reset(function(err) { ... });

Reset the UG96 by pulsing the RST wire.

gprs.getVersion(function(err, version) { ... });

Call the callback with the version number reported back from the AT+GMR command. The callback is called with err==null on success.

gprs.connect(access_point_name, username, password, function(err) { ... });

Connect to the given access point - you'll have to find out which details to use from your mobile operator. The callback is called with err==null on success.

gprs.getIP(function(err, ip) { ... });

Call the callback with the current IP address, as a String. The callback is called with err==null on success.

gprs.initflowctrl(true); Active the Flow control. To use at the modem initialization (see code sample)

gprs.geoLocStart(period); and gprs.geoLocGet(function(coord) { ... }); Start the positioning from base station. A period over 10s is suggested. Get the result at any time.

Using

(No tutorials are available yet)

Buying

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.