Arduino Mega 2560 with GSM/GPRS Module SIM800L


#1

Hi, I am trying to connect the Ubidots API to my arduino Mega 2560 that has a SIM800L Module connected like this:

This is the module

It works fine with AT commands but I want to send data to ubidots via TCP
I am following this Tutorial

However when testing the first code:

#include <UbidotsArduinoGPRS.h>
#include <SoftwareSerial.h> 

//Serial Relay - Arduino will patch a 
//serial link between the computer and the GPRS Shield
//at 19200 bps 8-N-1
//Computer is connected to Hardware UART
//GPRS Shield is connected to the Software UART 
#define APN "Put_the_APN_here" // Assign the APN 
#define USER "Put_the_APN_user_herer"  // If your apn doesnt have username just put ""
#define PASS "Put_the_APN_pwd_here"  // If your apn doesnt have password just put ""
#define TOKEN "Put_your_Ubidots_token_here"  // Replace it with your Ubidots token
#define VARIABLE_LABEL "temperature" // Assign the variable label 

Ubidots client(TOKEN);
SoftwareSerial gprs = SoftwareSerial(7, 8);
SoftwareSerial *GPRSSerial = &gprs;

void setup() {
  Serial.begin(115200);
  GPRSSerial->begin(19200);
  if (! client.init(*GPRSSerial)) {
    Serial.println(F("Couldn't find FONA"));
    while (1);
  }
  client.setApn(APN,USER,PASS);
  //client.setDebug(false);
}

void loop() {
  float value = analogRead(A0);  // Reading analog pin A0
  client.add(VARIABLE_LABEL, value);  
  client.sendAll();
}

and changing the token the arduino IDE shows this error

sketch_sep30a:15:21: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]

Ubidots client(TOKEN);

also as I am using the Arduino Mega and it has 3 UART ports I don’t want to use the SoftwareSerial library and I connected the module to the Serial3 port but I don’t know how to adapt this part of the code:

SoftwareSerial *GPRSSerial = &gprs;

I don’t know why you have to give the gprs direction and how to adapt it to Serial3 type

Thank you!


#2

Hi there, try changing this

#define TOKEN "Put_your_Ubidots_token_here"

to

char* TOKEN = "Put_your_Ubidots_token_here";

Probably your compiler does not cast definition to char pointers.

All the best


#3

Hi, thank you. I tried that and it still give me this

exit status 1
invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]