SIM800L (GSM-Modul)

Nach anlegen der Versorgungsspannung kann das Modul durch GND (interner Pullup auf 3V) am PWRKEY für mind. 1 Sekunde, gestartet werden.

ACHTUNG: Pegelwandler verwenden, bzw. mit NPN-Transistor OC schalten. 4,7k von Signal auf Basis und 4,7k von Basis auf GND. Dadurch wird das Signal invertiert, also HIGH zieht PWRKEY auf LOW.

Erst wenn das STATUS-Signal vorhanden/HIGH ist (frühestens 3 Sekunden nach dem Beginn der Startphase) ist das Modul einsatzbereit und die serielle Schnittstelle aktiviert.

Sobald das Modul einsatzbereit ist sendet es den String „RDY“ auf der seriellen. ACHTUNG: Nur wenn eine feste Baudrate eingestellt wurde. Per Default macht das Modul Autobaud. Festeinstellen geht mit: AT+IPR=9600 (für 9600 Baud)

Feste Baudrate einstellen

AT+IPR=9600
RDY

Nun ist die Baudrate neustartfest im Flash auf 9600 Baud programmiert.

SIM800 ausschalten

Variante 1) PWRKEY Pin für mind. 1 Sekunde lang auf LOW. Das Modul loggt sich aus dem GSM-Netz aus und zieht den STATUS-Pin auf LOW. Bevor das Modul aus geht meldet es über die Serielle „NORMAL POWER OFF“. Ein wiedereinschalten über PWRKEY ist frühestens nach 33 Sekunden möglich

Variante 2) AT+CPOWD=1

Variante 3) Strom wegnehmen

SIM800 restarten

Modul ausschalten (Poweroff), warten bis STATUS Pin auf LOW ist und dann noch mind. 800ms warten. Anschießend die normale Startprozedur wieder ausführen.

Eingehenden Ruf/SMS erkennen

Der RI Pin ist im Ruhezustand HIGH. Bei einem Anruf (eingehend oder ausgehend) wird der Pegel LOW. Wird der Ruf beendet wieder HIGH. Bei eingehender SMS wird der Pin für 120ms LOW.

Batteriespannung abfragen

AT+CBC
+CBC: 0,100,4367

OK

Einfacher Echo-Test

AT
OK

Einstellung auf vollen Funktionsumfang

AT+CFUN=1
OK
  • 4 ⇒ „Flightmode“ (also fast alles aus)
  • 1 ⇒ Maximale Funktion
  • 0 ⇒ Minimale Funktion (Energiesparmodus für Standby)

==== Text-Modus für SMS einstellen:

AT+CMGF=1
OK

Auf SIM-Karte prüfen

AT+CPIN?
+CPIN: READY

OK

GSM-Netz prüfen

AT+CGREG?
+CGREG: 0,1

OK

Überschrift

AT+CGATT?
+CGATT: 1

OK

SIM mit PIN entsperren

AT+CPIN="0000"
OK

Please not that in most cases you have only 3 attemps to set the correct PIN code! After setting the PIN code, wait some seconds before issueing the next command to give the modem some time to register with the GSM network.

Aktuelle SMS-Parameter auslesen

AT+CSMP?
+CSMP: 1,169,0,0
OK

The first value is a combination of some option bits: bit 7 RP Reply path, not used in text mode bit 6 UDHI User Data Header Information bit 5 SRR Set this bit to request a delivery report bit 3,4 VPF Validity Period, set b4=1 if a VP value is present bit 2 RD Reject Duplicates, do not return a message ID when a message with the same destination and ID is still pending bit 0,1 MTI Message Type Indicatorb1=0 & b0=0 → SMS-DELIVERb1=0 & b0=1 → SMS-SUBMIT

Bit 0 of the message is always set when sending messages (SMS-SUBMIT). So the first value should be 1 or higher. The second parameter sets the Validity Period of the message. This value is encoded as follows: 0 - 143 (VP + 1) x 5 minutes 144 - 167 12 Hours + ((VP-143) x 30 minutes) 168 - 196 (VP-166) x 1 day 197 - 255 (VP-192) x 1 week

The third parameter contains the PID (Protocol Identifier). This parameter is only used for advanced messaging. The fourth parameter contains the DCS (Data Coding Scheme). This parameter is used to select the characterset/messagetype. When setting the DCS parameter to '0' standard 7 bit text is send. When setting this parameter to '16' the message is sent as a flash message.

To send a message with a validity period of 1 day, the parameters have to be set like this:

Bit 0 and 4 of the first field has to be set, so the first value will become 1 + 16 = 17.

Parameter einstellen

AT+CSMP=17,167,0,16
OK

SMS senden

AT+CMGS="+31638740161"
>TEXT...<CTRL-Z bzw. chr(26)>

After some seconds the modem will respond with the message ID of the message, indicating that the message was sent correctly:

+CMGS: 62

SMS lesen

AT+CMGR=1

The modem will reply with the text of the first SMS in the inbox along with senders mobile number and date and time.

AT+CMGL=ALL

The modem will reply with the text, senders number, timestamp of the all the messages in the inbox in one shot.

SMS löschen

AT+CMGD=1
OK

erste SMS wurde gelöscht

Ausgehender Anruf

ATD9900243245

Eingehenden oder ausgehenden Anruf beenden

ATH
OK

Eingehenden Anruf annehmen

ATA
OK

Rufnummernanzeigen eingehender Anrufe

AT+CLIP=1
OK
RING

+CLIP:+9916258273