Giter Site home page Giter Site logo

arduino-sim808's People

Contributors

blemasle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

arduino-sim808's Issues

setBearerSetting in SIM808.Gprs.cpp return nothing

hi, it's good to see your work, i'm trying to run example of the code "HttpPost" with some editing code.

now i'm facing issue when checking sim808.enableGprs, it's stuck looping with:

N: Powering on SIM808's GPRS...
N: Powering on SIM808's GPRS...
...

after that i #define _DEBUG on the top of the code, but still the result still the same.
so i change directly _SIM808_DEBUG with 1. then it show some more like this:

N: Powering on SIM808's GPRS...

-->AT+CIPSHUT
<--
<--SHUT OK

-->AT+CGATT=1
<--
<--OK

-->AT+SAPBR=0,1
<--
<--ERROR

-->AT+SAPBR=3,1,"CONTYPE","GPRS"
<--
<--OK

-->AT+SAPBR=3,1,"",""
<--
<--ERROR
0
N: Powering on SIM808's GPRS...

the AT+SAPBR=3,1,"CONTYPE","GPRS" is after error AT+SAPBR=3,1,"",""
so i change it just like your bugfix in here. but the rest of SAPBR setting still error. it's just like nothing inserted.

i maybe can change it directly just like what you did with the CONTYPE setting, bbut i think it will be trouble in the future if it not changed in the main code.
could you please trace what happened in here?

well, i'm not really understand with your AT_COMMAND_PARAMETER line either. where the variable BEARER and CONTYPE setting started?

Arduino Uno with SIM808 from DFRobot

Hi Bertrand
I am using your SIM808 library on an an Arduino Uno and a SIM808 GSM GPRS GPS shield from DFRobot.com. I have wired it to fit the way uou use the control ports 5 to 8 and it seems to work. I use the "Test" procedure and the SIM808 is powered up and it seems to find the GSM net (the blue NET LED is blinking every third second), but the program never returns from the Init procedure, as seen in the attached screendump.
Clipboard01
I have enabled debug in the SimComAT.h like this #define _SIM808_DEBUG 1 //_DEBUG , but no further messages arrived.
Finally I have connected SIM808 pin 16 RESET to D5 of UNO and shield without any change.
Do you any comments or hints for further investigations?

Compile Errror

Trying to use this library with the DFRobot SIM808 GSM/GPRS/GPS Arduino IOT Board (combined Leonardo & SIM808 board).

Using Arduino IDE version1.8.9 . Trying to compile the GeneralInformation sketch I get the following errors:

In file included from /home/david/arduino-1.8.9/hardware/tools/avr/avr/include/avr/io.h:144:0,
from /home/david/arduino-1.8.9/hardware/tools/avr/avr/include/avr/pgmspace.h:90,
from /home/david/arduino-1.8.9/hardware/arduino/avr/cores/arduino/Arduino.h:28,
from /tmp/arduino_build_260468/sketch/GeneralInformation.ino.cpp:1:
/home/david/Arduino/libraries/SIM808/src/SIM808.Types.h:80:2: error: expected identifier before numeric constant
SPEED = 6, ///< Speed over ground in km/h.

^
/home/david/Arduino/libraries/SIM808/src/SIM808.Types.h:80:2: error: expected '}' before numeric constant
/home/david/Arduino/libraries/SIM808/src/SIM808.Types.h:80:2: error: expected unqualified-id before numeric constant
In file included from /home/david/Arduino/libraries/SIM808/src/SIM808.h:4:0,
from /home/david/Arduino/libraries/SIM808/examples/GeneralInformation/GeneralInformation.ino:5:
/home/david/Arduino/libraries/SIM808/src/SIM808.Types.h:84:1: error: expected declaration before '}' token
};

^
Using library SIM808 at version 1.1.0 in folder: /home/david/Arduino/libraries/SIM808
Using library ArduinoLog at version 1.0.3 in folder: /home/david/Arduino/libraries/ArduinoLog
Using library SoftwareSerial at version 1.0 in folder: /home/david/arduino-1.8.9/hardware/arduino/avr/libraries/SoftwareSerial
exit status 1
Error compiling for board Arduino Leonardo.

Unsigned Integer Bug

uint16_t timeout = 2000;
do {
delay(150);
timeout -= 150;
currentlyPowered = powered();
} while(currentlyPowered != power && timeout > 0);

