Avatar for Joakim

Joakim

Member since Aug 2014 • Last active Apr 2024
  • 5 conversations
  • 80 comments

Most recent activity

  • in Projects
    Avatar for Joakim

    That's really cool! I like the "split screen" layout, sort of a physical IDE.

    Something I've been dreaming of for a while is a mobile LoRa texting device with a low-power display and a Blackberry keyboard. It could be a Pixl.js + BB Q20 keyboard + LoRa + antenna + battery in a handheld format. A bit like the old Cybiko, which had two-way text messaging over radio as early as 24 years ago. Or like an early Blackberry, only with LoRa.

    A related idea is to build a rudimentary social mesh network on top of this.

    • 2 comments
    • 3,196 views
  • in The Place for Patreon Patrons
    Avatar for Joakim

    Found this interesting tidbit in a thread some months back:

    Just to add, there's some very cool Nordic stuff just around the corner that I may well end up doing something with too. I think there's a good likelihood that LTE-M will roll out across a whole bunch of countries very quickly.

    I've been secretly hoping for an Espruino board based on nRF91, so if this happens I'd be first in line to buy a few!

    I know nRF91 is not production ready yet, but planned to be released later this year if I'm not mistaken. Is it still something you're just considering, or do you have concrete plans for doing something with it?

    LTE M/NB-IoT is being rolled out at the end of the year here in Norway, which is nicely timed with the release of nRF91. Safe to say, I'd be very interested in an Espruino product with nRF91 some time thereafter :)

    Just let me know if there's anything I can do to help, or if you're interested in hearing what I'm looking for in an LTE M/NB-IoT solution like this.

  • in News
    Avatar for Joakim

    Nice! That was quick :)

  • in Interfacing
    Avatar for Joakim

    Aha, that must be it!

    I had misunderstood deep sleep and thought things would work like normal from the time it wakes up until it's done doing stuff. Classic example of RTFM :)

    Espruino can't be woken by Serial/USART traffic (and will not receive data while in Deep Sleep). (…) To work around this, you'd need to implement RTS/CTS flow control in software (waking Espruino on RTS, and only setting CTS after setDeepSleep(0) has been called).

    SIM7000 does support RTS/CTS hardware flow control, so I'll try that. Thank you!

    Edit: The shield didn't though, so I ended up disabling/enabling it manually.

  • in Interfacing
    Avatar for Joakim

    I've bought a shiny new SIM7000 GSM/LTE module that I've managed to get working with Espruino Pico.

    My problem is that the USART interface stops working when I disconnect the Pico from the USB port and power it from a LiPo battery. I first used Serial1 with USB.setConsole(true), then tried Serial2 instead, without noticing any difference. The code runs fine, logging any errors to an array so I can check it later. But the USART connection goes quiet as soon as USB is disconnected – any AT commands sent to the module never get a response. If I connect it to the USB port again and use the Web IDE, everything is back to normal.

    What could be going on? Is there something obvious that I've missed when setting up USART?

    I should mention that I've actually made my own version of the AT module, using promises instead of callbacks, plus a few other changes that I needed in order to get it to work with SIM7000 (and to understand what it was doing – really good programming excercise!). While the bug could lie somewhere in that code, it does work perfectly fine when connected to USB.

    Relevant excerpts from my code (yes, no semicolons!):

    const USART = Serial2
    const BAUD = 115200
    const PWRKEY = B4
    
    const at = require('AT').setup(USART)
    
    // Enable the PWRKEY pin
    pinMode(PWRKEY, 'output')
    
    // Enable Espruino's deep sleep mode
    setDeepSleep(true)
    
    // Deal with any uncaught exceptions
    process.on('uncaughtException', logError)
    
    E.on('init', () => {
      USB.setConsole(true)
      USART.setup(BAUD)
    })
    
    function test() {
      digitalPulse(PWRKEY, LOW, 100) // Power on
    
      // Listen for "SMS Ready" URC, time out after 10 seconds
      at.listen('SMS Ready', 10000) // similar to at.register() in the official module
        .then(…) // do stuff
        .catch(logError) // logs error to an array for later retrieval
    
      // When connected to USB, it receives "SMS Ready" 100% of the time
      // When connected to battery only, the SIM7000 module powers on but at.listen() times out with nothing being received
      // When connected back to USB again (without rebooting), AT commands are received
    }
    

    I'm programming the Pico from the Web IDE using "Save on Send: Direct to Flash".

    I've also tried putting USB.setConsole(true) at the very top of the code.

    Any help would be greatly appreciated!

  • in News
    Avatar for Joakim

    No, not at all - I was only joking :)

    Even still, I felt like an ungrateful kid begging for icecream after having been served a delicious cake :)

    I actually have checked whether for…of was supported, but never thought of suggesting it here! Maybe it's been overlooked because iterators and loops are not as attractive as arrow keys and async/await..

  • in News
    Avatar for Joakim

    Shouldn't be too hard to implement, should it? :)

    Here you go https://github.com/espruino/Espruino :)

    Now I regret saying that :) It came off wrong, sorry if it sounded like writing features for Espruino is easy! I'm sure it would take many hours to implement this, and I know you're not getting paid by the hour to work on Espruino. Instead I should thank you for making and continuously improving Espruino for free, and for providing such great support!

    I looked around for JS polyfills for Map and Set, and found one that was used by Firefox Nightly and Chrome Dev when the features were under the Enable Experimental JavaScript flag. It's also the smallest that I found (6KB, 2.77KB minified) and claims to have good performance.

    https://github.com/WebReflection/es6-col­lections
    https://raw.githubusercontent.com/WebRef­lection/es6-collections/master/index.js

    As far as I can tell, it actually does roughly what your bodged up implementation does :)

    I tested it on a Pico (had to move the exported functions to the bottom) and it seems to work fine, except for two issues:

    • Although it shims iterators, Espruino doesn't support iterators or for…of (good point!)
    • The .size property is missing (requires support for getters in Object.defineProperty)

    https://gist.github.com/joakim/e70a8c1bb­82b3cce32092cccfb99701d

    Despite those issues, I'll give it a try on a project I'm working on later and see how it goes.

Actions