ModularSensors > Modules > Supported Modems and Communication Modules > SIMCom SIM800

SIMCom SIM800 module

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(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). Should be set to a negative number if the modem should be continuously powered or the power cannot be controlled by the MCU.
statusPin The digital pin number of the mcu pin connected to the modem status output pin. 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.
modemResetPin The digital pin number of the pin on the mcu attached the the hard or panic reset pin of the modem. 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.
modemSleepRqPin The digital pin number of a pin on the mcu used to request the modem enter its lowest possible power state. 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.
apn The Access Point Name (APN) for the SIM card.


Example Code

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

// For almost anything based on the SIMCom SIM800 EXCEPT the Sodaq 2GBee R6 and
// higher
#include <modems/SIMComSIM800.h>

// NOTE: Extra hardware and software serial ports are created in the "Settings
// for Additional Serial Ports" section
const int32_t modemBaud = 9600;  //  SIM800 does auto-bauding by default

// Modem Pins - Describe the physical pin connection of your modem to your board
// NOTE:  Use -1 for pins that do not apply
// Example pins are for a Sodaq GPRSBee R4 with a Mayfly
const int8_t modemVccPin     = -1;  // MCU pin controlling modem power
const int8_t modemStatusPin  = 19;  // MCU pin used to read modem status
const int8_t modemResetPin   = -1;  // MCU pin connected to modem reset pin
const int8_t modemSleepRqPin = 23;  // MCU pin for modem sleep/wake request
const int8_t modemLEDPin = redLED;  // MCU pin connected an LED to show modem
                                    // status

// Network connection information
const char* apn = "xxxxx";  // APN for GPRS connection

// Create the modem object
SIMComSIM800 modemS800(&modemSerial, modemVccPin, modemStatusPin, modemResetPin,
                       modemSleepRqPin, apn);
// Create an extra reference to the modem by a generic name
SIMComSIM800 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".

Defines

#define TINY_GSM_MODEM_SIM800
The modem type for the underlying TinyGSM library.
#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.