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?
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);
}
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