RAK8211-NB BC95 support

Posted on
  • Hi,

    I've just been asked about the NB-IoT support for the RAK8211-NB.

    Does anyone have any working code for this? NB-IoT isn't rolled out in the UK so it's impossible for me to test things here.

    @Kartman you were asking some questions about BC95 earlier - did you have anything workable that you could share?

  • I'm struggling getting it to work reliably at the moment. There's just been new firmware released for the BC95 but I've yet to check to see if the problems I've encountered have been fixed. Then there's the challenge of updating the firmware - I've soldered some wires to bridge the BC95 serial to the usb->serial board so I can do this.

    The first trick to getting the BC95 working is to swap the gprs tx and rx pins (12 & 20) in rak8211.js. It's easy enough just to hand edit the min.js file as it is the first line.

  • Thanks - I'm looking into that with Rak at the moment. I believe it must have been swapped between the 8211-G and 8211-NB.

    Would it be possible to post up your code?

    This should be a good start I hope - it seems to work until CFUN=1 for me, but that's not too surprising given I seem to have a different (BC35) module on the board RAK sent me, and there's no NB-IoT service here anyway.

    function atcmd(cmd,timeout) {
      return new Promise(function(resolve,reject) {
        var data = "";
        at.cmd(cmd+"\r\n",timeout||1000,function­ cb(d) {
          if (d===undefined || d=="ERROR") reject(cmd+": "+d?d:"TIMEOUT");
          else if (d=="OK") resolve(data);
          else { data+=(data?"\n":"")+d; return cb; }
        });
      });
    }
    
    
    var at;
    var iTracker = require("iTracker");
    
    iTracker.setCellOn(true, function(usart) {
      console.log("cell now on");
      usart.setup(9600, { tx:D20, rx:D12 });
      at = require('AT').connect(usart);
      at.debug(true);
      // based on https://ansi.23-5.eu/2017/06/nb-iot-bc95­-arduino/
      atcmd("ATE0").then(function(d) { // echo off
        console.log("Set the communication band in this case 900Mhz");
        return atcmd("AT+NBAND=8");
      }).then(function() {
        console.log("Sets the APN (Access Point Name)");
        return atcmd('AT+CGDCONT=1,"IP","NBIOT.Telekom"­');
      }).then(function() {
        console.log("Connect to the IoT Core");
        return atcmd("AT+CEREG=2");
      }).then(function() {
        console.log("Power on the module");
        return atcmd("AT+CFUN=1");
      }).then(function() {
        console.log("Force the module to connect to the network");
        return atcmd('AT+COPS=1,2,"12345"');
      }).then(function() {
        console.log("Wait 30s");
        return new Promise(r=>setTimeout(r,30000));
      }).then(function(d) {
        console.log("Hopefully connected!");
      });
    });
      
      /*
    AT+NPING=8.8.8.8                          // Ping a server to check if it works
    AT+NSOCR=DGRAM,17,16666                   // Open a UDP socket
    AT+NSOST=0,ansi.23-5.eu,16666,4,414E5349­  // Send out the data
      */
    
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

RAK8211-NB BC95 support

Posted by Avatar for Gordon @Gordon

Actions