New SMS module for SIM800/900/etc

Posted on
Page
of 2
/ 2
Next
  • Hi!

    Just an update to say that I've added a new module for SMS text messaging, to be found here: http://www.espruino.com/ATSMS

    This works on most Espruino devices, and should work on most different types of GSM modem - but let me know if not!

    For instance for Puck.js, I used D1 and D2:

    // Connect to serial device
    Serial1.setup(115200, { rx: D1, tx : D2 });
    var ATSMS = require("ATSMS");
    var sms = new ATSMS(Serial1);
    //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() {
      console.log("Got a message!");
    });
    

    Note that using the serial port on Puck.js causes it to keep the oscillator on so it can receive serial data. This uses a bunch of power, so it'd be worth trying to power your Puck.js from the 3.3v regulator on your GSM module (which they usually have).

  • Will try to work with it, thanks!

    Did you come across a serial command to power the GSM on and off, for a sim800?

  • As far as I know the SIM800/900 family can only be powered on and off with the PWRKEY pin.

  • As far as I can tell there isn't a way - there's some kind of 'sleep mode', but that may not be enough.

    It's easy enough to wire that pin up to Espruino - and then I think you use digitalPulse(pwr_pin, 1, 2000) - the pin actually needs a pulse on it for ~2 seconds to wake/sleep the SIM800.

  • But shouldn't it be able to simply connect and disconnect the whole module like you would normally. And then turn it on when you need it? Would it always need a physical press of a button to get going? Must be some kind of hack to achieve that...

  • I'm not sure I understand?

    The modules usually have a PWR pin - and Espruino/Puck.js can just pulse that with digitalPulse to turn the SIM800 on or off.

  • that is what i was thinking, then it uses zero. And for sending an sms, just turn it on first :)

    Thanks again

  • maybe an AT command for turning on/off the cellular radio would have the same effect as far as power consumption is concerned, do you know if such an AT command exists?

    Mind you my thinking isn't hindered by practical experience... AT commands maybe deal with just the network, not the inner workings of the module itself

  • -

  • I don't think there will be an AT command (except for sleep modes). It's serial, so you need a computer on the other end to listen for the serial data - hence the modem is never going to be able to shut down fully if you intend to wake it up with an AT command.

    The PWR pin is just one extra wire though - bringing the total to 5. It's not that bad!

  • still waiting for my sim800L, just not seeing a power on the board, not all models seem to have that.

  • Do you have a link to the board that you ordered?

  • would be happy to get another one if needed though.. if you know a more suitable one

  • Ok, it looks from https://buyhere22.com/components/sim800-­gsm-3.pdf like you can do:

    sms.at.write("AT+POWD=1\r\n");
    

    which will power down the SIM800 - then presumably you can pulse the Reset wire (which is on that breakout board) to reset it and start it back up again.

    It's a bit more of a faff though.

  • ok, will take some time to try this.

    What a brilliant thing it is, best toy ever :)

  • Is there a way to get the response back in the console when i send an AT command?

    second,

    The AT+POWD=1 command is problematic, it turns the phone off, but after ten seconds it automatically restarts.

    Is there an easy way to 'physically' take the 5v off off the SIM800 controlled by the Puck? The Sim800 needs 5v with up to 2 amps so can't get power from the Puck itself right.

  • Is there an easy way to 'physically' take the 5v off off the SIM800 controlled by the Puck? The Sim800 needs 5v with up to 2 amps so can't get power from the Puck itself right.

    you can use a mosfet to switch the Sim800 on and off, check this link:

    http://www.espruino.com/mosfets

  • perfect, going to try that.

    Thanks!

  • To get a response back, take a look at what I do in the module itself: https://github.com/espruino/EspruinoDocs­/blob/master/modules/ATSMS.js#L111

    You can use at.cmd - which sends a command and returns the response (or undefined if there was no response after a timeout)

  • when you use a mosfet to swith the gsm module on and off, and you use a serial connection to control the gsm with Rx,Tx, V and GND, would it be possible to use the V and GND from the serial connection to also turn the gsm on?

    Since they are on and off at the same time.. That would save you connections to the board

  • I just realized that the serial connection doesn't need the 3V. It is just ground, Tx and Rx right?

  • Yes, that's right - just the 3 wires. I'd still recommend using the AT POWD command to shut it off and then just use the RST wire to start it up - no mosfet required.

  • sorry, how can i send any AT command?

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

New SMS module for SIM800/900/etc

Posted by Avatar for Gordon @Gordon

Actions