Git Product home page Git Product logo

Comments (2)

pkamp3 avatar pkamp3 commented on August 17, 2024

@Humancell happy to help! Want to mail me at pkamp [at] twilio.com ? Feel free to attach your working code and I'll try and help debug it

from api-snippets.

Humancell avatar Humancell commented on August 17, 2024

Thanks for the quick reply ... I'll contact you via email also.

I wanted to post my findings here also, as I believe that I've resolved my issue and this might assist others.

I'm just testing/using the example code from the link above (https://github.com/TwilioDevEd/api-snippets/tree/master/wireless/quickstart/m2m_commands_arduino_sim800) and I what I've found is that the failure seems to be related to the time it takes for the SIM800L to register on the network.

When I power up both the SIM800L and the Pro Mini at the same time, the code begins to run immediately.

When modem.begin() is called this simply sets up the SoftwareSerial, and then calls reset_modem().

reset_modem() issues the AT command until it gets a response of OK. On my SIM800L this occurs very quickly ... but the modem is STILL NOT registered on the network.

The example code then enters the loop() and almost immediately issues a modem.send_command() to attempt to send the command/sms.

send_command() calls the private method _send_SMS().

_send_SMS() immediately begins to try and send the AT commands to send a mobile command/sms ... but again in my case the modem is STILL NOT registered on the network. In addition, this method is discarding the responses from the modem so it does not detect that the responses are NOT "OK" ... they are still a random combination of asynchronous events of the modem completing the registration process.

At this point the code is out of sync with the state of the modem, and so everything fails.

If I power the modem, and give it 15-30 seconds to complete the registration on the network, and THEN power up the Pro Mini ... everything works perfectly. Once the modem has been powered and registered everything works. The code is simply missing checks to ensure that the network is ready before attempting to send the mobile command/sms.

What is missing from the example is a while loop checking for network registration using the AT command AT+COPS? until it returns more than +COPS: 0 ... in my case when registered it returns +COPS: 0,0,"T-Mobile USA" and then I can proceed with the rest of the code.

I'll keep hacking on the code and looks like I'll need to issue a pull request at some point. :-)

UPDATED: The other AT command to use is the AT+CREG? which provides details about the registration status. The response of +CREG: 0,2 means NOT registered ... and +CREG: 0,1
when registered. https://m2msupport.net/m2msupport/atcreg-network-registration/

from api-snippets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.