iTracker RAK8212
NOTE: The RAK RAK8212 is no longer manufactured and new Espruino binaries are no longer being created. For new designs RAKwireless recommends the RAK5010.
Binaries can be found in:
- the Downloadable zip of firmare (current version)
- the binaries folder (current version)
- the automatic Travis Builds (cutting edge builds)
Contents
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);
});
Modem testing
The following code will power up the modem and report back the version number. It's a quick, easy way to test it without needing an active SIM.
var at;
console.log("Turning Cell on");
require("iTracker").setCellOn(true, function(usart) {
console.log("Cell now on");
at = require("AT").connect(usart);
at.cmd("AT+GMR\r\n",1000,function cb(d) {
if (d=="AT+GMR") return cb;
if (d!="OK") console.log("Version is "+d);
});
});
You can use the AT Module in this way to send your own custom commands
as well (it's also available as sms.at
and gprs.at
in the examples below.
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 QuectelBG96 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('QuectelBG96').connect(usart, {
apn : "",
username : "",
password : ""
}, function(err) {
console.log("Connected!");
if (err) throw err;
connectionReady();
});
}, 30000);
});
NB-IoT
This blog post by Wolfgang Klenk shows how to get connected with Vodafone's NB-IoT in Germany.
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 QuectelBG96 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:








































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

























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, then upload the hex file by copying it to the JLINK
drive
or using nrfjprog
.
This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.