iTracker RAK8212

RAK8212

Binaries can be found in:

Using

Serial connection

When the iTracker powers on, if it detects 3.3v on pin D28 (Serial RX) then it will enable serial comms at 9600 baud on D28(RX) and D29(TX).

For instance if the iTracker is connected to the adaptor board and that board is powered on, you'll be able to use the USB Serial interface to program your iTracker.

However there is just one Serial port on the nRF52. If you then use GPS or GSM, the connection to D28/D29 will be moved, removing your communications. If you need to maintain communications during that time, please connect via Bluetooth instead.

GPS

There is no separate GPS chip on the RAK8212. Instead, it is built into the BG96. Use as follows - this also turns the BG96 on if it wasn't already enabled.

require("iTracker").setGPSOn(true, function(err, gps) {
  /* gps contains: {
    at : AT command handler
    on : function(callback(err)) // turn GPS on (turned on automatically)
    off : function(callback(err)) // turn GPS off
    get : function(callback(data)) // get GPS data
  } */
  setInterval(function() {
    gps.get(function(data) {
      print("GPS", data);
      /* returns {error:...} on failure. 'ERROR: 516' means 'no fix'
         returns { raw : raw data as <UTC>,<latitude>,<longitude>,<hdop>,<altitude>,<fix>,<cog>,<spkm>,<spkn>,<date>,<nsat>
                   lat :   latitude in degrees,
                   lon :   longitude in degrees,
                   alt : altitude in m  } */
    });
  }, 10000);
});

SMS

See the ATSMS module for full documentation.

var sms;

console.log("Turning Cell on");
require("iTracker").setCellOn(true, function(usart) {
  console.log("Connecting SMS");
  var ATSMS = require("ATSMS");
  sms = new ATSMS(usart);
  //Use sms.at.debug(); here if you want debug messages

  sms.init(function(err) {
    if (err) throw err;
    console.log("Initialised!");

    sms.list("ALL", function(err,list) {
      if (err) throw err;
      if (list.length)
        console.log(list);
      else
        console.log("No Messages");
    });

    // and to send a message:
    //sms.send('+441234567890','Hello world!', callback)
  });

  sms.on('message', function(msgIndex) {
    console.log("Got new message, index ", msgIndex);
  });

  // when done use require("iTracker").setCellOn(false)
});

GSM/GPRS

See the QuectelM35 module for full documentation.

function connectionReady() {
  var http = require("http");
  http.get("http://www.pur3.co.uk/hello.txt", function(res) {
    res.on('data', function(data) {
      console.log(data);
    });
  });
}

var gprs;
console.log("Turning Cell on");
require("iTracker").setCellOn(true, function(usart) {
  console.log("Waiting 30 sec for GPRS connection");
  setTimeout(function() {
    console.log("Connecting GPRS");
    gprs = require('QuectelM35').connect(usart, {}, function(err) {
      console.log("Connected!");
      if (err) throw err;
      connectionReady();
    });
  }, 30000);
});

Sensors

e=require("iTracker").setEnvOn(true, function() {
  console.log(e.getData());
});
// { "temp": 27.05661935425, "pressure": 1007.23205361758, "humidity": 40.728515625 }

m=require("iTracker").setMagOn(true, function() {
  console.log(m.read());
});
// { "x": -92, "y": -17, "z": 424 }

a=require("iTracker").setAccelOn(true, function() {
  console.log(a.read());
});
// { "x": 0.0263671875, "y": 0.3505859375, "z": -0.3291015625 }

o=require("iTracker").setOptoOn(true, function() {
  console.log(o.read());
});
// 2709.76

Reference

iTracker.setGPSOn = function(isOn, callback) { ... }

Return GPS instance. callback is called whenever data is available!

iTracker.setEnvOn = function(isOn, callback) { ... }

Returns BME280 instance. callback when initialised. Call getData to get the information

iTracker.setMagOn = function(isOn, callback) { ... }

Returns a LIS2MDL instance. callback when initialised. Then use read to get data

iTracker.setAccelOn = function(isOn, callback) { ... }

