1

member

Easy Basics: Project 053a SIM800L GSM GPRS module

of Acoptex.com in UNO

Basics: Project 053a

Project name: SIM800L GSM GPRS module

Tags: Arduino Uno, SIM800L GSM GPRS breakout board, Arduino, SIM800L GSM GPRS module, SIM800L, Adafruit_Fona, SIMcom

Attachments: ATcommunicationsketch, library1SMSSendingsketch, SMSReadingsketch, Makingcallsketch, Receivingcallsketch, FonaTestMenusketchlibrary2, ReadSMSsketch, SendSMSsketch

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1.Arduino Uno R3 (you can also use the other version of Arduino)

2. SIM800L GSM GPRS module 1pc

 or 

3.Arduino IDE ( you can download it from here  )

4.Jumper cables F-M, M-M, F-F

5. Micro Sim Card 1 pc

6. LM2596S DC-DC Voltage Step-Down Converter Module VMA404 with power supply up to 7VDC 2A or 3.7VDC Li-Po battery 1pc

 with

or 

7.External IPX antenna (optional)

8.USB to TTL/Serial adaptor/converter 1 pc

9. Logical level converter 1 pc (can be resistors - voltage divider)

10. Breadboard 1 pc

General

We will learn how to connect SIM800L module to Arduino board and use it. 

Understanding the USB to TTL converter

You can read more about them here.

Understanding the SIM800L module

The SIM800L is a cheap and portable GSM module/breakout board with all the capabilities of the larger SIM900 shields. This SIM800L breakout board is ideal for projects that needs to save space. 

SIM800L is a quad-band GSM/GPRS module, that works on frequencies GSM850MHz, EGSM900MHz, DCS1800MHz and PCS1900MHz. SIM800L features GPRS multi-slot class 12/ class 10 (optional) and supports the GPRS coding schemes CS-1, CS-2, CS-3 and CS-4.

Application:

  • smart phone
  • PDA
  • other mobile devices

Features:

  • 2G quad-band @ 850/900/1800/1900 MHz
  • Receive and make calls using the speaker and microphone outputs
  • Receive and send SMS
  • Connect to the Internet via GPRS
  • Listen to FM radio broadcasts
  • Accepts AT Commands
  • SIM800L is designed with power saving technique so that the current consumption is as low as 0.7mA in sleep mode.

Specifications:

  • Power supply: 3.4V ~4.4V
  • Power saving: typical power consumption in sleep mode is 0.7mA (AT+CFUN=0 )
  • Frequency bands:  Quad-band: GSM 850, EGSM 900, DCS 1800, PCS 1900. SIM800L can search the 4 frequency bands automatically. The frequency bands can also be set by AT command “AT+CBAND”. Compliant to GSM Phase 2/2+
  • Transmitting power: Class 4 (2W) at GSM 850 and EGSM 900; Class 1 (1W) at DCS 1800 and PCS 1900
  • GPRS connectivity: GPRS multi-slot class 12 (default); GPRS multi-slot class 1~12 (option)
  • Temperature range: Normal operation: -40°C ~ +85°C; Storage temperature -45°C ~ +90°C
  • Data GPRS: GPRS data downlink transfer: max. 85.6 kbps; GPRS data uplink transfer: max. 85.6 kbps; Coding scheme: CS-1, CS-2, CS-3 and CS-4; PAP protocol for PPP connect; Integrate the TCP/IP protocol. Support Packet Broadcast Control Channel (PBCCH); CSD transmission rates: 2.4, 4.8, 9.6, 14.4 kbps
  • CSD: Support CSD transmission
  • USSD:Unstructured Supplementary Services Data (USSD) support
  • SMS: MT, MO, CB, Text and PDU mode
  • SMS storage: SIM card
  • SIM interface: Support SIM card: 1.8V, 3V
  • External antenna: Antenna pad
  • Audio features: Speech codec modes: Half Rate (ETS 06.20); Full Rate (ETS 06.10); Enhanced Full Rate (ETS 06.50 / 06.60 / 06.80); Adaptive multi rate (AMR); Echo Cancellation; Noise Suppression
  • Serial port and debug port: Serial port: Full modem interface with status and control lines, unbalanced, asynchronous; 1200bps to 115200bps; Can be used for AT commands or data stream; Support RTS/CTS hardware handshake and software ON/OFF flow control; Multiplex ability according to GSM 07.10 Multiplexer Protocol; Autobauding supports baud rate from 1200 bps to 57600bps; upgrading firmware. Debug port: USB_DM and USB_DP. Can be used for debugging and upgrading firmware.
  • Phonebook management: Support phonebook types: SM, FD, LD, RC, ON, MC.
  • SIM application toolkit: GSM 11.14 Release 99
  • Real time clock: Support RTC
  • Timing functions: Use AT command set
  • Physical characteristics: Size:15.8x17.8x2.4mm; Weight:1.35g
  • Firmware upgrade: Main serial port or USB port.

