0

i have problem with initialization DFRobot SIM808 actually when i try to recieve gps data by SoftwareSerial only it does works (i mean examples based on sending and reading command to and from serial's), and recieve data but very long string of data and i need only Latitude and Longitude and i think using DFRobot will be the easiest way to extract the data i need. So the simple test program like this one is not working:

    /*
### Get GPS data
1. This example is used to test SIM808 GPS/GPRS/GSM Shield's reading GPS data.
2. Open the SIM808_GetGPS example or copy these code to your project
3. Download and dial the function switch to Arduino
4. open serial helper
4. Place it outside, waiting for a few minutes and then it will send GPS data to serial

create on 2016/09/23, version: 1.0
by jason

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

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



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

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

  //************* Turn on the GPS power************
  if( sim808.attachGPS())
      Serial.println("Open the GPS power success");
  else 
      Serial.println("Open the GPS power failure");

}

void loop() {
   //************** Get GPS data *******************
   if (sim808.getGPS()) {
    Serial.print(sim808.GPSdata.year);
    Serial.print("/");
    Serial.print(sim808.GPSdata.month);
    Serial.print("/");
    Serial.print(sim808.GPSdata.day);
    Serial.print(" ");
    Serial.print(sim808.GPSdata.hour);
    Serial.print(":");
    Serial.print(sim808.GPSdata.minute);
    Serial.print(":");
    Serial.print(sim808.GPSdata.second);
    Serial.print(":");
    Serial.println(sim808.GPSdata.centisecond);
    Serial.print("latitude :");
    Serial.println(sim808.GPSdata.lat);
    Serial.print("longitude :");
    Serial.println(sim808.GPSdata.lon);
    Serial.print("speed_kph :");
    Serial.println(sim808.GPSdata.speed_kph);
    Serial.print("heading :");
    Serial.println(sim808.GPSdata.heading);
    Serial.println();

    //************* Turn off the GPS power ************
    sim808.detachGPS();
  }

}

error

  • SoftwareSerial accepts the pins in RX, TX order. You have them backwards. This may not be the issue depending on your wiring, but it's the first thing I noticed. – stevieb Jul 25 '17 at 11:43
  • yea some mistake in template but it is (7,8) anyways, same as in working example – Dave M Jul 25 '17 at 14:44
  • I have the same issue were you able to resolve? – Jamie Jul 27 '17 at 7:44
  • Nope, i just wrote my code instead using library :( . Resolving it would be still useful – Dave M Jul 27 '17 at 7:58
  • I have tried to run the sim808 shield with the source code from above and also with the Dave's code. Without success. I have the external power supply, I switch between the different modes when uploading the code. I receive on the serial monitor either Sim808 init error or GPS initializing. Do you have any suggestions where to start troubleshooting? – nmih Nov 3 '17 at 21:35
0

Actually, I resolved this problem writing my own code, sample provided here: http://mienik.net/extract-latitude-longitude-and-more-without-libraries-gps-sim808-sim900-and-other-on-arduino-uno/

  • sorry, it didn't work for me, I just got "GPS initializing" repeated ad nauseum. – Hamish_Fernsby May 9 '18 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.