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
*/
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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.