Operating modes:

Normal operating modes

  • GSM/GPRS SLEEP. Module will automatically go into sleep mode if the conditions of sleep mode are enabling and there is no on air and no hardware interrupt (such as GPIO interrupt or data on serial port). In this case, the current consumption of module will reduce to the minimal level. In sleep mode, the module can still receive paging message and SMS.
  • GSM IDLE. Software is active. Module is registered to the GSM network, and the module is ready to communicate.
  • GSM TALK. Connection between two subscribers is in progress. In this case, the power consumption depends on network settings such as DTX off/on, FR/EFR/HR, hopping sequences, antenna.
  • GPRS STANDBY. Module is ready for GPRS data transfer, but no data is currently sent or received. In this case, power consumption depends on network settings and GPRS configuration.
  • GPRS DATA. There is GPRS data transfer (PPP or TCP or UDP) in progress. In this case, power consumption is related with network settings (e.g. power control level); uplink/downlink data rates and GPRS configuration (e.g. used multi-slot settings)

Power down mode

Normal power down by sending AT command “AT+CPOWD=1” or using the PWRKEY. The power management unit shuts down the power supply for the baseband part of the module, and only the power supply for the RTC is remained. Software is not active. The serial port is not accessible. Power supply (connected to VBAT) remains applied.

Minimum functionality mode

AT command “AT+CFUN” can be used to set the module to a minimum functionality mode without removing the power supply. In this mode, the RF part of the module will not work or the SIM card will not be accessible, or both RF part and SIM card will be closed, and the serial port is still accessible. The power consumption in this mode is lower than normal mode.

You can read the datasheet of SIM800L module here. Mediatek ARM MT6261 datasheet is here. Specification of SIM800 IC you can find here.

This board draws a maximum of 2 A with an input voltage of 3.7 V to 4.2 V. This means you must not connect its pins directly to a 5 V Arduino! It doesn't even run on 3.3 V. The solution is either to use a voltage regulator or just have the SIM800L draw from a 3.7V Li-Po battery.

Our SIM800L module have two antennas included. First is made of wire (which solders directly to NET pin on PCB) - very useful in narrow places. Second - PCB antenna - with double sided tape and attached pigtail cable with IPX connector. This one have better performance and allows to put your module inside a metal case - as long the antenna is outside.

Signals and connections of the USB to TTL converter

 You can read more about them here.

Signals and connections of the SIM800L module

RING -Ring indicator.

DTR - Data terminal ready input.

MICP - Differential audio input (positive). Connected to microphone positive terminal.

MICN - Differential audio input (negative). Connected to microphone GND terminal.

SPKP - Differential audio output (positive). Connected to speaker output pin

SPKN - Differential audio output (negative). Connected to speaker GND pin

NET - external antenna pin.

VCC (or VDD or 5V/4V) - power supply from 3.7V to 4.2V DC maximum 2 A.

RST - reset input pin.(Active low)

GND - GND pin. Connected to Arduino board GND pin.

RXD (or SIM_RXD) - receive data pin. Connected to Arduino board TX pin.

TXD (or SIM_TXD) - transmit data pin. Connected to Arduino board RX pin.

5VIN - power supply 5V pin.

Wiring

The following picture shows the needed connections with the Arduino Uno 

1. Using Arduino board (initial setup AT commands). It's better to have an independent power supply with max 2A.

 

2. Using USB to TTL converter


Step by Step instruction

1. Configuring the  SIM800L GSM GPRS module

