Avatar for Gordon

Gordon

Member since Sep 2013 • Last active Dec 2018

Most recent activity

    • 6 comments
    • 114 views
  • in General
    Avatar for Gordon

    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
      */
    
    • 3 comments
    • 42 views
  • in General
    Avatar for Gordon

    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?

  • in News
    Avatar for Gordon

    I have added some new fonts and improved the Font Module page to accurately show what characters (and where!) they are:

    http://www.espruino.com/Fonts#font-modul­es

    These new fonts are based on some X11 fonts, and while they use up a bit more space, you can (finally) get good support for international (non-english) characters that are in the 128-255 character code range as well as some more professional looking characters.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Gordon

    Oh wow, no - I mean normally the Puck will broadcast within ~0.3 sec and it'll be picked up almost instantly. If you set the interval to 7.5 it'll broadcast within 0.0075 sec - so it's going to be well within 1s without IR!

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Gordon

    Yes, you could put an IR receiver on the Pi - the Puck isn't that long-range with IR though (around a meter).

    Thing is, a normal IR signal contains a ~9ms start pulse (http://www.espruino.com/Puck.js+Infrared­) and data pulses are usually ~1ms so if you transfer any data chances are it's actually going to be slower than the Bluetooth. You could send a single 1ms pulse but it's not going to be that much faster and you may get false positives.

    You could actually do:

    setWatch(function() {
      NRF.wake();
      setTimeout(function() {
        NRF.sleep();
      }, 100);
    }, BTN, {repeat:true});
    

    This stops Bluetooth advertising and then restarts it when the button is pressed, for 100ms. I just tested and it sends an advertising packet immediately - however there's no guarantee that the packet will get received by the Pi because Bluetooth advertising isn't guaranteed.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Gordon

    There's some code specifically for Node.js in this tutorial that might help you out: http://www.espruino.com/Puck.js+Advertis­ing

    There are other ways of doing it (like with a connection) but this way is nice and easy and doesn't require any pairing or connection. When using NRF.setAdvertising on the Puck you can choose a low interval (as low as 7.5ms) which would get the latency down, but that will hurt your battery life so you might want to think about having the Puck lower the interval down to 300ms or so after an hour of inactivity.

    Hope that helps!

  • in General
    Avatar for Gordon

    Hi - I don't think this is particularly ESP8266 specific, and it's probably more relevant now we can save saved code that auto-runs in .boot0/1/2/3 as well. Do you want to move this to the main forum?

    From my point of view, it'd be nice to:

    • Try and integrate this in a way that fits in with the look & feel of the rest of the IDE
    • Make sure it works online, via the Windows Native App, and the Chrome web app
    • Have the ability to choose a file to edit (so you could create a project, but could then have the editor window allowing you to edit a module in that project)
    • Maybe have an option for image conversion (to convert PNG/JPEG to bitmaps)
    • Maybe have an option for Wave file conversion
    • Maybe have an option to use Espruino v2's Heatshrink compression

    I guess some of this comes down to whether we try and handle files better in the Web IDE as well (multiple tabs, automatic saving, maybe having a filesystem online, or GitHub/Google Drive/etc integration)

  • in ESP8266
    Avatar for Gordon

    Just to update this, there's now:

    • The Storage Module built in to Espruino itself which allows you to save simple 'files' - and load them in a memoryArea-style way that doesn't use up RAM.
    • Save to flash and modules as functions in the Web IDE, which automatically save your code direct to flash

    These work on all platforms.

Actions