[SOLVED] Upload Speed for Ubidots

Hi

I am doing a University Project. I am using the Linkit One Board and Grove kit Sensors to detect temperature, light and humidity I’ve noticed the upload speed is extremely slow compared to other cloud based systems. I would like to know if the upload speed is generally slow?

Thanks

Kashifa

It is the same case as I have . I am currently using NODEMCU . I’ll check the library to see if there is a delay and notice if I succeeded

Hi all, currently all services and response times are operating normal. I have found that some proxies in universities or work have problems with TCP data being chunked into different frames. I would recommend using MQTT to make sure you have a persistent connection. @kashifa are you using WiFi or GPRS? Here a GPRS example that should be easy to port to WiFi:

// MQTT Ubidots client for LinkitOne, based on the PubSubClient basic MQTT example.
#include <LGPRS.h>      //include the base GPRS library
#include <LGPRSClient.h>  
#include <PubSubClient.h>

#define TOPIC "/v1.6/devices/linkit-one"

char payload[200];  // Reserve a char to store the Ubidots data. 
char le[4];
char mqttBroker[] = "things.ubidots.com";
String response;
LGPRSClient GPRSclient;
PubSubClient client(GPRSclient);

void reconnect() {
  // Loop until we're reconnected
  while (!client.connected()) {
    Serial.print("Attempting MQTT connection...");
    // Attempt to connect
    if (client.connect("linkit-one","xxxxxxxomo33XSRRsvofNqR18","")) { //Replace with your Ubidots token
      Serial.println("connected");
    } else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      // Wait 5 seconds before retrying
      delay(5000);
    }
  }
}

void setup()
{
  Serial.begin(115200);             // setup Serial port
  pinMode(13, OUTPUT);
  Serial.println("Attach to GPRS network");   // Attach to GPRS network - need to add timeout
  while (!LGPRS.attachGPRS("apn.konekt.io","","")) { //Replace with your APN
    delay(500);
  }
  Serial.println("GPRS attached!");
  client.setServer(mqttBroker, 1883);
  delay(10000);

}

void loop(){
  int temp = analogRead(A0);
  int ph = analogRead(A1);
  int orp = analogRead(A2);

  sprintf(payload,"%s", "{\"temperature\":");
  sprintf(payload,"%s%d", payload, temp);
  sprintf(payload,"%s%s", payload, ",\"ph\":");
  sprintf(payload,"%s%d", payload, ph);
  sprintf(payload,"%s%s", payload, ",\"orp\":");
  sprintf(payload,"%s%d", payload, orp);
  sprintf(payload,"%s%s", payload, "}");
  Serial.println(payload);
  
  if (!client.connected()) {
    reconnect();
  }
  client.publish(TOPIC, payload);
  client.loop();
  delay(1000);
} 

@Edmundo_garcia you can try this one for nodeMCU.

Thanks hackmed. I try, best regards

Excuseme hackmed !!!, Do you have a example for nodeMCU.I want to usued mqtt+ubidots+nodmcu+digital input+digital ouput.

I went to Ubidots MQTT library for different Boards but I didn´t found any example

Sorry. Best Regrards

@Edmundo_garcia hello i upload new examples for that library you could download it here

Subscribe:

#include "UbidotsMQTT.h"

#define WIFISSID "My_SSID"
#define PASSWORD "password123"
#define TOKEN "xxxx"

void callback(char* topic, byte* payload, unsigned int length);

Ubidots client(TOKEN, callback);

void callback(char* topic, byte* payload, unsigned int length) {
    char p[length + 1];
    memcpy(p, payload, length);
    p[length] = NULL;
    String message(p);
    Serial.write(payload, length);
    Serial.println(topic);
}
void setup() {
    Serial.begin(115200);
    delay(10000);
    Serial.println("Connecting WiFi");
    client.wifiConnection(WIFISSID, PASSWORD);
    Serial.println("Connected");
    while (client.connect());
}


void loop() {
    client.add("my-device" ,"led");
    client.loop();
}

Publish:

#include "UbidotsMQTT.h"

#define WIFISSID "My_SSID"
#define PASSWORD "password123"
#define TOKEN "xxxx"

void callback(char* topic, byte* payload, unsigned int length);

Ubidots client(TOKEN, callback);

void callback(char* topic, byte* payload, unsigned int length) {
    char p[length + 1];
    memcpy(p, payload, length);
    p[length] = NULL;
    String message(p);
    Serial.write(payload, length);
    Serial.println(topic);
}
void setup() {
    Serial.begin(115200);
    delay(10000);
    Serial.println("Connecting WiFi");
    client.wifiConnection(WIFISSID, PASSWORD);
    Serial.println("Connected");
    while (client.connect());
}


void loop() {
    float value = analogRead(A0);
    client.add("Temperature" , value);
    client.sendValues();
    client.loop();
}

Best regards,
Metavix

woow thaks a lot Metavix I´m very grateful. Best regards

Dear Metavix, continue with your example
after being signed or publish a fact . something happens that is disconnected from the server MQTT and stops transmitting only seen in serial pure zeros

Do you know why? and what I do? thanks a lot. best regards

It is normal to have MQTT disconnections, which can be due to many reasons. You have to include a re-connect function in your code

I’ll try hackmed. Thaks a lot.

Best regards