SIM800L and SIM900A GSM modems
SIMCom GSM modems that send and receive SMS and calls with AT commands, on a simulated network that stands in for the phone network.
There is no real phone network here. Mokxi has no radio and no SIM card. The far end of every SMS and every call is a simulated network: the modem's own line in the serial pane, with its own input box. Nothing leaves your browser, and nobody's phone rings.
Aliases: SIM800L, SIM800, SIM 800, SIM900A, SIM900, GSM module, SMS module, GPRS module.
Pins
The SIM800L's red board has a six-pin row down each side:
| Pin | What it does |
|---|---|
NET |
The antenna pad (the spring antenna is soldered here). Carries nothing in Mokxi. |
VCC |
Supply, 3.4 to 4.4 V, with up to 2 A in bursts. One Li-ion cell, or a buck converter set to 4 V. |
RST |
Reset, active low, pulled up on the board. Low holds the modem off; letting go starts it. |
RXD |
Into the modem: wire it to the board's transmit pin (2.8 V logic; tutorials add a divider from 5 V). |
TXD |
Out of the modem, 2.8 V high: wire it to the board's receive pin. |
GND |
Ground, shared with the board. |
RING |
Ring indicator: low while a call rings, and a 120 ms low pulse for a new SMS. |
DTR |
Sleep control, pulled up. Not modeled. |
MIC+ MIC- SPK+ SPK- |
Audio. Not modeled. |
The SIM900A board has one row: VCC (5 V into the board's regulator), GND, TXD, RXD
and RST.
Power, and why it keeps resetting
The SIM800L's voltage monitor works as the data sheet says. Under 3.5 V it reports
UNDER-VOLTAGE WARNNING (SIMCom's spelling), over 4.3 V OVER-VOLTAGE WARNNING, and under
3.4 V or over 4.4 V it reports UNDER-VOLTAGE POWER DOWN or OVER-VOLTAGE POWER DOWN and
switches itself off. The board ties PWRKEY low, so it starts again two seconds later
and does the same again. On an Uno's 5 V pin or its 3.3 V pin it resets over and over,
which is what the real one does there. The serial pane's network line says why. Under 3 V
it does not start at all.
The SIM900A board's regulator takes 5 V; under 4 V it cannot hold the module up and it does not start.
What is not modeled is current. Mokxi's supply rails do not sag, so a supply at the right
voltage that cannot give 2 A (a USB port, or an Uno's 5 V pin under a SIM900A) works
here, where the real modem browns out while it registers. Give the real one its own
supply and a big capacitor across VCC.
Properties
| Property | Default | Meaning |
|---|---|---|
baud |
auto | auto is the factory autobaud. A rate (1200 to 115200) is a modem that was given AT+IPR= and AT&W once. |
phone |
+15551234567 | The number an SMS or a call from the simulated network comes from. |
signal |
20 | What AT+CSQ reports, 0 to 31. |
coverage |
on | Off is a modem that never finds the network: AT+CREG? says searching and SMS fail. |
ready |
on | The run starts with the modem already registered, as on the bench when the modem has been on a while. Off shows a cold start. |
The simulated network
Type in the modem's line in the serial pane (it is picked for you when the circuit has a modem):
| Type | What happens |
|---|---|
sms hello |
An SMS from phone arrives: stored on the SIM with +CMTI, or printed as +CMT after AT+CNMI=1,2,0,0,0. |
sms +447700900123 hello |
The same from another number. |
call or call +447700900123 |
An incoming call: RING every 3 s, and +CLIP after AT+CLIP=1. |
answer, busy |
The far end of a call the sketch dialed picks up, or is busy (BUSY). |
hangup |
The far end hangs up: NO CARRIER. |
Every SMS the sketch sends shows up on the same line, as SMS to +15551234567: text, and
so do the calls it makes and hangs up.
What the model gets right
Autobaud. The factory setting is autobaud: the modem says nothing until it hears an
A or a, takes its rate from that start bit (1200 to 115200 baud), and talks at that
rate from then on. That is why every tutorial opens with a bare AT, and why RDY never
shows up on a modem left at autobaud. With baud set to a rate, a cold start says RDY,
+CFUN: 1, +CPIN: READY, Call Ready and, on the SIM800L, SMS Ready.
The AT commands. Echo on by default (ATE0 turns it off), answers framed with
\r\n, OK and ERROR, and +CME ERROR and +CMS ERROR codes after AT+CMEE=1 or 2.
Chained commands work (AT+CMGF=1;+CNMI=1,2,0,0,0). Answered: AT, ATE, ATV, ATI,
ATZ, AT&F, AT&W, ATD, ATA, ATH, +CGMI, +CGMM, +CGMR, +CGSN, +CCID,
+CIMI, +CSQ, +CREG, +CGREG, +COPS, +CPIN, +CFUN, +CPOWD, +CBC (the real
VCC in millivolts), +CCLK, +CMEE, +IPR, +CMGF, +CSCS, +CSCA, +CSMP,
+CSDH, +CPMS, +CNMI, +CMGS, +CMGR, +CMGL, +CMGD, +CMGDA, +CLIP, +COLP,
+CLCC, +CLVL, +CMIC, +CRSL and +CSCLK. Anything else is ERROR.
Sending. AT+CMGS="+number" answers > , takes the text up to Ctrl+Z (26), which
sends it, or Esc (27), which drops it, and about 3 s later comes +CMGS: <n> and OK.
Before the modem is registered it is an error, as on a real network.
Timing. A cold start answers on its UART after about 3 s, registers at about 6 s and
is Call Ready at 8 s and SMS Ready at 10 s. The SIM holds 30 messages.
The serial buffer. The "receive an SMS" tutorial waits in delay(500) while the
modem talks, and SoftwareSerial keeps only 63 bytes, so a long message comes out cut
short, as it does on the bench.
What it does not model
The radio: GPRS and its +SAPBR, +HTTP and +CIP commands, USSD, call audio on
MIC and SPK, sleep on DTR. PDU mode (AT+CMGF=0 is kept, but a PDU message is
ERROR), messages over 160 characters (the rest is dropped) and the current, as above.
A real modem echoes each character as it arrives; this one holds its echo and answers
until the board's line has been quiet for two characters, a few milliseconds, so a
SoftwareSerial sketch that sends and listens on one line hears all of it. The modem's
clock starts at 2004-01-01, as a SIM800 with no network time does.
Libraries
None needed: the tutorials talk to the modem with SoftwareSerial (pins 3 and 2 on an
Uno) or a spare hardware serial port, at 9600 baud.
The Send an SMS project is the classic sketch on an Uno with the modem on an 18650 cell,
and Receive an SMS is the receive sketch on a SIM900A with a 5 V 2 A adapter.