Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vittorioexp/Sim800L-Arduino-Library-revised
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1.2
Choose a base ref
...
head repository: vittorioexp/Sim800L-Arduino-Library-revised
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on May 19, 2017

  1. Update README.md

    vittorioexp authored May 19, 2017
    Copy the full SHA
    fd13944 View commit details

Commits on May 20, 2017

  1. Copy the full SHA
    b7fbdba View commit details
  2. Add files via upload

    vittorioexp authored May 20, 2017
    Copy the full SHA
    8bb8b5b View commit details
  3. Copy the full SHA
    c81ab05 View commit details

Commits on Sep 3, 2017

  1. Use correct separator in keywords.txt

    The Arduino IDE requires the use of a tab separator between the name and identifier. Without this tab the keyword is not highlighted.
    
    Reference: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#keywords
    per1234 committed Sep 3, 2017
    Copy the full SHA
    aaa5ade View commit details
  2. Update Sim800L.cpp

    vittorioexp authored Sep 3, 2017
    Copy the full SHA
    a4fb2c3 View commit details
  3. Copy the full SHA
    e0a44d7 View commit details

Commits on Sep 10, 2017

  1. Merge pull request #9 from per1234/keyword-separator

    Use correct separator in keywords.txt
    vittorioexp authored Sep 10, 2017
    Copy the full SHA
    c685956 View commit details
  2. Copy the full SHA
    f8933f6 View commit details

Commits on Oct 14, 2020

  1. Copy the full SHA
    8596ac1 View commit details

Commits on Oct 20, 2020

  1. Merge pull request #20 from sekyHC/master

    Waiting for CMGS when sending the message
    vittorioexp authored Oct 20, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b3f5cf9 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5b52e4b View commit details

Commits on Oct 22, 2020

  1. Changed how SMS receiving is handled

    checkForSms will return index of received sms
    sekyHC committed Oct 22, 2020
    Copy the full SHA
    6da8b6c View commit details

Commits on Nov 6, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f7224c7 View commit details

Commits on Nov 15, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    339ee19 View commit details
  2. Merge pull request #22 from njh/patch-1

    Update url in library.properties
    vittorioexp authored Nov 15, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    834ea13 View commit details
  3. Merge pull request #21 from sekyHC/master

    Changed how SMS receiving is handled
    vittorioexp authored Nov 15, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1c992b4 View commit details

Commits on Dec 19, 2020

  1. fix: GSM have to be uppercase

    Leon Braun authored Dec 19, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a9c668b View commit details

Commits on Dec 24, 2020

  1. Merge pull request #23 from OBrown92/patch-1

    fix: GSM have to be uppercase
    vittorioexp authored Dec 24, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e6f79bd View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0f34871 View commit details

Commits on Feb 4, 2021

  1. improved sms receiving

    sekyHC committed Feb 4, 2021
    Copy the full SHA
    a6e3460 View commit details

Commits on Feb 6, 2021

  1. Merge pull request #24 from sekyHC/master

    improved sms receiving
    vittorioexp authored Feb 6, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0c3706f View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b4322b3 View commit details

Commits on Sep 7, 2021

  1. Update README.md

    vittorioexp authored Sep 7, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    39ea338 View commit details

Commits on Oct 12, 2022

  1. Update README.md

    vittorioexp authored Oct 12, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d14dd04 View commit details
  2. Update README.md

    vittorioexp authored Oct 12, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b214c51 View commit details
  3. Update README.md

    vittorioexp authored Oct 12, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b3d031c View commit details
  4. Update README.md

    vittorioexp authored Oct 12, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    aaa68a7 View commit details
  5. Update README.md

    vittorioexp authored Oct 12, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1515111 View commit details
  6. Update README.md

    vittorioexp authored Oct 12, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    60d936a View commit details

Commits on Jan 13, 2023

  1. Update README.md

    vittorioexp authored Jan 13, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    12a8ef4 View commit details
  2. Update README.md

    vittorioexp authored Jan 13, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    db20e20 View commit details