I think timeout on line 29 should be a 16-bit signed integer. Otherwise the timeout > 0 check on line 34 will always be true since timeout cannot go negative and cannot be 0 (2000 % 15 != 0).

I don't think a single line change warrants a whole pull request, but I can submit one if the author insists. I'm not sure what the Github etiquette is.

I could not return a correct result.

My code looks like this :

#include <DFRobot_sim808.h>
#include <SoftwareSerial.h>

#define PIN_TX 10
#define PIN_RX 11
SoftwareSerial mySerial(PIN_TX,PIN_RX);
DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,

char http_cmd[] = "GET /media/uploads/mbed_official/hello.txt HTTP/1.0\r\n\r\n";
char buffer[512];

void setup(){
mySerial.begin(9600);
Serial.begin(9600);

//******** Initialize sim808 module *************
while(!sim808.init()) {
    delay(1000);
    Serial.print("Sim808 init error\r\n");
}
delay(3000);

//*********** Attempt DHCP *******************
while(!sim808.join(F("cmnet"))) {
    Serial.println("Sim808 join network error");
    delay(2000);
}

//************ Successful DHCP ****************
Serial.print("IP Address is ");
Serial.println(sim808.getIPAddress());

//*********** Establish a TCP connection ************
if(!sim808.connect(TCP,"mbed.org", 80)) {
    Serial.println("Connect error");
}else{
    Serial.println("Connect mbed.org success");
}

//*********** Send a GET request *****************
Serial.println("waiting to fetch...");
sim808.send(http_cmd, sizeof(http_cmd)-1);
while (true) {
    int ret = sim808.recv(buffer, sizeof(buffer)-1);
    if (ret <= 0){
        Serial.println("fetch over...");
        break;
    }
    buffer[ret] = '\0';
    Serial.print("Recv: ");
    Serial.print(ret);
    Serial.print(" bytes: ");
    Serial.println(buffer);
    break;
}

//************* Close TCP or UDP connections **********
sim808.close();

//*** Disconnect wireless connection, Close Moving Scene *******
sim808.disconnect();

}

void loop(){

}

But, "Hello World" does not return the result :
Screenshot_1

ESP32 error

Hi everyone,
if i use that library with the ESP32 board, i receive this messages over a simple sketch:

#include <SIM808.h>
#include <ArduinoLog.h>

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}
In file included from /Users/dave/Documents/Arduino/libraries/SIM808/src/SIM808.h:3:0,
                 from /var/folders/91/_rb11v6d67gb2dd7q5k14td80000gn/T/arduino_modified_sketch_263358/AcquireGPSPosition.ino:5:
/Users/dave/Documents/Arduino/libraries/SIM808/src/SIMComAT.h:77:9: error: extra qualification 'SIMComAT::' on member 'readNext' [-fpermissive]
  size_t SIMComAT::readNext(char * buffer, size_t size, uint16_t * timeout = NULL, char stop = 0);

         ^
In file included from /Users/dave/Library/Arduino15/packages/esp32/hardware/esp32/1.0.1/cores/esp32/esp32-hal.h:53:0,
                 from /Users/dave/Library/Arduino15/packages/esp32/hardware/esp32/1.0.1/cores/esp32/Arduino.h:35,
                 from sketch/AcquireGPSPosition.ino.cpp:1:
/Users/dave/Library/Arduino15/packages/esp32/hardware/esp32/1.0.1/cores/esp32/esp32-hal-gpio.h:51:19: error: expected identifier before numeric constant
 #define DISABLED  0x00
                   ^
/Users/dave/Documents/Arduino/libraries/SIM808/src/SIM808.Types.h:62:2: note: in expansion of macro 'DISABLED'
  DISABLED = 4 ///< Disable phone both transmit and receive RF circuit.

  ^
/Users/dave/Library/Arduino15/packages/esp32/hardware/esp32/1.0.1/cores/esp32/esp32-hal-gpio.h:51:19: error: expected '}' before numeric constant
 #define DISABLED  0x00
                   ^
/Users/dave/Documents/Arduino/libraries/SIM808/src/SIM808.Types.h:62:2: note: in expansion of macro 'DISABLED'
  DISABLED = 4 ///< Disable phone both transmit and receive RF circuit.

  ^
/Users/dave/Library/Arduino15/packages/esp32/hardware/esp32/1.0.1/cores/esp32/esp32-hal-gpio.h:51:19: error: expected unqualified-id before numeric constant
 #define DISABLED  0x00
                   ^
