TroubleshootingArduino

SIM7600 not always sending data to web server

userHead allen.zeitman 2023-06-07 08:05:18 727 Views2 Replies

I'm having a problem with the sim7600.

First of all I never see the return codes from the AT commands

 

Second  not sure the leds that are blicking

I take it the 

   red one is power on

  Not sure what the one that is next to the red one that goes blue on then off

  The blue onee that blicks I take it meansthe sim card iss connected

I can send an SMS with no problem with the test commands in the documentation but every once in a while the code below sends data to the web server and after one time if I recompile the code nothing happens.

I have an external power supply connected to the ATMega2560 so I don't think it is due to not enough power.

Does anybody see what is missing to send the data using the 4g methods

 

My code is as follows

--------------------------------------------------------------------------------

#include <stdio.h>
#include <string.h>
#include <DHT.h>
#include <SoftwareSerial.h>
SoftwareSerial SIM7600(7, 8); // RX, TX
#define DEBUG true
#define LTE_RESET_PIN 6
#define LTE_PWRKEY_PIN 5
#define LTE_FLIGHT_PIN 7
#define Sensor_PIN 3  //D3-DHT11
 
//DHT  dht(Sensor_PIN,DHT11);
 
void setup()
{
 

   Serial.begin(115200);
   //while (!Serial)
   {
     ; // wait for Arduino serial Monitor port to connect
   }
   SIM7600.begin(115200);
  
   pinMode(LTE_RESET_PIN, OUTPUT);
   digitalWrite(LTE_RESET_PIN, LOW);
  
   pinMode(LTE_PWRKEY_PIN, OUTPUT);
   digitalWrite(LTE_RESET_PIN, LOW);
   delay(100);
   digitalWrite(LTE_PWRKEY_PIN, HIGH);
   delay(2000);
   digitalWrite(LTE_PWRKEY_PIN, LOW);
    
   pinMode(LTE_FLIGHT_PIN, OUTPUT);
   digitalWrite(LTE_FLIGHT_PIN, LOW);//Normal Mode
    
   delay(5000);
    
/* 
   sendData("AT+CCID\r", 3000, DEBUG);
   sendData("AT+CREG?\r", 3000, DEBUG);
   sendData("AT+CGATT=1\r", 1000, DEBUG);
   sendData("AT+CGACT=1,1\r", 1000, DEBUG);
   sendData("AT+CGDCONT=1,\"IP\",\"TM\"\r", 1000, DEBUG);
*/
                                                                                                                             
   sendData("AT+CCID", 3000, DEBUG);
   sendData("AT+CREG?", 3000, DEBUG);
   sendData("AT+CGATT=1", 1000, DEBUG);
   sendData("AT+CGACT=1,1", 1000, DEBUG);
   sendData("AT+CGDCONT=1,\"IP\",\"TM\"", 1000, DEBUG);
   sendData("AT+CIPSTART=\"TCP\",\"Webpage.de\",\"80\"", 2000, DEBUG); 
   Serial.println("4G HTTP Test Begin!");
 
  /* dht.begin(); */
   delay(1000);
       //-----------HTTP---------------------
   String http_str  = "AT+HTTPPARA=\"URL\",HTTP://www.webpage.de/data2mysql.php?key=test&ID=9999&A0=220&A1=300&A2=1024&A3=24&A4=26&A5=10&A6=14&A7=14&A8=28&A9=0&A10=7&A11=0&A12=0";
   
   sendData("AT+HTTPINIT", 2000, DEBUG);
   sendData(http_str, 2000, DEBUG);
   sendData("AT+HTTPACTION=0", 3000, DEBUG);
   sendData("AT+HTTPTERM", 3000, DEBUG);
   delay(5000);   
  
}
 
void loop()
{
  /* //--------Get temperature and humidity-------------
   float h = dht.readHumidity();
   float t = dht.readTemperature();
    Serial.print("Humidity: ");
    Serial.print(h);
    Serial.println("%");
    Serial.print("Temperature: ");
    Serial.print(t);
    Serial.println("*C");
    delay(1000);
 */

}
 
bool moduleStateCheck()
{
   int i = 0;
   bool moduleState = false;
   for (i = 0; i < 5; i++)
   {
       String msg = String("");
       msg = sendData("AT", 1000, DEBUG);
       if (msg.indexOf("OK") >= 0)
       {
           Serial.println("SIM7600 Module had turned on.");
           moduleState = true;
           return moduleState;
       }
       delay(1000);
   }
   return moduleState;
}
 
String sendData(String command, const int timeout, boolean debug)
{
 String response = "";
 SIM7600.println(command);
 Serial.print("In Send command ");
 Serial.println(command);
 if (debug)
 {
   Serial.print(response);
 }
  
 long int time = millis();
 while ( (time + timeout) > millis())
 {
   while (Serial1.available())
   {
     char c = Serial1.read();
     response += c;
   }
 }
 if (debug)
 {
   Serial.print(response);
 }
 return response;
}

2023-06-13 18:38:47

Also check your power supply. It will not work if you power it with directly from your Arduino. 

userHeadPic bidrohini.bidrohini
2023-06-07 18:37:14

1. Pls take Arduino UNO as an example, download the following code to UNO, and connect RX-D8/TX-D7 by jumper cap.

Then choose Baud Rate@ 115200, Format@ Carriage Return. Send AT to enter AT mode, you will get OK. If there is no reply, please try to change the serial monitor software.

2. L:  Arduino D13

3. After re-uploading your code, there is no response. It may be that the network was not registered successfully. Please note whether the Net status indicator enters the fast flashing state. You can try to restart the shield through the boot button. Short press the Boot button for 1s to turn on, and long press for 3s to turn off.

 

userHeadPic jenna