For those who have purchased a DFROBOT SIM7000 and was unable to get it working with the supplied library, I will present to you a guide in how I rectified the issue.
Firstly, I would like to thank the creator of this library BOTLETICS.
The Wiring
The square antenna is plugged into the GNSS socket.
The rectangle flat antenna is plugged into the GSM/LTE socket.
Set RX/TX switch to 7/8.
Insert Sim Card, mine works with a Telstra IOT simcard, I have not yet tested with a regular sim, will update when trialled.
Plug the shield into an Arduino UNO and power the UNO through the DC Barrel Jack with 9-12v as stated.
The Code
Download the library from the BOTLETICS GITHUB. This will be titled, ADAFRUIT_FONA_MASTER. Load up the example sketch titled SIM7XXX_LTE_DEMO. Change the following variables.
#define FONA_PWRKEY 12
#define FONA_TX 8
#define FONA_RX 7
If this is the first time starting the unit, leave the following code.
fonaSS.begin(115200);
The program will then set the baud to 9600, the SIM7000E remembers the baud.
Depending on your simcard, modify uncomment/comment the following code. In this example, I am using a telstra IOT simcard.
//fona.setNetworkSettings(F("your APN"), F("your username"), F("your password"));
//fona.setNetworkSettings(F("m2m.com.attz")); // For AT&T IoT SIM card
fona.setNetworkSettings(F("telstra.internet")); // For Telstra (Australia) SIM card - CAT-M1 (Band 28)
//fona.setNetworkSettings(F("hologram")); // For Hologram SIM card
Upload sketch to Arduino Uno, and open serial port at 9600 baud.
To configure HTTP, I had to add some additional code into the ADAFRUIT_FONA.CPP library to designate a bearer. Additionally, to ensure reliability, I added lines to close the bearer.
boolean Adafruit_FONA::postData(const char *request_type, const char *URL, const char *body, const char *token, uint32_t bodylen) {
// NOTE: Need to open socket/enable GPRS before using this function
// char auxStr[64];
// Make sure HTTP service is terminated so initialization will run
sendCheckReply(F("AT+HTTPTERM"), ok_reply, 10000);
sendCheckReply(F("AT+CIPSHUT"), ok_reply, 10000);
sendCheckReply(F("AT+SAPBR=3,1,\"APN\",\"telstra.internet\""), ok_reply, 10000);
sendCheckReply(F("AT+SAPBR=1,1"), ok_reply, 10000);
getReply(F("AT+SAPBR=2,1"));
// Initialize HTTP service
if (! sendCheckReply(F("AT+HTTPINIT"), ok_reply, 10000))
return false;
// Set HTTP parameters
if (! sendCheckReply(F("AT+HTTPPARA=\"CID\",1"), ok_reply, 10000))
return false;
// Specify URL
char urlBuff[strlen(URL) + 22];
sprintf(urlBuff, "AT+HTTPPARA=\"URL\",\"%s\"", URL);
if (! sendCheckReply(urlBuff, ok_reply, 10000))
return false;
// Perform request based on specified request Type
if (strlen(body) > 0) bodylen = strlen(body);
if (request_type == "GET") {
if (! sendCheckReply(F("AT+HTTPACTION=0"), ok_reply, 10000))
return false;
}
else if (request_type == "POST" && bodylen > 0 ) { // POST with content body
if (! sendCheckReply(F("AT+HTTPPARA=\"CONTENT\",\"application/x-www-form-urlencoded\""), ok_reply, 10000))
return false;
if (strlen(token) > 0) {
char tokenStr[strlen(token) + 55];
sprintf(tokenStr, "AT+HTTPPARA=\"USERDATA\",\"Authorization: Bearer %s\"", token);
if (! sendCheckReply(tokenStr, ok_reply, 10000))
return false;
}
char dataBuff[sizeof(bodylen) + 20];
sprintf(dataBuff, "AT+HTTPDATA=%d,10000", bodylen);
if (! sendCheckReply(dataBuff, "DOWNLOAD", 10000))
return false;
delay(100); // Needed for fast baud rates (ex: 115200 baud with SAMD21 hardware serial)
if (! sendCheckReply(body, ok_reply, 10000))
return false;
if (! sendCheckReply(F("AT+HTTPACTION=1"), ok_reply, 10000))
return false;
}
else if (request_type == "POST" && bodylen == 0) { // POST with query parameters
if (! sendCheckReply(F("AT+HTTPACTION=1"), ok_reply, 10000))
return false;
}
else if (request_type == "HEAD") {
if (! sendCheckReply(F("AT+HTTPACTION=2"), ok_reply, 10000))
return false;
}
// Parse response status and size
uint16_t status, datalen;
readline(10000);
if (! parseReply(F("+HTTPACTION:"), &status, ',', 1))
return false;
if (! parseReply(F("+HTTPACTION:"), &datalen, ',', 2))
return false;
DEBUG_PRINT("HTTP status: "); DEBUG_PRINTLN(status);
DEBUG_PRINT("Data length: "); DEBUG_PRINTLN(datalen);
if (status != 200) {
getReply(F("AT+SAPBR=0,1"));
getReply(F("AT+HTTPTERM"));
return false;
}
getReply(F("AT+HTTPREAD"));
readline(10000);
DEBUG_PRINT("\t<--- "); DEBUG_PRINTLN(replybuffer); // Print out server reply
// Terminate HTTP service
sendCheckReply(F("AT+HTTPTERM"), ok_reply, 10000);
getReply(F("AT+SAPBR=0,1"));
return true;
}
Any problems, I will try my best to rectify.
Personally, I downloaded AT COMMAND TESTER:
https://m2msupport.net/m2msupport/download-at-command-tester-for-simcom-modules/
Installed the drivers from the BOTLETICS GITHUB, connected to my PC with a micro-usb whilst the unit was powered from an Arduino with a basic sketch like:
void setup() {
pinMode(12,OUTPUT);
digitalWrite(12,HIGH);
}
void loop() {
delay(1000);
}
And programmed via Command Tester. The tester was extremely useful in determining what AT commands needed to be sent and when, and to initialize the AT+COPS? as some units did not automatically register to the network.