DFROBOT SIM7000E shield

Hi everyone, I’ve been really struggling with using this shield, I’m using it with an Arduino Uno R3.
I’ve been trying for a week to send a http request with it but I failed, it just stops showing anything when it gets to the httpPost command.
So please, if anyone managed to send http requests using it, reply to this post so that we can have a chat.

2 Likes

Hi Qosay,

We don’t sell that unit, so we may not be too much help, but could you start by sending through a photo of how you’ve got everything connected, and paste your code as a code block (``` ← either side)

Also give us some info about your SIM.

We’ll see what we can find for you!

Make sure that you are powering up this shield with a separate power supply. Powering the shield directly from the Arduino is not gonna work.

Hi Rooppoor, thanks for replying.
Yes, I had that problem and managed to solve it with a barrel cable.
However now I’m having a difficult time in sending an http request, even the example from the official DFROBOT is stopping and not showing anything when getting to the httpPost command.

Hello James, thank you for replying.
I’m using my regular sim card that I use with my phone, it’s from ‘Zain’, it’s has an active data plan.
I’m trying to send an http request to send the data (the location obtained from the shield’s GPS module) from the Arduino to the firebase.
However, when reaching the httpPost command, the shield’s led just keeps blinking rapidly without showing anything on the serial monitor.
Same thing happens when uploading the example from the DFROBOT library.
Here is the DFROBOT example and the serial monitor’s output:

#include <DFRobot_SIM7000.h>

#define PIN_TX     7
#define PIN_RX     8

//Login website (https://www.tlink.io/) to register an account ,fill the following information based on your account
#define deviceNo  "DEVICE NO" //Device serial number
#define sensorsId "SENSOR ID" //sensor ID
#define value     "VALUE"

//This URL is use for post data to tlink
#define POSTURL   "api.tlink.io/tlink_interface/api/device/createDataPonit.htm"
//This URL is use for get data from tlink, please change the SENSORID to your sensorsId
#define GETURL    "api.tlink.io/tlink_interface/api/device//getDataPoint_SENEORID.htm"

SoftwareSerial     mySerial(PIN_RX,PIN_TX);
DFRobot_SIM7000         sim7000(&mySerial);

void setup(){
  int signalStrength;
  Serial.begin(9600);
  mySerial.begin(19200);
  Serial.println("Turn ON SIM7000......");
  if(sim7000.turnON()){                                    //Turn ON SIM7000
    Serial.println("Turn ON !");
  }

  Serial.println("Set baud rate......");
  while(1){
    if(sim7000.setBaudRate(19200)){                      //Set SIM7000 baud rate from 115200 to 19200, reduce the baud rate to avoid distortion
      Serial.println("Set baud rate:19200");
      break;
    }else{
      Serial.println("Faile to set baud rate");
      delay(1000);
    }
  }

  Serial.println("Check SIM card......");
  if(sim7000.checkSIMStatus()){                            //Check SIM card
    Serial.println("SIM card READY");
  }else{
    Serial.println("SIM card ERROR, Check if you have insert SIM card and restart SIM7000");
    while(1);
  }

  Serial.println("Set net mode......");
  while(1){
    if(sim7000.setNetMode(sim7000.eGPRS)){                        //Set net mod GPRS
      Serial.println("Set GPRS mode");
      break;
    }else{
      Serial.println("Fail to set mode");
      delay(1000);
    }
  }

  Serial.println("Get signal quality......");
  delay(1500);
  signalStrength=sim7000.checkSignalQuality();             //Check signal quality from (0-30)
  Serial.print("signalStrength =");
  Serial.println(signalStrength);
  delay(500);

  Serial.println("Attaching service......");
  while(1){
    if(sim7000.attacthService()){                        //Open the connection
      Serial.println("Attach service");
      break;
    }else{
      Serial.println("Fail to Attach service");
      delay(1000);
    }
  }

  Serial.println("Init http......");
  while(1){
    if(sim7000.httpInit(sim7000.eGPRS)){                          //Init http service
      Serial.println("HTTP init !");
      break;
    }else{
      Serial.println("Fail to init http");
    }
  }

  Serial.print("POST to ");
  Serial.println(POSTURL);
  String httpbuff;
  httpbuff += "{\"deviceNo\":\"";                          //{
  httpbuff += deviceNo;                                    //   "deviceNo" : "DEVICE NO",
  httpbuff += "\",\"sensorDatas\":[{\"sensorsId\":";       //      "sensorDatas":[{
  httpbuff += sensorsId;                                   //          "sensorsId" :  SENSOR ID,
  httpbuff += ",\"value\":\"";                             //          "value"     : "  VALUE  "
  httpbuff += value;                                       //       }]
  httpbuff += "\"}]}";                                     //}
  while(1){
    if(sim7000.httpPost(POSTURL,httpbuff)){              //HTTP POST
      Serial.println("Post successed");
      break;
    }else{
      Serial.println("Fail to post");
    }
  }

  Serial.print("GET from ");
  Serial.println(GETURL);
  sim7000.httpGet(GETURL);                                 //HTTP GET
  Serial.println("Disconnect");
  sim7000.httpDisconnect();                                //Disconnect
  Serial.println("Close net work");
  sim7000.closeNetwork();                                  //Close network
  Serial.println("Turn off SIM7000");
  sim7000.turnOFF();                                       //Turn OFF SIM7000
}

void loop() {
  delay(1000);
}

This is what is shown on the serial monitor:

23:33:23.837 → Turn ON !
23:33:23.838 → Set baud rate…
23:33:24.858 → Set baud rate:19200
23:33:24.901 → Check SIM card…
23:33:27.491 → SIM card READY
23:33:27.523 → Set net mode…
23:33:29.830 → Set GPRS mode
23:33:29.862 → Get signal quality…
23:33:31.365 → signalStrength =23
23:33:31.865 → Attaching service…
23:33:43.065 → Attach service
23:33:43.065 → Init http…
23:33:46.162 → HTTP init !
23:33:46.162 → POST to api.tlink.io/tlink_interface/api/device/createDataPonit.htm

@James @Rooppoor212784
Thanks for reaching out guys, I really appreciate your responses.
The shield is successfully obtaining the location, but just like I said, the problem is in the httpPost, meaning it’s failing to send an http request, I’ve posted the serial monitor’s output of the example from the DFROBOT library, because the same thing is happening with me when running my sketch that’s trying to send an http request to the cloud function that I’ve created to store the data (longitude, latitude) in the cloud firestore of the firebase.
If any of you know how to solve the httpPost problem, please reach out again, because the due date of the project I’m working on is really near.

Hi Qosay,

Sorry for the delayed this response, I was poring over this for a while until I noticed this typo, that isn’t the problem, right? I’m unfamiliar with TLink stuff, so I have no idea whether the typo is in their API or your code.
image

1 Like

Adding to @James’ response, I wouldn’t be surprised if the example sketch doesn’t work unless you create an account at tlink.io.

For the sake of simplicity and to just confirm that things are working, I would replace the POSTURL and GETURL with httpbin.org URLs, which don’t require sign up.

The URL https://httpbin.org/post will just echo back whatever you posted to it (POSTURL).
The URL https://httpbin.org/get will just echo back your GET request, which will mostly just contain HTTP some headers (GETURL).

On a side note, it’s interesting that the URLs in the example don’t start with http:// or https://, if the above httpbin urls don’t work you may need to try them without the https:// prefix.

Good luck!

Jacob

1 Like