SIMCom SIM800 topic

Introduction

There are a multitude of boards available that feature a variant of the SIMCom SIM800 or the nearly identical SIM900, including the Adafruit Fona Mini cellular GSM breakout. Almost all of those boards should work with ModularSensors as a generic SIM800. The one exception is the Sodaq GPRSBee R6 and higher, which has its own constructor. The earlier Sodaq GPRSBee's (ie, R4) do use this version.

The SIM800 consumes up to 2A of power while connecting to the network. That is 4x what a typical USB or Arduino board can supply, so expect to give the module it's own independent power source.

The Adafruit 3G Fona is not currently supported.

Manufacturer Documentation

The module datasheet and AT commands are available here: https://simcom.ee/modules/gsm-gprs/sim800/

Modem Constructor

SIMComSIM800::SIMComSIM800(Stream* modemStream, int8_t powerPin, int8_t statusPin, int8_t modemResetPin, int8_t modemSleepRqPin, const char* apn)

Construct a new SIMComSIM800 object The constuctor initializes all of the provided member variables, constructs a loggerModem parent class with the appropriate timing for the module, calls the constructor for a TinyGSM modem on the provided modemStream, and creates a TinyGSM Client linked to the modem.

Parameters
modemStream The Arduino stream instance for serial communication.
powerPin The digital pin number of the mcu pin controlling power to the modem (active HIGH).
statusPin The digital pin number of the mcu pin connected to the modem status output pin.
modemResetPin The digital pin number of the pin on the mcu attached the the hard or panic reset pin of the modem.
modemSleepRqPin The digital pin number of a pin on the mcu used to request the modem enter its lowest possible power state.
apn The Access Point Name (APN) for the SIM card.

Should be set to a negative number if the modem should be continuously powered or the power cannot be controlled by the MCU. Should be set to a negative number if the modem status pin cannot be read. This is the pin labeled STATUS in SIMCom's integration guide. Should be set to a negative number if the modem reset pin is not connected to the MCU. This is the pin labeled RESET in SIMCom's integration guide. Should be set to a negative number if there is no pin usable for deep sleep modes or it is not accessible to the MCU. This is the pin labeled PWRKEY in SIMCom's integration guide.



Example Code

The SIM800 is used in the menu a la carte example.

1// For almost anything based on the SIMCom SIM800 EXCEPT the Sodaq 2GBee R6 and
2// higher
3#include <modems/SIMComSIM800.h>
4
5// NOTE: Extra hardware and software serial ports are created in the "Settings
6// for Additional Serial Ports" section
7const int32_t modemBaud = 9600; // SIM800 does auto-bauding by default
8
9// Modem Pins - Describe the physical pin connection of your modem to your board
10// NOTE: Use -1 for pins that do not apply
11// Example pins are for a Sodaq GPRSBee R4 with a Mayfly 0.x
12const int8_t modemVccPin = -1; // MCU pin controlling modem power
13const int8_t modemStatusPin = 19; // MCU pin used to read modem status
14const int8_t modemResetPin = -1; // MCU pin connected to modem reset pin
15const int8_t modemSleepRqPin = 23; // MCU pin for modem sleep/wake request
16const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem
17 // status
18
19// Network connection information
20const char* apn = "xxxxx"; // APN for GPRS connection
21
22// Create the modem object
23SIMComSIM800 modemS800(&modemSerial, modemVccPin, modemStatusPin, modemResetPin,
24 modemSleepRqPin, apn);
25// Create an extra reference to the modem by a generic name
26SIMComSIM800 modem = modemS800;

Classes

class SIMComSIM800
The loggerModem subclass for the Adafruit Fona 2G, the Sodaq GPRSBeeR4 and almost any other module based on the SIMCOM SIM800 or SIM900 modules andthier variants".

Modem Pin Settings and Timing

The timing and pin level settings for a SIMCom SIM800

#define SIM800_STATUS_LEVEL = HIGH
The loggerModem::_statusLevel.
#define SIM800_STATUS_TIME_MS = 3000
The loggerModem::_statusTime_ms.
#define SIM800_RESET_LEVEL = LOW
The loggerModem::_resetLevel.
#define SIM800_RESET_PULSE_MS = 105
The loggerModem::_resetPulse_ms.
#define SIM800_WAKE_LEVEL = LOW
The loggerModem::_wakeLevel.
#define SIM800_WAKE_PULSE_MS = 1100
The loggerModem::_wakePulse_ms.
#define SIM800_WAKE_DELAY_MS = 450
The loggerModem::_wakeDelayTime_ms.
#define SIM800_ATRESPONSE_TIME_MS = 3000
The loggerModem::_max_atresponse_time_ms.
#define SIM800_DISCONNECT_TIME_MS = 15000L
The loggerModem::_disconnetTime_ms.

Define documentation

#define SIM800_STATUS_LEVEL = HIGH

The loggerModem::_statusLevel.

SIM800 status can be monitored on the STATUS pin which is active HIGH Time after end pulse until status pin becomes active:

  • SIM800 - >3sec from start of 1s pulse
  • SIM900 - >2.2sec from end of pulse

#define SIM800_STATUS_TIME_MS = 3000

The loggerModem::_statusTime_ms.

SIM800 status can be monitored on the STATUS pin which is active HIGH Time after end pulse until status pin becomes active:

  • SIM800 - >3sec from start of 1s pulse
  • SIM900 - >2.2sec from end of pulse

#define SIM800_RESET_LEVEL = LOW

The loggerModem::_resetLevel.

SIM800 is reset with a >105ms low pulse on the RESET_N pin


#define SIM800_RESET_PULSE_MS = 105

The loggerModem::_resetPulse_ms.

SIM800 is reset with a >105ms low pulse on the RESET_N pin


#define SIM800_WAKE_LEVEL = LOW

The loggerModem::_wakeLevel.

The SIM800 is switched on by a > 1 second LOW pulse on the PWR_ON pin. Module is switched on by a 1-3 second LOW pulse on the PWR_ON pin.


#define SIM800_WAKE_PULSE_MS = 1100

The loggerModem::_wakePulse_ms.

The SIM800 is switched on by a > 1 second LOW pulse on the PWR_ON pin. Module is switched on by a 1-3 second LOW pulse on the PWR_ON pin.


#define SIM800_WAKE_DELAY_MS = 450

The loggerModem::_wakeDelayTime_ms.

Time after power on before PWRKEY on SIM800 can be used is >0.4sec.


#define SIM800_ATRESPONSE_TIME_MS = 3000

The loggerModem::_max_atresponse_time_ms.

Time after end pulse until serial port becomes active on SIM800 is >3sec from start of 1s pulse.


#define SIM800_DISCONNECT_TIME_MS = 15000L

The loggerModem::_disconnetTime_ms.

SIM800 power down (gracefully) takes >3sec. We allow up to 15sec for shutdown in case it is not monitored.