Preparations:

  • You must have coverage on a GSM 850 MHz, GSM 900 MHz, DCS 1800 MHz or PCS 1900 MHz network. GSM means 2G.
  • Use a prepaid plan or a plan with unlimited SMS for testing purposes. Otherwise, if something goes wrong, you may need to pay a lot for SMS text messages sent by mistake.
  • SIM800L GSM GPRS module uses the Micro SIM card size. If you have micro or nano you will need to get a SIM card size adapter.
  • Make sure your SIM card is unlocked. To use the SIM card with the  SIM800L GSM GPRS module, you need to turn off the pin lock. The easiest way to do this - insert the SIM card in your smartphone and turn off the pin lock in the phone security settings.
  1. Do wiring.
  2. Insert Micro Sim card to the slot.

  3. Adjust the buck-to-buck converter for an output of approximately 4V. Actual value can be anywhere from 3.7V to 4.2V for the SIM800L module or you can use 3.7V Li-Po battery. This means you must not connect its pins directly to a 5 V Arduino! It doesn't even run on 3.3 V. Do  not supply a current above 2 A (e.g 5 Amp) to the module.
  4. Open Arduino IDE.
  5. Plug your Adruino Uno board into your PC and select the correct board and com port
  6. Verify and upload the the sketch to your Adruino Uno
  7. Open Serial monitor, select baud rate - 19200 and Both NL&CR.
  8. First you need to check if AT commands are working - enter "AT" and press Send button.This would print "OK" which signifies of working connection and operation of the module.
  9. Enter "ATI" and press Send button. Returns the product (SIM800L) identification information:"SIM800 R14.18 OK"
  10. Enter "AT+CGMR" and press Send button. Returns the TA revision identification of software release: "Revision:1418B04SIM800L24 OK"
  11. Enter "AT+CGMM" and press Send button. Returns the model identification: "SIMCOM_SIM800L OK"
  12. Enter "AT+CGMI" and press Send button. Returns the manufacturer identification: "SIMCOM_Ltd OK"
  13. Enter "AT+CGSN" and press Send button. Returns the product serial number identification (identical with +GSN): "865691033213984 OK"
  14. Enter "AT+CCALR?" and press Send button. Call Ready Query. A numeric parameter which indicates whether the module is ready for phone call. 0 Module is not ready for phone call; 1 Module is ready for phone call: "+CCALR: 0 OK"
  15. Enter "AT+CSQ" and press Send button. Signal Quality Report: "+CSQ: 0,0 OK"
  16. Enter "AT+GSV" and press Send button. Returns product identification information: "SIMCOM_Ltd SIMCOM_SIM800L Revision:1418B04SIM800L24 OK"
  17. Enter "AT+CREG?" and press Send button. Network Registration. Returns: "+CREG: 0,4 OK"
  18. Enter "AT+COPS?" and press Send button. Returns the current network operator that the handset is currently registered with: "+COPS:0,0,"CHINA MOBILE" OK"
  19. Enter "AT+CPAS" and press Send button. Returns the phone activity status; "+CPAS: 2 OK"
  20. You can check here for all available SIM800L AT commands.

2. Configuring the SIM800L GSM GPRS module USB to TTL converter

For using this USB to UART Converter you need a software tool. Most of the development tools like MikroC Pro, Arduino has a UART Tool along with it. You can use different software tools: TerminalUSR-TCP232-Test V1.4AiThinker_Serial_Tool_V1.2.3cooltermsscom3.2 , KiTTYputty,tera termAccess port and so on. We recommend you to use AiThinker_Serial_Tool_V1.2.3 or sscom3.2, as you can save your AT commands and it's very easy to use.

  1. Do wiring.
  2. Insert Micro Sim card to the slot.

  3. Adjust the buck-to-buck converter for an output of approximately 4V. Actual value can be anywhere from 3.7V to 4.2V for the SIM800L module or you can use 3.7V Li-Po battery. This means you must not connect its pins directly to a 5 V Arduino! It doesn't even run on 3.3 V. Do  not supply a current above 2 A (e.g 5 Amp) to the module.
  4. Plug your USB to TTL converter into your PC USB port.
  5. Download and install driver for your USB to TTL converter.
  6. Download, install and open software tool.
  7. Set the baud rate 19200, data bits 8, parity bits none,stop bits one.
  8. First you need to check if AT commands are working - enter "AT" and press Send button.This would print "OK" which signifies of working connection and operation of the module.
  9. Enter "ATI" and press Send button. Returns the product (SIM800L) identification information:"SIM800 R14.18 OK"
  10. Enter "AT+CGMR" and press Send button. Returns the TA revision identification of software release: "Revision:1418B04SIM800L24 OK"
  11. Enter "AT+CGMM" and press Send button. Returns the model identification: "SIMCOM_SIM800L OK"
  12. Enter "AT+CGMI" and press Send button. Returns the manufacturer identification: "SIMCOM_Ltd OK"
  13. Enter "AT+CGSN" and press Send button. Returns the product serial number identification (identical with +GSN): "865691033213984 OK"
  14. Enter "AT+CCALR?" and press Send button. Call Ready Query. A numeric parameter which indicates whether the module is ready for phone call. 0 Module is not ready for phone call; 1 Module is ready for phone call: "+CCALR: 0 OK"
  15. Enter "AT+CSQ" and press Send button. Signal Quality Report: "+CSQ: 0,0 OK"
  16. Enter "AT+GSV" and press Send button. Returns product identification information: "SIMCOM_Ltd SIMCOM_SIM800L Revision:1418B04SIM800L24 OK"
  17. Enter "AT+CREG?" and press Send button. Network Registration. Returns: "+CREG: 0,4 OK"
  18. Enter "AT+COPS?" and press Send button. Returns the current network operator that the handset is currently registered with: "+COPS:0,0,"CHINA MOBILE" OK"
  19. Enter "AT+CPAS" and press Send button. Returns the phone activity status; "+CPAS: 2 OK"
  20. You can check here for all available SIM800L AT commands.

