Error sending data to Ubidots dashboard

Hello.

I’m having problems with this message when I send sensor data to ubidots:


ctx: cont
sp: 3ffffb00 end: 3fffffc0 offset: 0190
3ffffc90:  01020000 00000102 3fff828c 40221d0e  
3ffffca0:  00000020 3fff6434 3fff828c 40221eb5

my code:

#include <SoftwareSerial.h>

#include <Ubidots.h>

const char *UBIDOTS_TOKEN = "";

const char *WIFI_SSID = "brisa-2527926"; // Put here your Wi-Fi SSID

const char *WIFI_PASS = "rrcutegn"; // Put here your Wi-Fi password

const char *DEVICE_LABEL = "esp8266";

Ubidots ubidots(UBIDOTS_TOKEN, UBI_HTTP);

int umi1;

int umi2;

SoftwareSerial esp(13, 0);

void setup()
{

    ubidots.wifiConnect(WIFI_SSID, WIFI_PASS);

    Serial.begin(9600);

    esp.begin(4800);

    pinMode(13, INPUT);

    pinMode(0, OUTPUT);

    pinMode(2, OUTPUT);

    digitalWrite(2, LOW);

    if (!ubidots.wifiConnected())
    {

        Serial.println("NotConnected");

        Serial.println("disconnecting ubidots.");

        ubidots.wifiConnect(WIFI_SSID, WIFI_PASS);
    }
}

void loop()
{

    if (esp.available() > 0)
    {

        if (esp.read() == 'n')
        {

            umi1 = esp.parseInt();

            Serial.print("Umidade 1:  ");

            Serial.println(umi1);
        }

        if (esp.read() == 'p')
        {

            umi2 = esp.parseInt();

            Serial.print("Umidade 2:  ");

            Serial.println(umi2);
        }
    }

    ubidots.add("var_resistivo", umi1);

    ubidots.add("var_capacitivo", umi2);

    bool bufferSent = false;

    bufferSent = ubidots.send(DEVICE_LABEL);

    if (bufferSent)
    {

        Serial.println(" Dados enviados! ");
    }

    else
    {

        Serial.println("DADOS NÃO ENVIADOS!");
    }
}

Greetings @rudsonth I hope this message finds you well,

I’d like to kindly ask you to please provide more detailed serial console logs so we can have a broader vision of the issue.

Also, could you please try to print on the Serial console the sensor values? This way we discard the issue to be hardware related.

I’ll be attentive to your response,

Best regards
–Juan David Tangarife H.

1 Like

Thanks for the answer.

I sent data from two soil moisture sensors to the Arduino and later sent this data to the Esp8266. To send, I used these methods of sending characters.

On the serial monitor, it presents this problem with these huge codes and the data is sent at certain periodic moments and is standard.

Greetings @rudsonth I hope this message finds you well,

I’ve tried reproducing the error that you mention without success, that is, it works as expected for me. I’ve tried the following with the following code snippet:

#include <SoftwareSerial.h>
#include "Ubidots.h"

const char *UBIDOTS_TOKEN = "BBFF-";
const char *WIFI_SSID = ""; // Put here your Wi-Fi SSID
const char *WIFI_PASS = ""; // Put here your Wi-Fi password
const char *DEVICE_LABEL = "esp8266";

int umi1;
int umi2;
Ubidots ubidots(UBIDOTS_TOKEN);

void setup()
{
    Serial.begin(9600);
    ubidots.wifiConnect(WIFI_SSID, WIFI_PASS);
    if (!ubidots.wifiConnected())
    {
        Serial.println("NotConnected");
        Serial.println("disconnecting ubidots.");
        ubidots.wifiConnect(WIFI_SSID, WIFI_PASS);
    }
}

void loop()
{
    umi1 = random(1000000);
    umi2 = random(1000000);
    ubidots.add("var_resistivo", umi1);
    ubidots.add("var_capacitivo", umi2);
    bool bufferSent = false;
    bufferSent = ubidots.send(DEVICE_LABEL);

    if (bufferSent)
    {
        Serial.println(" Dados enviados! ");
    }

    else
    {
        Serial.println("DADOS NÃO ENVIADOS!");
    }
}

As you can see, I’m generating random numbers to simulate the sensor, in order to discard that the error pertains to the library itself and is related to the library behind in charge of reading the sensor data. With that in mind, can you please test on your end by generating random numbers instead of using real sensor data?

I’ll be attentive to your response.

Best regards