MKR1000 send two values only


#1

Hello, I am using MKR1000, The device send only twice to the platform and stops,

I am uploading the values of DHT11 sensor.

THE CODE:

#include <UbidotsArduino.h>
# include <SPI.h>
# include <WiFi101.h>
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT11   
DHT dht(DHTPIN, DHTTYPE); 
#define ID "ID-variable"                        //variable ID
#define TOKEN "TOKEN"         // Profile Token 

char ssid[] = "NAME" ;     //wifiname 
char pass[] = "PASSWORD" ;    //wifipass

int status = WL_IDLE_STATUS;
Ubidots client(TOKEN);
void setup(){
 
  
  Serial.begin(9600);
  Serial.println("DHTxx test!");
  dht.begin();
  while (status != WL_CONNECTED){      
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    status = WiFi.begin(ssid, pass);
     delayMicroseconds(500);  //wait

  }
}

void loop(){
  // Wait a few seconds between measurements.
  delay(1500);

  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  // Read temperature as Fahrenheit (isFahrenheit = true)
  float f = dht.readTemperature(true);

  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  // Compute heat index in Fahrenheit (the default)
  float hif = dht.computeHeatIndex(f, h);
  // Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);

  Serial.print("Humidity: ");
  Serial.print(h);
  Serial.print(" %\t");
  Serial.print("Temperature: ");
  Serial.print(t);
  Serial.print(" *C ");
  Serial.print(f);
  Serial.print(" *F\t");
  Serial.print("Heat index: ");
  Serial.print(hic);
  Serial.print(" *C ");
  Serial.print(hif);
  Serial.println(" *F");
  client.add(ID, h);
  client.sendAll();
}

#2

This is the output, it stops sending to server in the third time

Please upgrade the firmware
Attempting to connect to SSID: ATT3mIQ5fU
Humidity: 51.00 % Temperature: 21.00 *C 69.80 *F Heat index: 20.49 *C 68.88 *F
The full HTTP is:
POST /api/v1.6/collections/values/?force=true HTTP/1.1
Host: things.ubidots.com
User-Agent: Arduino-WiFi/1.1
X-Auth-Token: A1E-Gn1r5fJQmKqcFjFb87xQsjPL91AVOr
Connection: close
Content-Type: application/json
Content-Length: 59

[{“variable”: “5b588bc2c03f97391580bee5”, “value”:51.00}]

The TCP socket is opened
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 26 Jul 2018 04:52:10 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: close
Vary: Accept-Encoding
Vary: Cookie
Allow: POST, OPTIONS

16
[{“status_code”: 201}]
0

Humidity: 52.00 % Temperature: 21.00 *C 69.80 *F Heat index: 20.51 *C 68.92 *F
The full HTTP is:
POST /api/v1.6/collections/values/?force=true HTTP/1.1
Host: things.ubidots.com
User-Agent: Arduino-WiFi/1.1
X-Auth-Token: A1E-Gn1r5fJQmKqcFjFb87xQsjPL91AVOr
Connection: close
Content-Type: application/json
Content-Length: 59

[{“variable”: “5b588bc2c03f97391580bee5”, “value”:52.00}]

The TCP socket is opened
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 26 Jul 2018 04:52:12 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: close
Vary: Accept-Encoding
Vary: Cookie
Allow: POST, OPTIONS

16
[{“status_code”: 201}]
0

Humidity: 53.00 % Temperature: 21.00 *C 69.80 *F Heat index: 20.54 *C 68.97 *F
The full HTTP is:
POST /api/v1.6/collections/values/?force=true HTTP/1.1
Host: things.ubidots.com
User-Agent: Arduino-WiFi/1.1
X-Auth-Token: A1E-Gn1r5fJQmKqcFjFb87xQsjPL91AVOr
Connection: close
Content-Type: application/json
Content-Length: 59

[{“variable”: “5b588bc2c03f97391580bee5”, “value”:53.00}]

Humidity: 53.00 % Temperature: 21.00 *C 69.80 *F Heat index: 20.54 *C 68.97 *F
The full HTTP is:
POST /api/v1.6/collections/values/?force=true HTTP/1.1
Host: things.ubidots.com
User-Agent: Arduino-WiFi/1.1
X-Auth-Token: A1E-Gn1r5fJQmKqcFjFb87xQsjPL91AVOr
Connection: close
Content-Type: application/json
Content-Length: 59

[{“variable”: “5b588bc2c03f97391580bee5”, “value”:53.00}]


#3

Dear user,

Regrettably the library used “UbidotsArduino” is deprecated. Please refer to the repository to check the warning message related to the deprecation of the library.

In order to work with your Device and Ubidots, you should use an Arduino WiFi library supported by your device and handle a WebClient example in order to verify if the device is able to reach out internet properly. Once you are able to handle a sample request you should modify it by following the Ubidots REST API Reference.

I hope this would help you!

All the best,
Maria C.