Trouble Using SIM808 with Arduino Uno

I am trying to connect the SIM808 shield with the Arduino Uno in order to collect GPS and sensing data to then send to a database (such as ThinkSpeak. Right now when I run the SIM808_GetGPS.ino code I am receiving the following error: "Sim808 init error." The SIM808 board is directly connected to the Uno and the Arduino is powered using a battery. Is there an example setup tutorial that shows the correct way to connect the two boards and run software? Does the SIM808 board require external power? Additionally, for the sim card I am using a sim card purchased from Particle but I am wondering if there is a sim card that is more compatible.

Below is the code I used:

/*!
 * @file  SIM808_GetGPS.ino
 * @brief  Get GPS data
 * @details  1. This example is used to test SIM808 GPS/GPRS/GSM Shield's reading GPS data.
 * @n        2. Open the SIM808_GetGPS example or copy these code to your project
 * @n        3. Download and dial the function switch to Arduino
 * @n        4. open serial helper
 * @n        4. Place it outside, waiting for a few minutes and then it will send GPS data to serial
 * @copyright  Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @license  The MIT License (MIT)
 * @author  [Jason](jason.ling@dfrobot.com)
 * @maintainer  [qsjhyy](yihuan.huang@dfrobot.com)
 * @version  V1.0
 * @date  2022-02-08
 * @url  https://github.com/DFRobot/DFRobot_SIM808
 */
#include <DFRobot_SIM808.h>

/**
 * Besides push-in connection with expansion board, it can also be connected by jump wires
 * Set DIP switch to 3-Arduino, open the following macro
 * Connect the main controller to the module with Dupont wires:
 *  Arduino | module
 *   PIN_TX |  TX1
 *   PIN_RX |  RX1
 * Power the module, which is successful when the power indicator on the module is ON
 */
// #define CONNECT_BY_JUMPER   1
#if CONNECT_BY_JUMPER
  #define PIN_TX    10
  #define PIN_RX    11
  SoftwareSerial mySerial(PIN_TX, PIN_RX);
  DFRobot_SIM808 sim808(&mySerial);
/**
 * Use Leonardo for push-in connection
 * Set DIP switch to 3-Arduino, and use the Serial1 of Leonardo for communication
 */
#elif defined(ARDUINO_AVR_LEONARDO)
  DFRobot_SIM808 sim808(&Serial1);
/**
 * Use UNO & MEGA2560 for push-in connection
 * Set DIP switch to 3-Arduino, and use the Serial of UNO and MEGA2560 for communication
 */
#else
  DFRobot_SIM808 sim808(&Serial);
#endif

void setup() {
  #if CONNECT_BY_JUMPER
    mySerial.begin(9600);
  #elif defined(ARDUINO_AVR_LEONARDO)
    Serial1.begin(9600);
  #endif
  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,6);
    
    sim808.latitudeConverToDMS();
    Serial.print("latitude :");
    Serial.print(sim808.latDMS.degrees);
    Serial.print("\^");
    Serial.print(sim808.latDMS.minutes);
    Serial.print("\'");
    Serial.print(sim808.latDMS.seconeds,6);
    Serial.println("\"");
    Serial.print("longitude :");
    Serial.println(sim808.GPSdata.lon,6);
    sim808.LongitudeConverToDMS();
    Serial.print("longitude :");
    Serial.print(sim808.longDMS.degrees);
    Serial.print("\^");
    Serial.print(sim808.longDMS.minutes);
    Serial.print("\'");
    Serial.print(sim808.longDMS.seconeds,6);
    Serial.println("\"");
    
    Serial.print("speed_kph :");
    Serial.println(sim808.GPSdata.speed_kph);
    Serial.print("heading :");
    Serial.println(sim808.GPSdata.heading);

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

}
type or paste code here

have a reaad of how-to-get-the-best-out-of-this-forum
what SIM808 module are you using? give a link?
how have you connected the SIM808 to the UNO?
in particular how are you powering it?
can you send it AT commands and get a response?

I am using Sim808 GSM/GPRS/GPS IoT Board. This is the link: SIM808 GSM/GPRS/GPS IoT Board (Arduino Leonardo Compatible) - DFRobot. I have connected the SIM808 and the UNO directly by placing the SIM808 pins directly on top of the UNO pins. I am currently powering the UNO with a 9V battery. I have not been getting responses from AT commands being sent.

what are you using the UNO for ?
the link in post 3 is to a SIM808_with_Leonardo_mainboard
connect a PC to the USB port and you should be able to use the Leonardo to communicate with the SIM808 using AT commands

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.