MATLAB Answers

Problem sending GPS Data from TTGO T-Call (ESP32) board to Thingspeak using integrated SIM800L.

48 views (last 30 days)
Raghunath H
Raghunath H on 25 Jul 2020 at 4:57
Answered: Vinod on 2 Aug 2020 at 17:28
I am working on a project to send GPS data from a Neo 6M GPS module connected to TTGO board, to Thingspeak and Blynk using the SIM800L module on the TTGO. For this i have combined two sketches avaiable on the internet.(Thank you to original coders)
  1. The first sketch sends GPS Data to Blynk using SIM800L. (Using ESP32 TTGO board)
  2. The second sketch sends GPS data to Thingspeak via Wifi. (Using ESP8266)
So I combined the two sketches with a bit of editing to achieve what i want. However, the code is not compiling and unable to upload to the TTGO board. I am sure in the cut and paste of sketches i might have made some errors. I am just a newbie and just tinkering with the code.
The error is : no matching function for call to 'ThingSpeakClass::begin(ThingSpeakClass&)'
Can anyone please point out the error and correct it. Thanks
/*
GPS Tracker With SIM. Uploading data to Blynk APP and Thingspeak.
* */
// TTGO T-Call pin definitions
#define MODEM_RST 5
#define MODEM_PWKEY 4
#define MODEM_POWER_ON 23
#define MODEM_TX 27
#define MODEM_RX 26
#define I2C_SDA 21
#define I2C_SCL 22
#include <TinyGPS++.h> //https://github.com/mikalhart/TinyGPSPlus
#include <AceButton.h> // https://github.com/bxparks/AceButton
#define BLYNK_PRINT Serial
#define BLYNK_HEARTBEAT 30
#define TINY_GSM_MODEM_SIM800
#define ThingSpeak client
#include <TinyGsmClient.h> // https://github.com/vshymanskyy/TinyGSM
#include <BlynkSimpleSIM800.h> //https://github.com/blynkkk/blynk-library
#include <Wire.h>
#include "utilities.h"
#include "ThingSpeak.h"
// Variables for storing GPS Data
float latitude;
float longitude;
float speed;
float satellites;
String direction;
// Set serial for GPS Module
#define SerialMon Serial
// Hardware Serial for builtin GSM Module
#define SerialAT Serial1
//const char apn[] = "www";
const char apn[] = "airtelgprs.com";
const char user[] = "";
const char pass[] = "";
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
const char auth[] = "2xxxxxxxkbBOa3ZlPf";
unsigned long myChannelNumber = 1xxxxxx30;
const char * myWriteAPIKey = "XxxxxxxxxxxAF";
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps;
WidgetMap myMap(V0);
BlynkTimer timer;
TinyGsm modem(SerialAT);
unsigned int move_index = 1;
void setup()
{
// Set console baud rate
Serial.begin(115200);
delay(10);
// Keep power when running from battery
Wire.begin(I2C_SDA, I2C_SCL);
bool isOk = setPowerBoostKeepOn(1);
SerialMon.println(String("IP5306 KeepOn ") + (isOk ? "OK" : "FAIL"));
// Set-up modem reset, enable, power pins
pinMode(MODEM_PWKEY, OUTPUT);
pinMode(MODEM_RST, OUTPUT);
pinMode(MODEM_POWER_ON, OUTPUT);
pinMode(SMS_Button, INPUT);
pinMode(Call_Button, INPUT);
digitalWrite(MODEM_PWKEY, LOW);
digitalWrite(MODEM_RST, HIGH);
digitalWrite(MODEM_POWER_ON, HIGH);
// Set GSM module baud rate and UART pins
SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);
delay(3000);
// Restart takes quite some time
// To skip it, call init() instead of restart()
SerialMon.println("Initializing modem...");
modem.restart();
String modemInfo = modem.getModemInfo();
SerialMon.print("Modem: ");
SerialMon.println(modemInfo);
// Unlock your SIM card with a PIN
//modem.simUnlock("1234");
SerialMon.print("Waiting for network...");
if (!modem.waitForNetwork(240000L)) {
SerialMon.println(" fail");
delay(10000);
return;
}
SerialMon.println(" OK");
if (modem.isNetworkConnected()) {
SerialMon.println("Network connected");
}
SerialMon.print(F("Connecting to APN: "));
SerialMon.print(apn);
if (!modem.gprsConnect(apn, user, pass)) {
SerialMon.println(" fail");
delay(10000);
return;
}
SerialMon.println(" OK");
Blynk.begin(auth, modem, apn, user, pass);
timer.setInterval(5000L, checkGPS);
ThingSpeak.begin(client); ///////////////////////////////////////////// //Error on this line
}
void checkGPS()
{
if (gps.charsProcessed() < 10)
{
Blynk.virtualWrite(V4, "GPS ERROR");
}
}
void loop()
{
while (Serial.available() > 0)
{
if (gps.encode(Serial.read()))
displayInfo();
}
Blynk.run();
timer.run();
sms_button.check();
call_button.check();
}
void displayInfo()
{
if (gps.location.isValid())
{
double latitude = (gps.location.lat());
double longitude = (gps.location.lng());
double speed = (gps.speed.kmph());
float satellites =(gps.satellites.value());
String direction = TinyGPSPlus::cardinal(gps.course.value());
String latbuf;
latbuf += (String(latitude, 6));
Serial.println(latbuf);
String lonbuf;
lonbuf += (String(longitude, 6));
Serial.println(lonbuf);
String speedbuf;
speedbuf += (float(speed));
Serial.println(speedbuf);
String dirbuf;
dirbuf += (String(direction));
Serial.println(dirbuf);
float satbuf;
satbuf += (float(satellites));
Serial.println(satbuf);
ThingSpeak.setField(1, latbuf);
ThingSpeak.setField(2, lonbuf);
ThingSpeak.setField(3, speedbuf);
ThingSpeak.setField(4, dirbuf);
ThingSpeak.setField(5, satbuf);
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
delay(20000);
}
else
{
Serial.print(F("INVALID"));
}
Serial.print(F(" Date/Time: "));
if (gps.date.isValid())
{
Serial.print(gps.date.month());
Serial.print(F("/"));
Serial.print(gps.date.day());
Serial.print(F("/"));
Serial.print(gps.date.year());
}
else
{
Serial.print(F("INVALID"));
}
Serial.print(F(" "));
if (gps.time.isValid())
{
if (gps.time.hour() < 10) Serial.print(F("0"));
Serial.print(gps.time.hour());
Serial.print(F(":"));
if (gps.time.minute() < 10) Serial.print(F("0"));
Serial.print(gps.time.minute());
Serial.print(F(":"));
if (gps.time.second() < 10) Serial.print(F("0"));
Serial.print(gps.time.second());
Serial.print(F("."));
if (gps.time.centisecond() < 10) Serial.print(F("0"));
Serial.print(gps.time.centisecond());
}
else
{
Serial.print(F("INVALID"));
}
Serial.println();
}
{
if (gps.location.isValid() )
{
latitude = (gps.location.lat()); //Storing the Lat. and Lon.
longitude = (gps.location.lng());
Blynk.virtualWrite(V1, String(latitude, 6));
Blynk.virtualWrite(V2, String(longitude, 6));
myMap.location(move_index, latitude, longitude, "GPS_Location");
speed = gps.speed.kmph(); //get speed
Blynk.virtualWrite(V3, speed);
direction = TinyGPSPlus::cardinal(gps.course.value()); // get the direction
Blynk.virtualWrite(V4, direction);
satellites = gps.satellites.value(); //get number of satellites
Blynk.virtualWrite(V5, satellites);
}
}

  0 Comments

Sign in to comment.

Answers (1)

Vinod
Vinod on 2 Aug 2020 at 17:28
Try to strip down the example to the minimum to find the source of your issue. Since this is a build issue, I suspect your toolchain is not set up correctly.

  0 Comments

Sign in to comment.