Showing with 292 additions and 183 deletions.
  1. +86 −31 README.md
  2. +68 −23 Sim800L.cpp
  3. +3 −2 Sim800L.h
  4. +107 −107 examples/GSM_Coordinates/GSM_Coordinates.ino
  5. +20 −12 examples/readSms/readSms.ino
  6. +6 −6 keywords.txt
  7. +2 −2 library.properties
117 changes: 86 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,117 @@
## Library Sim800L Module for Arduino UNO
The Purpose of This library is to use the module in the most easy way and transparent.
Website: [Sim800L library](https://github.com/VittorioEsposito/Sim800L-revised)
Sim800L Arduino Library revised
=====

Original version by: [Cristian Steib] (https://github.com/cristiansteib)
The SIM800L Arduino Library is a simple and easy-to-use library for the SIM800L module, allowing for quick and efficient communication with the module using the Arduino platform.


Go to arduino IDE Sketch >> Import Library >> add library... Select the folder Sim800L-revised
Features
---

OR
* Simplifies the initialization and configuration of the SIM800L module
* Provides a set of easy-to-use functions for sending and receiving SMS messages
* Supports making and receiving phone calls
* Includes example sketches to demonstrate the library's capabilities

Place the Sim800L library folder your ArduinoSketchFolder/libraries/ folder.
You may need to create the libraries subfolder if its your first library. Restart the IDE.

Installation
---

## connections & pinouts (DEFAULT)
Arduino Uno | Sim800L | Notes
-------------|-------------|------------
+5v| (3.8v)~(4.4v)!| Power supply input
10 RX_PIN | TX |
11 TX_PIN | RX |
2 RESET_PIN | RST| Reset Pin
GND | GND |
You can install the Sim800L Arduino Library in the Arduino IDE by going to Sketch > Include Library > Manage Libraries, searching for "Sim800L" and clicking on the "install" button.
Alternatively, you can download the library files from the GitHub repository and install it by going to Sketch > Include Library > Add .ZIP Library and selecting the downloaded files.


* If it returns true there is an error
Usage
---

## Methods and functions
To use the library, simply include the library in your sketch and create an instance of the SIM800L class. The library provides a set of functions for sending and receiving SMS messages, making and receiving phone calls, and more.

For example, to send an SMS message, you can use the following code:
```
#include <Sim800L.h>
Sim800L Sim800L(10, 11); // RX_PIN and TX_PIN
void setup(){
Sim800L.begin(4800);
Sim800L.sendSms("+1234567890","Hello world!");
}
void loop(){
//do nothing
}
```



Collaboration
---

This is an open-source project and I'm currently looking for more collaborators to help grow and improve it. If you're interested, feel free to submit your pull request to the GitHub repository.


Connecting the SIM800L to the Arduino
---

Before you can use the Sim800L Arduino Library, you need to physically connect the SIM800L module to your Arduino board.

1. Connect the SIM800L's GND pin to the GND pin on the Arduino board
2. Connect the SIM800L's VCC pin to the 3.3V pin on the Arduino board
3. Connect the SIM800L's RX pin to the TX pin on the Arduino board (default is pin 11)
4. Connect the SIM800L's TX pin to the RX pin on the Arduino board (default is pin 10)
5. Connect the SIM800L's RST pin to the RESET pin on the Arduino board (default is pin 2)

It is important to note that the SIM800L module requires a stable power supply of at least 2A, it is strongly recommended to use an external power supply to power the SIM800L module.
The SIM800L's VCC pin should be connected to the 3.3V pin on the Arduino board. Connecting it to the 5V pin may damage the module as it operates on 3.3V voltage level. It is important to ensure the voltage level is compatible with the module's specifications to avoid any damage.


Function List
---

Here is a list of functions that can be called on an instance of the SIM800L class:

Name|Return|Notes
:-------|:-------:|:-----------------------------------------------:|
begin()|None|Initialize the library
begin(number)|None|Initialize the library with user's baud rate
begin()|None|Initialize the module with a defalt baud rate
begin(number)|None|Initialize the module with a custom baud rate
reset()|None|Reset the module, and wait to Sms Ready.
setSleepMode(bool)|true or false|enable or disable sleep mode *
getSleepMode()|true or false|return sleep mode status *
setFunctionalityMode(number)|true or false|set functionality mode *
getFunctionalityMode()|true or false|return functionality mode status *
setPIN(String)|true or false|enable user to set a pin code *
setSleepMode(bool)|bool|enable or disable sleep mode. If it returns true, there is an error.
getSleepMode()|bool|return sleep mode status. If it returns true, there is an error.
setFunctionalityMode(number)|bool|set functionality mode. If it returns true, there is an error.
getFunctionalityMode()|bool|return functionality mode status. If it returns true, there is an error.
setPIN(String)|bool|enable user to set a pin code. If it returns true, there is an error.
getProductInfo()|String|return product identification information
getOperatorsList()|String|return the list of operators
getOperator()|String|return the currently selected operator
calculateLocation()|true or false|calculate gsm position *
calculateLocation()|bool|calculate gsm position. If it returns true, there is an error.
getLocationCode()|String|return the location code
getLongitude()|String|return longitude
getLatitude()|String|return latitude
sendSms(number,text)|true or false|both parameters must be Strings. *
sendSms(number,text)|bool|both parameters must be Strings. If it returns true, there is an error.
readSms(index)|String|index is the position of the sms in the prefered memory storage
getNumberSms(index)|String|returns the number of the sms.
delAllSms()|true or false|Delete all sms *
delAllSms()|bool|Delete all sms. If it returns true, there is an error.
signalQuality()|String|return info about signal quality
answerCall()|true or false| *
answerCall()|bool| If it returns true, there is an error.
callNumber(number)|None|
hangoffCall()|true or false| *
hangoffCall()|bool| If it returns true, there is an error.
getCallStatus()|uint8_t|Return the call status, 0=ready,2=Unknown(),3=Ringing,4=Call in progress
setPhoneFunctionality()|None|Set at to full functionality
activateBearerProfile()|None|
deactivateBearerProfile()|None|
RTCtime(int *day,int *month, int *year,int *hour,int *minute, int *second)|None| Parameters must be reference ex: &day
dateNet()|String|Return date time GSM
updateRtc(utc)|true or false|Return if the rtc was update with date time GSM.
updateRtc(utc)|bool|Return if the rtc was update with date time GSM.
____________________________________________________________________________________



License
---

The Sim800L Arduino Library revised by Vittorio Esposito is open-source software and is licensed under the GPL-3.0 license.


Credits
---

Original version of the library by: [Cristian Steib] (https://github.com/cristiansteib)
91 changes: 68 additions & 23 deletions Sim800L.cpp
Original file line number Diff line number Diff line change
@@ -201,7 +201,6 @@ uint8_t Sim800L::getFunctionalityMode()
return _functionalityMode;
}


bool Sim800L::setPIN(String pin)
{
String command;
@@ -260,14 +259,17 @@ bool Sim800L::calculateLocation()

uint8_t type = 1;
uint8_t cid = 1;



String tmp = "AT+CIPGSMLOC=" + String(type) + "," + String(cid) + "\r\n";
this->SoftwareSerial::print(tmp);

/*
this->SoftwareSerial::print("AT+CIPGSMLOC=");
this->SoftwareSerial::print(type);
this->SoftwareSerial::print(",");
this->SoftwareSerial::print(cid);
this->SoftwareSerial::print("\r");

*/

String data = _readSerial(20000);

@@ -423,7 +425,7 @@ void Sim800L::callNumber(char* number)
{
this->SoftwareSerial::print (F("ATD"));
this->SoftwareSerial::print (number);
this->SoftwareSerial::print (F("\r\n"));
this->SoftwareSerial::print (F(";\r\n"));
}


@@ -477,17 +479,58 @@ bool Sim800L::sendSms(char* number,char* text)
_buffer=_readSerial();
this->SoftwareSerial::print((char)26);
_buffer=_readSerial(60000);
// Serial.println(_buffer);
//expect CMGS:xxx , where xxx is a number,for the sending sms.
if ( (_buffer.indexOf("ER")) == -1)
{
if ((_buffer.indexOf("ER")) != -1) {
return true;
} else if ((_buffer.indexOf("CMGS")) != -1) {
return false;
}
else return true;
} else {
return true;
}
// Error found, return 1
// Error NOT found, return 0
}


bool Sim800L::prepareForSmsReceive()
{
// Configure SMS in text mode
this->SoftwareSerial::print(F("AT+CMGF=1\r"));
_buffer=_readSerial();
//Serial.print(_buffer);
if((_buffer.indexOf("OK")) == -1)
{
return false;
}
this->SoftwareSerial::print(F("AT+CNMI=2,1,0,0,0\r"));
_buffer=_readSerial();
//Serial.print(_buffer);
if((_buffer.indexOf("OK")) == -1)
{
return false;
}
return true;
}

const uint8_t Sim800L::checkForSMS()
{
_buffer = _readSerial(100);
if(_buffer.length() == 0)
{
return 0;
}
_buffer += _readSerial(1000);
// Serial.println(_buffer);
// +CMTI: "SM",1
if(_buffer.indexOf("CMTI") == -1)
{
return 0;
}
return _buffer.substring(_buffer.indexOf(',')+1).toInt();
}


String Sim800L::getNumberSms(uint8_t index)
{
_buffer=readSms(index);
@@ -508,25 +551,27 @@ String Sim800L::getNumberSms(uint8_t index)

String Sim800L::readSms(uint8_t index)
{

// Can take up to 5 seconds

this->SoftwareSerial::print (F("AT+CMGF=1\r"));
if(( _readSerial(5000).indexOf("ER")) != -1)
{
return "";
}

if (( _readSerial(5000).indexOf("ER")) ==-1)
this->SoftwareSerial::print (F("AT+CMGR="));
this->SoftwareSerial::print (index);
this->SoftwareSerial::print ("\r");
_buffer=_readSerial();
//Serial.println(_buffer);
if (_buffer.indexOf("CMGR") == -1)
{
this->SoftwareSerial::print (F("AT+CMGR="));
this->SoftwareSerial::print (index);
this->SoftwareSerial::print ("\r");
_buffer=_readSerial();
if (_buffer.indexOf("CMGR:")!=-1)
{
return _buffer;
}
else return "";
return "";
}
else
return "";

_buffer = _readSerial(10000);
byte first = _buffer.indexOf('\n', 2) + 1;
byte second = _buffer.indexOf('\n', first);
return _buffer.substring(first, second);
}


5 changes: 3 additions & 2 deletions Sim800L.h
Original file line number Diff line number Diff line change
@@ -74,7 +74,6 @@
#define DEFAULT_BAUD_RATE 9600
#define TIME_OUT_READ_SERIAL 5000


class Sim800L : public SoftwareSerial
{
private:
@@ -91,7 +90,6 @@ class Sim800L : public SoftwareSerial
String _readSerial();
String _readSerial(uint32_t timeout);


public:

uint8_t RX_PIN;
@@ -130,6 +128,8 @@ class Sim800L : public SoftwareSerial
bool hangoffCall();
uint8_t getCallStatus();

const uint8_t checkForSMS();
bool prepareForSmsReceive();
bool sendSms(char* number,char* text);
String readSms(uint8_t index);
String getNumberSms(uint8_t index);
@@ -140,6 +140,7 @@ class Sim800L : public SoftwareSerial
void setPhoneFunctionality();
void activateBearerProfile();
void deactivateBearerProfile();
bool setMode();

void RTCtime(int *day,int *month, int *year,int *hour,int *minute, int *second);
String dateNet();
Loading