/Users/dave/Documents/Arduino/libraries/SIM808/src/SIM808.Types.h:62:2: note: in expansion of macro 'DISABLED'
  DISABLED = 4 ///< Disable phone both transmit and receive RF circuit.

  ^
In file included from /Users/dave/Documents/Arduino/libraries/SIM808/src/SIM808.h:4:0,
                 from /var/folders/91/_rb11v6d67gb2dd7q5k14td80000gn/T/arduino_modified_sketch_263358/AcquireGPSPosition.ino:5:
/Users/dave/Documents/Arduino/libraries/SIM808/src/SIM808.Types.h:63:1: error: expected declaration before '}' token
 };

 ^
exit status 1
Error compiling for board ESP32 Wrover Module.

Board compatibility. Power, status and reset pins

Is this board compatible with this library? I don't know where should I connect status, reset and power pin.

I modded the library to work only with Serial tx rx pin connections, but it would be nice to have powerOnOff methods and other nice things developed here.
I suppose "RTS" is for reset, but what about power and status pin?

Waiting for RDY is not possible if Auto-Bauding is enabled

// we got AT, waiting for RDY
while (waitResponse(TO_F(TOKEN_RDY)) != 0);

As per the SIM808 manual:

When power on procedure is completed, SIM808 will send following URC to indicate that the module is ready to operate at fixed baud rate.

RDY

This URC does not appear when autobauding function is active.
Note: User can use AT command “AT+IPR=x” to set a fixed baud rate and save the configuration to non-volatile flash memory. After the configuration is saved as fixed baud rate, the Code “RDY” should be received from the serial port every time when SIM808 is powered on. For details, please refer to the chapter “AT+IPR” in document [1].

Unfortunately in the breakout board I have available, AT+IPR does not preserve its value (likely due to missing flash storage). It may make sense to only use the AT -> OK response for such situations

How to use HardwareSerial?

Hi,

i have this board: https://aax-eu.amazon-adsystem.com/x/c/QjB8EozTLRzWPqqyixda-WAAAAFvoFNo6QMAAAH2AbprfyI/https://www.amazon.de/gp/aw/d/B0721T8CDZ?pf_rd_p=5e2a70c8-77de-4865-9918-07306318c381&aaxitk=nVh5HqNk-xS66dwOeNpfGg&hsa_cr_id=6120989910702&ref_=sb_s_sparkle_slot

It's already working with AT commands but I can not get your library work. I have a Mega 2560 and tried:

HardwareSerial *simSerial = &Serial1;
SIM808 sim808 = SIM808(SIM_RST, SIM_PWR, SIM_STATUS);
char position[POSITION_SIZE];

