onlinegill / LILYGO-TTGO-T-SIM7000G-ESP32-Traccar-GPS-tracker

LILYGO® TTGO T-SIM7000G ESP32 - Traccar GPS tracker
25 stars 12 forks source link

For A7670E #3

Open famtory opened 1 year ago

famtory commented 1 year ago

Hello I have "https://github.com/Xinyuan-LilyGO/T-A7670X" This source doesn't work on "A7670". I checked that the rx and tx pin numbers are different. But still not working.

+CPIN: READY

SMS DONE

+CGEV: NW REATTACH

+CGEV: EPS PDN ACT 1

*COPN:0,"KT"

*COPN:1,"KT"

PB DONE

*ATREADY: 1

*ISIMAID: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

+CPIN: READY

SMS DONE

PB DONE AT+SAPBR=3,1,"Contype","GPRS" AT+SAPBR=3,1,"Contype","GPRS"

ERROR AT+SAPBR=3,1,"APN","lte.ktfwing.com" AT+SAPBR=3,1,"APN","lte.ktfwing.com"

ERROR AT+CGDCONT=1,"IP","lte.ktfwing.com" AT+CGDCONT=1,"IP","lte.ktfwing.com"

OK AT+CGATT=1 AT+CGATT=1

OK AT+CGACT=1,1 AT+CGACT=1,1 +CME ERROR: unknown error

======================

define SerialMon Serial

// Set serial for AT commands (to the module)` // Use Hardware Serial on Mega, Leonardo, Micro

define SerialAT Serial1

define TINY_GSM_MODEM_SIM7000

define TINY_GSM_RX_BUFFER 1024 // Set RX buffer to 1Kb

// See all AT commands, if wanted // #define DUMP_AT_COMMANDS

// set GSM PIN, if any

define GSM_PIN ""

// Your GPRS credentials, if any // Your GPRS credentials, if any const char apn[] = "lte.ktfwing.com"; const char gprsUser[] = ""; const char gprsPass[] = "";

const char server[] = "175.206.xxxxxxxxxxx";

const int port = 5055; String myid = "xxxxxxxxxxx";

include

include

define DUMP_AT_COMMANDS

ifdef DUMP_AT_COMMANDS

include

StreamDebugger debugger(SerialAT, SerialMon); TinyGsm modem(debugger);

else

TinyGsm modem(SerialAT);

endif

TinyGsmClient client(modem); HttpClient http(client, server, port);

define uS_TO_S_FACTOR 1000000ULL // Conversion factor for micro seconds to seconds

define TIME_TO_SLEEP 60 // Time ESP32 will go to sleep (in seconds)

define UART_BAUD 115200

define PIN_DTR 25

define PIN_TX 26

define PIN_RX 27

define PWR_PIN 4

define SD_MISO 2

define SD_MOSI 15

define SD_SCLK 14

define SD_CS 13

define LED_PIN 12

void modemPowerOn() { pinMode(PWR_PIN, OUTPUT); digitalWrite(PWR_PIN, LOW); delay(1000); //Datasheet Ton mintues = 1S digitalWrite(PWR_PIN, HIGH); }

void modemPowerOff() { pinMode(PWR_PIN, OUTPUT); digitalWrite(PWR_PIN, LOW); delay(1500); //Datasheet Ton mintues = 1.2S digitalWrite(PWR_PIN, HIGH); }

void modemRestart() { modemPowerOff(); delay(1000); modemPowerOn(); }

void enableGPS(void) {

Serial.println("Start positioning . Make sure to locate outdoors."); Serial.println("The blue indicator light flashes to indicate positioning."); modem.sendAT("+SGPIO=0,4,1,1"); if (modem.waitResponse(10000L) != 1) { DBG(" SGPIO=0,4,1,1 false "); } modem.enableGPS(); }

void disableGPS(void) { modem.sendAT("+SGPIO=0,4,1,0"); if (modem.waitResponse(10000L) != 1) { DBG(" SGPIO=0,4,1,0 false "); } modem.disableGPS(); }

void sendCoords(float lat, float lon) {

int err = http.post("/?id="+myid+"&lat="+lat+"&lon="+lon+""); if (err != 0) { SerialMon.println(F("failed to connect")); delay(10000); return; }

int status = http.responseStatusCode();

if (!status) { delay(10000); return; }

String body = http.responseBody(); SerialMon.println(F("Response:")); SerialMon.println(body);

// Shutdown http.stop(); SerialMon.println(F("Server disconnected")); }

void setup() { // Set console baud rate SerialMon.begin(115200);

delay(10);

// Set LED OFF pinMode(LED_PIN, OUTPUT); digitalWrite(LED_PIN, HIGH);

SerialAT.begin(UART_BAUD, SERIAL_8N1, PIN_RX, PIN_TX);

delay(10000);

modemPowerOn();

Serial.println("Initializing modem..."); if (!modem.restart()) { Serial.println("Failed to restart modem, attempting to continue without restarting"); }

// Unlock your SIM card with a PIN if needed if (GSM_PIN && modem.getSimStatus() != 3) { modem.simUnlock(GSM_PIN); } }

void loop() {

// GPRS connection parameters are usually set after network registration SerialMon.print(F("Connecting to ")); SerialMon.print(apn); if (!modem.gprsConnect(apn, gprsUser, gprsPass)) { SerialMon.println(" fail"); delay(10000); return; } SerialMon.println(" success");

if (modem.isGprsConnected()) { SerialMon.println("GPRS connected"); }

enableGPS();

float lat, lon; while (1) { if (modem.getGPS(&lat, &lon)) { sendCoords(lat, lon); } digitalWrite(LED_PIN, !digitalRead(LED_PIN)); delay(7500); } }

jichef commented 3 months ago

Ey... have you checked the libraries specific from lilygo? check their fork. Anyway, maybe this response is too late. Have you build your traccar with A7670?