In Sim800L AT-Commands Guide there are a lot of different status commands, that should tell, what state does is have.
For example:
AT+CPAS - check if device is ready
AT+CGREG? - check registration status in network
AT+CGATT? - check if device "attached to network"
AT+CSQ - get signal level
But, in some cases, answers to this commands could be an "ERROR", or no answer at all.
I need a reliable and fast method to know is device connected to network, or it's already in GPRS mode, and for now I came to use blinking LED on Sim800L to detect it's state.
LED has three blinking frequencies:
- Fast blinking - GPRS connection is active
- Medium speed of blinking - Network connection is not established yet
- Slow blinging - Device is connected to network (but not the GPRS)
I can use photodiode and "read" blinging of LED, or I can wire LED's power pin to analog pin of Arduino, and read it's voltage. Next, I can count how fast LED is blinking, and determine, which state Sim800L in.
But how do I get this level of reliability without using such a crutch?
Given fast means 1 sec you could send an AT command e.g. five times and take 3 non error responses as a valid result. See pseudo code
or your HW approach with LED to analog pin