void setup() {
    Serial.begin(SERIAL_BAUDRATE);
    Log.begin(LOG_LEVEL_NOTICE, &Serial);

    simSerial.begin(SIM808_BAUDRATE);
    sim808.begin(simSerial);```

But the error is: 
request for member 'begin' in 'simSerial', which is of pointer type 'HardwareSerial*' (maybe you meant to use '->' ?)

Thanks for help!

Why is the reset pin required?

According to the SIM808 docs, it seems that the reset pin is only for "emergency situations", i.e. when the device is not responding, or is in some kind of terminal error state.

Why is the reset pin required in the SIM808 constructor?

Hello estou enfrentando alguns problemas no exemplo para pegar a location position

Primeiramente parabens pelo trabalho, sou novo no mundo da programação e do IOT, e estou desenvolvendo um projeto para meu trabalho de conclusao de curso de ensino superior, e foi otmo encontrar esse seu trabalho e agradeço muito por disponibilizar ele gratuitamente.

In file included from /home/josevitor/Downloads/arduino-nightly/hardware/arduino/avr/cores/arduino/Arduino.h:232:0,
from sketch/Blink.ino.cpp:1:
/tmp/arduino_modified_sketch_705200/Blink.ino: In function 'void loop()':
/home/josevitor/Downloads/arduino-nightly/hardware/arduino/avr/cores/arduino/WString.h:38:28: warning: invalid conversion from 'const __FlashStringHelper*' to '__StrPtr {aka __FlashStringHelper*}' [-fpermissive]
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper >(PSTR(string_literal)))
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/Arduino/libraries/SIM808/src/SIMComAT.Common.h:9:22: note: in expansion of macro 'F'
#define S_F(x) F(x)
^
/tmp/arduino_modified_sketch_705200/Blink.ino:67:48: note: in expansion of macro 'S_F'
if(status == SIM808GpsStatus::Fix) state = S_F("Normal");
^~~
/home/josevitor/Downloads/arduino-nightly/hardware/arduino/avr/cores/arduino/WString.h:38:28: warning: invalid conversion from 'const __FlashStringHelper
' to '__StrPtr {aka __FlashStringHelper*}' [-fpermissive]
#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/Arduino/libraries/SIM808/src/SIMComAT.Common.h:9:22: note: in expansion of macro 'F'
#define S_F(x) F(x)
^
/tmp/arduino_modified_sketch_705200/Blink.ino:68:18: note: in expansion of macro 'S_F'
else state = S_F("Accurate");
^~~


esse erro a cima é o que esta retornando no console da IDE do arduino.

ArduinoLog.h is not available for arduino uno while compiling

while compiling arduino giving the following error in console of Arduino..

In file included from C:\Users\USER1\Documents\Arduino\libraries\arduino-sim808-master\src/SIM808.h:3:0,

             from E:\SIM808\SIM808_P1\SIM808_P1.ino:1:

C:\Users\USER1\Documents\Arduino\libraries\arduino-sim808-master\src/SIMComAT.h:4:24: fatal error: ArduinoLog.h: No such file or directory

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

warning: invalid conversion

hi, i am coming from python world to brutal arduino C and have an issue:

/home/ser/Arduino/gps-tracker-with-library/gps-tracker-with-library.ino: In function 'void loop()':
/home/ser/Arduino/gps-tracker-with-library/gps-tracker-with-library.ino:73:46: warning: invalid conversion from 'const __FlashStringHelper*' to '__StrPtr {aka __FlashStringHelper*}' [-fpermissive]
     if(status == SIM808GpsStatus::Fix) state = S_F("Normal");
                                              ^
/home/ser/Arduino/gps-tracker-with-library/gps-tracker-with-library.ino:74:16: warning: invalid conversion from 'const __FlashStringHelper*' to '__StrPtr {aka __FlashStringHelper*}' [-fpermissive]
     else state = S_F("Accurate");
                ^

it's your gps example with arduino 1.8.9 - is it something i should worry about? as i am not getting fix, which i am sure i should have, as i have it with simply accessing console without your library.

sim808 gps data appending with lat and lon

gpsdata.txt
[gps code.txt](https://github.com/blemasle/arduino-sim808/files/2983559/gps.co
`#include <SoftwareSerial.h>
#include<SPI.h>
#include<RF24.h>
// ce, csn pins
RF24 radio(9, 10);
SoftwareSerial sim808(7,8);
String gpsval;
//char phone_no[] = "xxxxxxx"; // replace with your phone no.
String data[5];
#define DEBUG true
String state,timegps,latitude,longitude;
String syb="@";
char c;
void setup() {
sim808.begin(9600);
Serial.begin(9600);
delay(50);
radio.begin();
radio.setPALevel(RF24_PA_MAX);
radio.setChannel(0x76);
radio.openWritingPipe(0xF0F0F0F0E1LL);
radio.enableDynamicPayloads();
radio.powerUp();
// sim808.print("AT+CSMP=17,167,0,0"); // set this parameter if empty SMS received
// delay(100);
// sim808.print("AT+CMGF=1\r");
// delay(400);

sendData("AT+CGNSPWR=1",1000,DEBUG);
delay(50);
sendData("AT+CGNSSEQ=RMC",1000,DEBUG);
delay(150);

}

void loop() {

sendTabData("AT+CGNSINF",1000,DEBUG);
if (state !=0) {
// Serial.println("State :"+state);
// Serial.println("Time :"+timegps);
Serial.print("Latitude :");
Serial.println(latitude);
Serial.println("Longitude :"+longitude);
gpsval = latitude+syb+longitude;
Serial.println("gpsval :"+gpsval);
// Length (with one extra character for the null terminator)
int str_len = gpsval.length() + 1;

// Prepare the character array (the buffer)
char char_array[str_len];

// Copy it over 
gpsval.toCharArray(char_array, str_len);

// Check the network regularly
// RF24NetworkHeader header(/to node/ other_node);
bool ok = radio.write(&char_array,sizeof(char_array));
if (ok)
Serial.println("ok.");
else
Serial.println("failed.");
// sim808.print("AT+CMGS="");
// sim808.print(phone_no);
// sim808.println(""");
//const char text[] = "Hello World is awesome";
//radio.write(&gpsval, sizeof(gpsval));
// delay(1000);
//delay(300);

// sim808.print("http://maps.google.com/maps?q=loc:");
// sim808.print(latitude);
// sim808.print(",");
// sim808.print (longitude);
// delay(200);
// sim808.println((char)26); // End AT command with a ^Z, ASCII code 26
// delay(200);
// sim808.println();
// delay(100);
// sim808.flush();
latitude.remove(0,10);
longitude.remove(0,10);

} else {
Serial.println("GPS Initialising...");
}
}

void sendTabData(String command , const int timeout , boolean debug){

sim808.println(command);
Serial.println(command);
long int time = millis();
int i = 0;

while((time+timeout) > millis()){
while(sim808.available()){
c = sim808.read();
if (c != ',') {
data[i] +=c;
delay(100);
} else {
i++;
}
if (i == 5) {
delay(100);
goto exitL;
}
}
}exitL:
if (debug) {
state = data[1];
timegps = data[2];
latitude = data[3];
longitude =data[4];
}
}
String sendData (String command , const int timeout ,boolean debug){
String response = "";
sim808.println(command);
long int time = millis();
int i = 0;

while ( (time+timeout ) > millis()){
while (sim808.available()){
char c = sim808.read();
response +=c;
}
}
if (debug) {
Serial.print(response);
}
return response;
}

`

Two serial ports

Hi,
I'm using two serial ports, in this library I was looking for the Serial.listen() function or similar, but I can not find it. Please help me, or tell me how I add this function.
Thank you.

bk-808

Hi,
I have that board: LINK
I connected only GND,PWRIN,TR,RX to arduino.
On my serial monitor I have only:
Waiting for echo... -->AT
if I connect sim808 directly to serial port on my laptop, and send "AT" command, the board response "OK".

Please help me :)

HTTPPost example is not working with vodafone sim

I've just opened the example, changed pins and apn configuration, enabled debug.
This is the output from serial monitor

N: Powering on SIM808...
Init...
Waiting for echo...

-->AT
Waiting for echo...

-->AT
<--�Waiting for echo...

-->AT
<--AT
<--OK
<--
<--RDY

-->ATE0
<--
<--+CFUN: 1
<--
<--+CPIN: READY
<--ATE0
<--OK

-->AT+CGREG?
<--
<--+CGREG: 0,2
<--
<--OK

-->AT+CSQ
<--
<--+CSQ: 0,0
<--
<--OK
N: No network yet...

-->AT+CGREG?
<--
<--Call Ready
<--
<--SMS Ready
<--
<--+CGREG: 0,1
<--
<--OK

-->AT+CSQ
<--
<--+CSQ: 16,0
<--
<--OK
N: Network is ready.
N: Attenuation : -82 dBm, Estimated quality : 16
N: Powering on SIM808's GPRS...

-->AT+CIPSHUT
<--
<--SHUT OK

-->AT+CGATT=1
<--
<--OK

-->AT+CSTT="mobile.vodafone.it","",""
<--
<--OK

-->AT+SAPBR=1,1
<--
<--OK
N: Sending HTTP request...

-->AT+HTTPTERM
<--
<--ERROR

-->AT+HTTPINIT
<--
<--OK

-->AT+HTTPPARA="REDIR","1"
<--
<--OK

-->AT+HTTPPARA="CID","1"
<--
<--OK

-->AT+HTTPPARA="URL","http://httpbin.org/anything"
<--
<--OK

-->AT+HTTPPARA="CONTENT","text/plain"
<--
<--OK

-->AT+HTTPDATA=16,10000
<--
<--DOWNLOAD

-->This is the body<--
<--OK

-->AT+HTTPACTION=1
<--
<--OK
<--
<--+HTTPACTION: 1,601,0

-->AT+HTTPREAD=0,0
<--
<--ERROR
N: Server responsed : 601
N: This is the body

As you can see, in this example i didn't even changed the url, but it's not working with any url. HttpGet give the same error. Apn configuration is ok, my simcard is working and I can use with success http request by using this library. It handles both GPRS Setup and http request with different AT COMMANDS than those you used. For HTTP he is using TCP AT Commands, for GPRS Setup he is using a slightly different AT command flow and parameters (but i'm not an expert). I can't understand if the problem is with HTTP Commands or with GPRS Setup.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.