Returns a LIS3DH instance. callback when initialised. Then use read to get data

iTracker.setOptoOn = function(isOn, callback) { ... }

Returns a OPT3001 instance. callback when initialised. Then use read to get data

iTracker.setCellOn = function(isOn, callback) { ... }

Turn cell connectivity on - will take around 8 seconds. Calls the callback(usart) when done. You then need to connect either ATSMS or QuectelM35 to the serial device usart

iTracker.setCharging = function(isCharging) { ... }

Set whether the BQ24210 should charge the battery (default is yes)

Tutorials

First, it's best to check out the Getting Started Guide

Tutorials using Bluetooth LE:

About Bluetooth LE (BLE)About Bluetooth LE (BLE)BLE Advertising with Node.js/Python/C#/AndroidBLE Advertising with Node.js/Python/C#/AndroidBluetooth LE UARTs (NUS)Bluetooth LE UARTs (NUS)Controlling Bluetooth Lights with Puck.jsControlling Bluetooth Lights with Puck.jsControlling Other BLE Espruino DevicesControlling Other BLE Espruino DevicesExercise Machine controlled VideoExercise Machine controlled VideoGetting Started with Puck.jsGetting Started with Puck.jsPixl.js Bluetooth to Ethernet MQTT BridgePixl.js Bluetooth to Ethernet MQTT BridgePixl.js Multiplayer Pong GamePixl.js Multiplayer Pong GamePixl.js SMS Remote MonitoringPixl.js SMS Remote MonitoringPixl.js Simple LoggerPixl.js Simple LoggerPuck.js Bluetooth with the Graphical EditorPuck.js Bluetooth with the Graphical EditorPuck.js MIDIPuck.js MIDIPuck.js Music ControllerPuck.js Music ControllerPuck.js Security and Access ControlPuck.js Security and Access ControlPuck.js and BLE PrintersPuck.js and BLE PrintersPuck.js and Eddystone BeaconsPuck.js and Eddystone BeaconsPuck.js and HID KeyboardsPuck.js and HID KeyboardsPuck.js and HTTP ProxiesPuck.js and HTTP ProxiesPuck.js and If This Then ThatPuck.js and If This Then ThatPuck.js and Node-RED with MQTTPuck.js and Node-RED with MQTTPuck.js and iBeaconsPuck.js and iBeaconsPuck.js with SMS controlPuck.js with SMS controlQuick Start (Bluetooth LE)Quick Start (Bluetooth LE)Using Puck.js from a Web Bluetooth WebsiteUsing Puck.js from a Web Bluetooth WebsiteWeb Bluetooth on LinuxWeb Bluetooth on LinuxWeb IDE on a Raspberry PiWeb IDE on a Raspberry PiBluefruit LE app interfaceBluefruit LE app interface

Tutorials using Bluetooth LE and functionality that may not be part of the iTracker:

Door Controlled Light with Puck.jsDoor Controlled Light with Puck.jsFreezer AlarmFreezer AlarmInfrared Record and Playback with Puck.jsInfrared Record and Playback with Puck.jsPixl.js Wireless Temperature DisplayPixl.js Wireless Temperature DisplayPixl.js Wireless Weather StationPixl.js Wireless Weather StationTemperature Controlled Night Light with Puck.jsTemperature Controlled Night Light with Puck.js

Pinout

Hover the mouse over a pin function for more information. Clicking in a function will tell you how to use it in Espruino.

  • Purple boxes show pins that are used for other functionality on the board. You should avoid using these unless you know that the marked device is not used.
  • ! boxes contain extra information about the pin. Hover your mouse over them to see it.
  • 3.3v boxes mark pins that are not 5v tolerant (they only take inputs from 0 - 3.3v, not 0 - 5v).
  • GND is ground (0v).
  • ADC is an Analog to Digital Converter (for reading analog voltages)
  • USART is a 2 wire peripheral for Serial Data.

Firmware Updates

You need to attach a nRF52DK or other SWD programmer to the SWDCLK and SWDIO pins.

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