background image

  #include <DFRobot_sim808.h>

  DFRobot_SIM808 sim808(&Serial);

  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();
    }

  }

USB Debugging (AT command)

In this section, we will send AT commands through the serial port to debug SIM808 expansion shield. Please refer to SIM808 AT command set for more function.

Preparation

Hardware:

Arduino UNO x1
SIM808 expansion board x1
External power supply x1

Software :

Arduino IDE Click to Download Arduino IDE from Arduino® (https://www.arduino.cc/en/Main/Software)
Serial debugging assistant (In this section, we are using DF Serial Debugger by Lisper
(https://github.com/leffhub/DFRobotSIM808_Leonardo_mainboard/raw/master/Software/DF%20Serial%20Debugger.exe))

‘’‘STEP’‘’

1. Plug your SIM card on the SIM808 expansion shield and plug the expansion shield on Arduino UNO, meanwhile don't forget to connect an external power

source.

2. Dial the function switch to None, download a sample code Blink to make sure the serial port is not occupied.

Содержание TEL0097

Страница 1: ...n SIM908 SIM808 made some improvement on the performance and stability In addition to the normal SMS and phone functions the shield also supports MMS DTMF FTP and other functions You can achieve the d...

Страница 2: ...e with PC to make a debug AT debugging 3 Arduino When the expansion board plugged on the Arduino dial to here to make SIM808 communicate with Arduino Arduino Examples In this SIM808 Arduino Shields tu...

Страница 3: ...sim808 init delay 1000 Serial print Sim808 init error r n Serial println Sim808 init success Serial println Start to call Call specified number sim808 callUp PHONE_NUMBER void loop nothing to do Send...

Страница 4: ...lease call or send SMS message to me void loop Wait serial data if sim808 readable sim808_read_buffer gprsBuffer 32 DEFAULT_TIMEOUT Serial print gprsBuffer Detect the current state of the telephone or...

Страница 5: ...if messageIndex 0 sim808 readSMS messageIndex message MESSAGE_LENGTH phone datetime In order not to full SIM Memory is better to delete it sim808 deleteSMS messageIndex Serial print From number Serial...

Страница 6: ...nect 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...

Страница 7: ...ial 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 USB Debugging AT command I...

Страница 8: ...08 chip through the serial port assistant Make a Phone Call wiki index php File TEL0097_Phone_call png Make a Phone Call Send AT in the serial port assistant if it returns OK it means that serial comm...

Страница 9: ...wiki index php File TEL0097_Send_Message png Send Message Read SMS wiki index php File TEL0097_Read_Message png Read Message TCP Communication...

Страница 10: ...More exciting instruction please refer to AT command on the page of the end These two test code are very simple and easy to be understood Only need to enter the corresponding serial AT commands you wo...

Страница 11: ...Series GNSS Application Note V1 00 https github com leffhub DFRobotSIM808_Leonardo_mainboard raw master Documents NEW 20SIM800 20Series_GNSS_Application 20Note 20V1 00 pdf SIM800 Series AT Command Ma...

Отзывы: