Arduino Mega 2560 with GSM/GPRS Module SIM800L

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!

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

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

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

where did you get that #include <UbidotsArduinoGPRS.h>? i don’t see that header file in the library you are following with.

Hello @warshockII,

The library “UbidotsArduinoGPRS” was updated a few months ago. Refer to the new library version here.

Check out the releases page in case you want to use an older version.

Cheers,
Maria H.

Oh i see. thank you.
and can i ask something more to my issue?
regarding this link https://help.ubidots.com/en/articles/513320-connect-an-arduino-uno-gprs-shield-to-ubidots-over-tcp-udp

i also use Arduino Mega 2560 with sim800Levb
i followed the instructions.
and successfully upload it to the board. the problem is that there is no data shown to receive on the variable i’ve created. and that’s a problem i’ve been facing with right now.

might be the cause of the problem:
*the activated plan of the sim800l?
*I found out that no write line in the serial monitor. (If serial begin is 115200, I did change the serial monitor baudrate to check if there is any written lines). this problem occur after adapting the code to send data to ubidots.
*or maybe the ubidots --> the device and its variable i’ve created.

First, i did to my sim800l:

Second, i did to my arduino mega sim800l and ubidots:
regarding this link https://help.ubidots.com/en/articles/513320-connect-an-arduino-uno-gprs-shield-to-ubidots-over-tcp-udp

Hello @warshockII,

The library was tested with a GPRS Shield that is based on the SIM900 module from SIMCOM so we can’t ensure the right functionality of the library with the sim800Levb.

Based on this, I recommend you build your own sample code following the Ubidots API documentation.

Cheers,
Maria H.