Code

Adafruit Fona library:

SMS Sending. The FONA library has a simple sendSMS() function that accepts the number and message as parameters and returns true if the message was sent through the network successfully. The code asks for the recipient's number first then asks for the message. If the message is successfully sent, a "Sent!" appears on the serial monitor. Otherwise, a "Failed" appears.

SMS Reading. The function getSMSSender() returns true and places the SMS sender number to the replybuffer, while the readSMS() function returns true and places the SMS to that same buffer. The readnumber() function returns the number of the sender of the SMS you are reading. The readBlocking() function is necessary to avoid reading the serial port when nothing arrives.

Making a Call. To make a call, we must attach a speaker to the SPKRP and SPRKRN terminals of the SIM800L and an electret microphone to the MICP and MICN terminals. Calling a number is done using the callPhone() function. This function returns true if the call is successfully made. The number to be called is the parameter for this function.

Receiving a Call. Receiving a call is a bit more complicated because whatever the Arduino is doing must be interrupted to acknowledge the call.The first thing that is noticeable is the change in the pin assignments for RX, TX and RST. This is because the D2 pin of the Arduino is the default interrupt pin. The SIM800L uses this pin to interrupt the Arduino whenever there is an incoming call. Thus, the D2 pin and the SIM800L's RING pin (above the DTR pin, if its not visible in yours) must be connected. There's also an option to enable or disable Caller ID notification.

There are other options in the FONA library including reading the signal level of the GSM network, scanning FM networks, and enabling GPRS to connect to the Internet.

Summary

We learnt how to connect SIM800L module to Arduino board and use it.

Notes:

  • It happens in some case that it is unable to detect the data that might be the issue with antenna, so unplug the antenna( if it is detachable) and attach it again.
  • If, code says “Check Connection”, then you should definitely check it twice, before giving up. Also, sometimes interchanging the TX and RX pins is preferable and surprisingly works.
  • If SIM800L GSM GPRS module  doesn’t respond with OK. Check your TX and RX connections to the Arduino. Try repeating the process by changing the TX with the RX pins. Also check if you have selected the software serial by placing the jumper cap on the appropriate place on the serial selector.
  • If you cannot see messages in the serial monitor. To see the messages in the serial monitor, the SIM800L GSM GPRS module and the Arduino’s serial port baud rate should be the same. The SIM800L GSM GPRS module default baud rate is 19200. So, select the Arduino’s baud rate to 19200. However, if you need to change the baud rate, you can send the following AT command to change it to 115200 or other appropriate baud rate. AT+IPR=115200

Libraries

  • See attachements on the begining of this project description.
  • Adafruit_Fona library. Download, unzip  and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. You can read more about it here.
  • Sim800l library. Download, unzip  and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. You can read about it here.
  • We used SoftwareSerial library. It's installed with Arduino IDE. 
    The library has the following known limitations:
    If using multiple software serial ports, only one can receive data at a time.
    Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).
    Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
    On Arduino or Genuino 101 the current maximum RX speed is 57600bps
    On Arduino or Genuino 101 RX doesn't work on Pin 13
    The library has the following known limitations: If using multiple software serial ports, only one can receive data at a time;Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69);Not all pins on the Leonardo and Micro support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI);On Arduino or Genuino 101 the current maximum RX speed is 57600bps; On Arduino or Genuino 101 RX doesn't work on Pin 13

Sketch

  • See attachment on the begining of this project


Other projects of Acoptex.com
Easy CBASIC Lesson 9 Compiling and debugging in Visual Studio of Acoptex.com in Csharp 10-04-2019
Easy Basics: Project 081d ESP8266 ESP-12E module and Nextion HMI display of Acoptex.com in ESP8266 ESP-12 24-03-2019

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 29-05-2018
Viewed: 1962 times