Ubidots Community

I cant send more than 5 variable to device

hi
I am using esp32 dev to send 10 variables to free account ubidots using MQTT using the code

/****************************************
Include Libraries
****************************************/
#include “UbidotsEsp32Mqtt.h”
#include <WiFi.h>
#include <dht.h>  //DHT Senser
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include “EmonLib.h”  // Include Emon Library

/****************************************
Define Constants
****************************************/
const char *UBIDOTS_TOKEN = “BBFF - mbcxHDE7WbYa”;  // Put here your Ubidots TOKEN
const char *WIFI_SSID = “Jaafar”;                   // Put here your Wi-Fi SSID
const char *WIFI_PASS = “001122391100”;             // Put here your Wi-Fi password
const char *DEVICE_LABEL = “SCADA”;                 // Put here your Device label to which data will be published
const char *VARIABLE_LABEL = “temp”;                // Put here your Variable label to temprture which data will be published
const char *VARIABLE_LABEL1 = “pv-voltaqge”;        // Put here your Variable label to pv voltage which data will be published
const char *VARIABLE_LABEL2 = “pv-current”;         // Put here your Variable label to pv voltage which data will be published
const char *VARIABLE_LABEL3 = “pv-power”;           // Put here your Variable label to pv power which data will be published
const char *VARIABLE_LABEL4 = “battery-voltage”;    // Put here your Variable label to battery voltage which data will be published
const char *VARIABLE_LABEL5 = “battery-current”;    // Put here your Variable label to battery current which data will be published
const char *VARIABLE_LABEL6 = “battery-power”;      // Put here your Variable label to battery power which data will be published
const int PUBLISH_FREQUENCY = 500;                  // Update rate in milliseconds
unsigned long timer;

Ubidots ubidots(UBIDOTS_TOKEN);

#define dht_apin 27  // Analog Pin sensor is connected to temprtut 27
dht DHT;

#define VOLT_CAL 190

EnergyMonitor emon1;  // Create an instance

#define NUMSAMPLES 5
int sensorValue;
int curr_samples[NUMSAMPLES];
/*
PIN CONNECTIONS SENSOR
S → A3 green
→ 5V red
→ GND blue
Calculate exact values with multimeter:
Vin on adapter = 12.41V
Vout on Arduino = 2.42
5V on Arduino = 5.10V
Vin / vOut = factor
12.41 / 2.42 = 5.128
*/

const int voltageSensorPin = A3;   // dc pv sensor pin
const int voltageSensorPin1 = A0;  // dc battery sensor pin
float vIn;                         // measured voltage (3.3V = max. 16.5V, 5V = max 25V)
float pvp;
float bp;
float Vbattery;  // measured voltage (3.3V = max. 16.5V, 5V = max 25V)
float vOut;
float vOut1;
float voltageSensorVal;       // value on pin A3 (0 - 1023) for esp (0-4096) ADC resolution for pv
float voltageSensorVal1;      // value on pin A3 (0 - 1023) for esp (0-4096) ADC resolution for battery
const float factor = 5.128;   // reduction factor of the Voltage pv dc Sensor shield
const float factor1 = 5.128;  // reduction factor of the Voltage battery dc Sensor shield
const float vCC = 3.30;       // Arduino input voltage (measurable by voltmeter) for esp32 =3.3
const int sensorIn = A4;
float Voltage = 0;
float VRMS = 0;
float AmpsRMS = 0;
float getVPP();
int mVperAmp = 66;  // use 100 for 20A Module and 66 for 30A Module
// pv dc current sonser
const int currentPin = 33;
int sensitivity = 66;
int adcValue = 0;
int offsetVoltage = 2168;
float adcVoltage = 0;
float currentValue = 0;

// battery dc current sonser
const int currentPin1 = 35;
int sensitivity1 = 66;
int adcValue1 = 0;
int offsetVoltage1 = 2168;
float adcVoltage1 = 0;
float currentValue1 = 0;

// the value of the ‘other’ resistor
#define SERIESRESISTOR 10000
// define Analog for Current and Voltage
const int curr_an_pin = 35;

int count = 0;

/****************************************
Auxiliar Functions
****************************************/
void callback(char *topic, byte *payload, unsigned int length) {
Serial.print(“Message arrived [”);
Serial.print(topic);
Serial.print("] ");
for (int i = 0; i < length; i++) {
  Serial.print((char)payload[i]);
}
Serial.println();
}

/****************************************
Main Functions
****************************************/
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  // ubidots.setDebug(true); // uncomment this to make debug messages available
  ubidots.connectToWifi(WIFI_SSID, WIFI_PASS);
  ubidots.setCallback(callback);
  ubidots.setup();
  ubidots.reconnect();

  timer = millis();
}

void loop() {
  // put your main code here, to run repeatedly:
  if (!ubidots.connected()) {
    ubidots.reconnect();
  }
  if (abs(millis() - timer) > PUBLISH_FREQUENCY)  // triggers the routine every 5 seconds
  {
    // Start of Program temprture

    DHT.read11(dht_apin);
    float tem = (DHT.temperature);

    Serial.print(" humidity = ");
    Serial.print(DHT.humidity);
    Serial.print("%  ");
    Serial.print("temperature = ");
    Serial.print(DHT.temperature);

    Serial.println("C  ");

    delay(1000);  // Wait 1 seconds before accessing sensor again.
    // end sonser temprture
    // start dc pv voltage sonser
    voltageSensorVal = analogRead(voltageSensorPin);        // read the current sensor value (0 - 1023) for ard and 0-4096 for esp32
    vOut = (voltageSensorVal / 4096) * vCC;  // convert the value to the real voltage on the analog pin
    vIn = vOut * factor;                     // convert the voltage on the source by multiplying with the factor

    delay(1000);
    // end dc pv voltage sonser

    // start pv dc current sonser
    {
      adcValue = analogRead(currentPin);
      adcVoltage = (adcValue / 4096.0) * 5200;
      currentValue = ((adcVoltage - offsetVoltage) / sensitivity);

      delay(1000);
    }
    // end pv dc current sonser
    // start dc pv power

    pvp = vIn * currentValue;

    // end dc pv power

    // start dc battery voltage sonser
    voltageSensorVal1 = analogRead(voltageSensorPin1);         // read the current sensor value (0 - 1023) for ard and 0-4096 for esp32
    vOut1 = (voltageSensorVal1 / 4096) * vCC;  // convert the value to the real voltage on the analog pin
    Vbattery = vOut1 * factor1;                // convert the voltage on the source by multiplying with the factor

    delay(1000);
    // end dc battery voltage sonser

    // start dc battery current sonser
    {
      adcValue1 = analogRead(currentPin1);
      adcVoltage1 = (adcValue1 / 4096.0) * 5200;
      currentValue1 = ((adcVoltage1 - offsetVoltage1) / sensitivity1);

      delay(1000);
    }
    // end dc battery current sonser
    // start dc battery power

    bp = Vbattery * currentValue1;

    // end dc battery power

    Serial.print("Solar Voltage = ");
    Serial.print(vIn);
    Serial.println(“V”);
    Serial.print("Solar Current = ");
    Serial.print(currentValue);
    Serial.println(“A”);
    Serial.print("Solar Power = ");
    Serial.print(pvp);
    Serial.println(“W”);
    Serial.print("Battery Voltage = ");
    Serial.print(Vbattery);
    Serial.println(“V”);
    Serial.print("battery Current = ");
    Serial.print(currentValue1);
    Serial.println(“A”);
    Serial.print("Battery Power = ");
    Serial.print(bp);
    Serial.println(“W”);

    ubidots.add(VARIABLE_LABEL, tem);            // Insert your variable Labels temprture and the value to be sent
    ubidots.add(VARIABLE_LABEL1, vIn);           // Insert your variable Labels dc pv voltage  and the value to be sent
    ubidots.add(VARIABLE_LABEL2, currentValue);  // Insert your variable Labels dc pv current  and the value to be sent
    ubidots.add(VARIABLE_LABEL3, pvp);           // Insert your variable Labels dc pv power  and the value to be sent
    ubidots.add(VARIABLE_LABEL5, currentValue1);        // Insert your variable Labels dc battery current  and the value to be sent
    ubidots.add(VARIABLE_LABEL6, bp);  // Insert your variable Labels dc pv power  and the value to be sent
    ubidots.publish(DEVICE_LABEL);
    timer = millis();
  }
  ubidots.loop();
}

if increase variable the site don’t receive data

Hello @engjjd,

Could you please uncomment the debug line so that you can please tell us what the is the payload that is being sent when you include more than 5 variables.

Additionally, please take into account the data limits set in our library, for example:

  • Max values (10 values max)
  • max buffer size (512 bytes)

If any of these two values are exceeded, then the payload might not arrive to Ubidots within the acceptable format, thus the Publish would be rejected.

Also take into account the limit given by PubSubClient regarding the maximum allowed characters (256). The same condition as above is true, if this value is exceeded, then the Publish won’t happen.

I’ll be attentive to your reply to see the payload being sent.

Best regards,
Sebastián

hi
thanks for reply
I tried to add the following code, but without result, the result is still not accepting more than 5 variables
#ifndef UbiConstants_H
#define UbiConstants_H

#include “stdint.h”

const char UBIDOTS_BROKER[] = “industrial.api.ubidots.com”;
const char *const USER_AGENT = “UbidotsESP32/1.0”;
const uint8_t MAX_VALUES = 10;
const int UBIDOTS_MQTT_PORT = 1883;
const int MAX_BUFFER_SIZE = 512;

#endif
serial monitor show that
0:00:25.993 → .WiFi connected
20:00:25.993 → IP address:
20:00:25.993 → 192.168.0.102
20:00:25.993 → broker:industrial.api.ubidots.com
20:00:25.993 → brokerPort:1883
20:00:25.993 → 24:0A:C4:59:48:60
20:00:25.993 → BBFF-mbcxHDE7WbY9bM6A1iBa
20:00:25.993 → Attempting MQTT connection…connected
20:00:27.086 → humidity = 0.00% temperature = 0.00C
20:00:36.099 → Load Voltage : 0.00
20:00:36.099 → Solar Voltage = 0.00V

Hello @engjjd

Can you use the code below, it’s the same as yours but I enabled the debug messages so you and we can see the payload being sent to Ubidots in the Serial Monitor.

/****************************************
Include Libraries
****************************************/
#include “UbidotsEsp32Mqtt.h”
#include <WiFi.h>
#include <dht.h>  //DHT Senser
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include “EmonLib.h”  // Include Emon Library

/****************************************
Define Constants
****************************************/
const char *UBIDOTS_TOKEN = “BBFF - mbcxHDE7WbYa”;  // Put here your Ubidots TOKEN
const char *WIFI_SSID = “Jaafar”;                   // Put here your Wi-Fi SSID
const char *WIFI_PASS = “001122391100”;             // Put here your Wi-Fi password
const char *DEVICE_LABEL = “SCADA”;                 // Put here your Device label to which data will be published
const char *VARIABLE_LABEL = “temp”;                // Put here your Variable label to temprture which data will be published
const char *VARIABLE_LABEL1 = “pv-voltaqge”;        // Put here your Variable label to pv voltage which data will be published
const char *VARIABLE_LABEL2 = “pv-current”;         // Put here your Variable label to pv voltage which data will be published
const char *VARIABLE_LABEL3 = “pv-power”;           // Put here your Variable label to pv power which data will be published
const char *VARIABLE_LABEL4 = “battery-voltage”;    // Put here your Variable label to battery voltage which data will be published
const char *VARIABLE_LABEL5 = “battery-current”;    // Put here your Variable label to battery current which data will be published
const char *VARIABLE_LABEL6 = “battery-power”;      // Put here your Variable label to battery power which data will be published
const int PUBLISH_FREQUENCY = 500;                  // Update rate in milliseconds
unsigned long timer;

Ubidots ubidots(UBIDOTS_TOKEN);

#define dht_apin 27  // Analog Pin sensor is connected to temprtut 27
dht DHT;

#define VOLT_CAL 190

EnergyMonitor emon1;  // Create an instance

#define NUMSAMPLES 5
int sensorValue;
int curr_samples[NUMSAMPLES];
/*
PIN CONNECTIONS SENSOR
S → A3 green
→ 5V red
→ GND blue
Calculate exact values with multimeter:
Vin on adapter = 12.41V
Vout on Arduino = 2.42
5V on Arduino = 5.10V
Vin / vOut = factor
12.41 / 2.42 = 5.128
*/

const int voltageSensorPin = A3;   // dc pv sensor pin
const int voltageSensorPin1 = A0;  // dc battery sensor pin
float vIn;                         // measured voltage (3.3V = max. 16.5V, 5V = max 25V)
float pvp;
float bp;
float Vbattery;  // measured voltage (3.3V = max. 16.5V, 5V = max 25V)
float vOut;
float vOut1;
float voltageSensorVal;       // value on pin A3 (0 - 1023) for esp (0-4096) ADC resolution for pv
float voltageSensorVal1;      // value on pin A3 (0 - 1023) for esp (0-4096) ADC resolution for battery
const float factor = 5.128;   // reduction factor of the Voltage pv dc Sensor shield
const float factor1 = 5.128;  // reduction factor of the Voltage battery dc Sensor shield
const float vCC = 3.30;       // Arduino input voltage (measurable by voltmeter) for esp32 =3.3
const int sensorIn = A4;
float Voltage = 0;
float VRMS = 0;
float AmpsRMS = 0;
float getVPP();
int mVperAmp = 66;  // use 100 for 20A Module and 66 for 30A Module
// pv dc current sonser
const int currentPin = 33;
int sensitivity = 66;
int adcValue = 0;
int offsetVoltage = 2168;
float adcVoltage = 0;
float currentValue = 0;

// battery dc current sonser
const int currentPin1 = 35;
int sensitivity1 = 66;
int adcValue1 = 0;
int offsetVoltage1 = 2168;
float adcVoltage1 = 0;
float currentValue1 = 0;

// the value of the ‘other’ resistor
#define SERIESRESISTOR 10000
// define Analog for Current and Voltage
const int curr_an_pin = 35;

int count = 0;

/****************************************
Auxiliar Functions
****************************************/
void callback(char *topic, byte *payload, unsigned int length) {
Serial.print(“Message arrived [”);
Serial.print(topic);
Serial.print("] ");
for (int i = 0; i < length; i++) {
  Serial.print((char)payload[i]);
}
Serial.println();
}

/****************************************
Main Functions
****************************************/
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  ubidots.setDebug(true); // uncomment this to make debug messages available
  ubidots.connectToWifi(WIFI_SSID, WIFI_PASS);
  ubidots.setCallback(callback);
  ubidots.setup();
  ubidots.reconnect();

  timer = millis();
}

void loop() {
  // put your main code here, to run repeatedly:
  if (!ubidots.connected()) {
    ubidots.reconnect();
  }
  if (abs(millis() - timer) > PUBLISH_FREQUENCY)  // triggers the routine every 5 seconds
  {
    // Start of Program temprture

    DHT.read11(dht_apin);
    float tem = (DHT.temperature);

    Serial.print(" humidity = ");
    Serial.print(DHT.humidity);
    Serial.print("%  ");
    Serial.print("temperature = ");
    Serial.print(DHT.temperature);

    Serial.println("C  ");

    delay(1000);  // Wait 1 seconds before accessing sensor again.
    // end sonser temprture
    // start dc pv voltage sonser
    voltageSensorVal = analogRead(voltageSensorPin);        // read the current sensor value (0 - 1023) for ard and 0-4096 for esp32
    vOut = (voltageSensorVal / 4096) * vCC;  // convert the value to the real voltage on the analog pin
    vIn = vOut * factor;                     // convert the voltage on the source by multiplying with the factor

    delay(1000);
    // end dc pv voltage sonser

    // start pv dc current sonser
    {
      adcValue = analogRead(currentPin);
      adcVoltage = (adcValue / 4096.0) * 5200;
      currentValue = ((adcVoltage - offsetVoltage) / sensitivity);

      delay(1000);
    }
    // end pv dc current sonser
    // start dc pv power

    pvp = vIn * currentValue;

    // end dc pv power

    // start dc battery voltage sonser
    voltageSensorVal1 = analogRead(voltageSensorPin1);         // read the current sensor value (0 - 1023) for ard and 0-4096 for esp32
    vOut1 = (voltageSensorVal1 / 4096) * vCC;  // convert the value to the real voltage on the analog pin
    Vbattery = vOut1 * factor1;                // convert the voltage on the source by multiplying with the factor

    delay(1000);
    // end dc battery voltage sonser

    // start dc battery current sonser
    {
      adcValue1 = analogRead(currentPin1);
      adcVoltage1 = (adcValue1 / 4096.0) * 5200;
      currentValue1 = ((adcVoltage1 - offsetVoltage1) / sensitivity1);

      delay(1000);
    }
    // end dc battery current sonser
    // start dc battery power

    bp = Vbattery * currentValue1;

    // end dc battery power

    Serial.print("Solar Voltage = ");
    Serial.print(vIn);
    Serial.println(“V”);
    Serial.print("Solar Current = ");
    Serial.print(currentValue);
    Serial.println(“A”);
    Serial.print("Solar Power = ");
    Serial.print(pvp);
    Serial.println(“W”);
    Serial.print("Battery Voltage = ");
    Serial.print(Vbattery);
    Serial.println(“V”);
    Serial.print("battery Current = ");
    Serial.print(currentValue1);
    Serial.println(“A”);
    Serial.print("Battery Power = ");
    Serial.print(bp);
    Serial.println(“W”);

    ubidots.add(VARIABLE_LABEL, tem);            // Insert your variable Labels temprture and the value to be sent
    ubidots.add(VARIABLE_LABEL1, vIn);           // Insert your variable Labels dc pv voltage  and the value to be sent
    ubidots.add(VARIABLE_LABEL2, currentValue);  // Insert your variable Labels dc pv current  and the value to be sent
    ubidots.add(VARIABLE_LABEL3, pvp);           // Insert your variable Labels dc pv power  and the value to be sent
    ubidots.add(VARIABLE_LABEL4, Vbattery);     // Insert your variable Labels dc pv power  and the value to be sent
    ubidots.add(VARIABLE_LABEL5, currentValue1);        // Insert your variable Labels dc battery current  and the value to be sent
    ubidots.add(VARIABLE_LABEL6, bp);  // Insert your variable Labels dc pv power  and the value to be sent
    ubidots.publish(DEVICE_LABEL);
    timer = millis();
  }
  ubidots.loop();
}

Can you please:

  1. Flash you ESP32 with this code.
  2. Open the Serial monitor, take a screenshot and upload it here so we can inspect the JSON being sent. As pointed by @Sebastian, you might be exceeding the max payload length set by our library or PubSubClient’s.

Last but not least, note that you PUBLISH_FREQUENCY = 500; means you’re making 2 publish per second, each with 7 Dots, which if you have a STEM account, your daily Dots allowance will deplete very fast.

–David

thanks for reply
the same problem can send 6 variables only when add one more the site don’t update
serial monter

21:46:24.862 -> BBFF-mbcxHDE7WbY9bM6A1iBaZ
21:46:24.862 -> Attempting MQTT connection...connected
21:46:26.716 ->  humidity = 0.00%  temperature = 0.00C  
21:46:35.719 -> Load Voltage : 0.00
21:46:35.719 -> Solar Voltage = 0.00V
21:46:35.719 -> Solar Current = -32.85A
21:46:35.719 -> Solar Power = 0.00W
21:46:35.719 -> Battery  Voltage = 0.00V
21:46:35.719 -> battery Current = -32.85A
21:46:35.719 -> Battery Power = 0.00W
21:46:35.719 -> publishing to TOPIC: 
21:46:35.719 -> /v2.0/devices/SCADA
21:46:35.719 -> JSON dict: {"temp": [{"value": 0}], "pv-voltaqge": [{"value": 0}], "pv-current": [{"value": -32.8485}], "pv-power": [{"value": -0}], "battery-current": [{"value": -32.8485}], "battery-power": [{"value": -0}]}
21:46:36.271 ->  humidity = 0.00%  temperature = 0.00C  
21:46:45.247 -> Load Voltage : 0.00
21:46:45.247 -> Solar Voltage = 0.00V
21:46:45.247 -> Solar Current = -32.85A
21:46:45.247 -> Solar Power = 0.00W
21:46:45.247 -> Battery  Voltage = 0.00V
21:46:45.247 -> battery Current = -32.85A
21:46:45.247 -> Battery Power = 0.00W
21:46:45.292 -> publishing to TOPIC: 
21:46:45.292 -> /v2.0/devices/SCADA
21:46:45.292 -> JSON dict: {"temp": [{"value": 0}], "pv-voltaqge": [{"value": 0}], "pv-current": [{"value": -32.8485}], "pv-power": [{"value": -0}], "battery-current": [{"value": -32.8485}], "battery-power": [{"value": -0}]}
21:46:45.793 ->  humidity = 0.00%  temperature = 0.00C

Hi @engjjd,

I did a test with the below code in my STEM account (I believe you’re under the same type of account):
Note that I’m sending 7 variables and have an 8th commented to test the edge case of a larger payload

/****************************************
 * Include Libraries
 ****************************************/
#include "UbidotsEsp32Mqtt.h"

/****************************************
 * Define Constants
 ****************************************/
const char *UBIDOTS_TOKEN = "YOUR_TOKEN";  // Put here your Ubidots TOKEN
const char *WIFI_SSID = "SSID";                // Put here your Wi-Fi SSID
const char *WIFI_PASS = "PASSWORD";        // Put here your Wi-Fi password
const char *DEVICE_LABEL = "scada";                 // Put here your Device label to which data  will be published
const char *VARIABLE_LABEL = "temp";                // Put here your Variable label to temprture which data will be published
const char *VARIABLE_LABEL1 = "pv-voltaqge";        // Put here your Variable label to pv voltage which data will be published
const char *VARIABLE_LABEL2 = "pv-current";         // Put here your Variable label to pv voltage which data will be published
const char *VARIABLE_LABEL3 = "pv-power";           // Put here your Variable label to pv power which data will be published
const char *VARIABLE_LABEL4 = "battery-voltage";    // Put here your Variable label to battery voltage which data will be published
const char *VARIABLE_LABEL5 = "battery-current";    // Put here your Variable label to battery current which data will be published
const char *VARIABLE_LABEL6 = "battery-power";      // Put here your Variable label to battery power which data will be published
const char *VARIABLE_LABEL7 = "test";      // Put here your Variable label to battery power which data will be published

float temp = 0;
float pv_volt = 0;
float pv_current = -32.8485;
float pv_power = 0;
float batt_volt = 0;
float batt_current = -32.8485;
float batt_power = 0;
float test = 45.2345;

const int PUBLISH_FREQUENCY = 5000; // Update rate in milliseconds

unsigned long timer;
uint8_t analogPin = 34; // Pin used to read data from GPIO34 ADC_CH6.

Ubidots ubidots(UBIDOTS_TOKEN);

/****************************************
 * Auxiliar Functions
 ****************************************/

void callback(char *topic, byte *payload, unsigned int length)
{
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");
  for (int i = 0; i < length; i++)
  {
    Serial.print((char)payload[i]);
  }
  Serial.println();
}

/****************************************
 * Main Functions
 ****************************************/

void setup()
{
  // put your setup code here, to run once:
  Serial.begin(115200);
  ubidots.setDebug(true);  // uncomment this to make debug messages available
  ubidots.connectToWifi(WIFI_SSID, WIFI_PASS);
  ubidots.setCallback(callback);
  ubidots.setup();
  ubidots.reconnect();

  timer = millis();
}

void loop()
{
  // put your main code here, to run repeatedly:
  if (!ubidots.connected())
  {
    ubidots.reconnect();
  }
  if (abs(millis() - timer) > PUBLISH_FREQUENCY) // triggers the routine every 5 seconds
  {
    ubidots.add(VARIABLE_LABEL, temp); // Insert your variable Labels and the value to be sent
    ubidots.add(VARIABLE_LABEL1, pv_volt); // Insert your variable Labels and the value to be sent
    ubidots.add(VARIABLE_LABEL2, pv_current); // Insert your variable Labels and the value to be sent
    ubidots.add(VARIABLE_LABEL3, pv_power); // Insert your variable Labels and the value to be sent
    ubidots.add(VARIABLE_LABEL4, batt_volt); // Insert your variable Labels and the value to be sent
    ubidots.add(VARIABLE_LABEL5, batt_current); // Insert your variable Labels and the value to be sent
    ubidots.add(VARIABLE_LABEL6, batt_power); // Insert your variable Labels and the value to be sent
    // ubidots.add(VARIABLE_LABEL7, test); // Insert your variable Labels and the value to be sent
    ubidots.publish(DEVICE_LABEL);
    timer = millis();

  }
  ubidots.loop();
}

– With seven variables, these are the debug messages and the variables at Ubidots, all updating:
Note that the payload is 230 characters long

18:17:07.513 -> WiFi connected
18:17:08.135 -> IP address: 
18:17:08.135 -> 192.168.1.20
18:17:08.135 -> broker:industrial.api.ubidots.com
18:17:08.135 -> brokerPort:1883
18:17:08.135 -> 24:0A:C4:05:7C:3C
18:17:08.135 -> BBFF-c6IHY4z********************RM
18:17:08.135 -> Attempting MQTT connection...connected
18:17:13.684 -> publishing to TOPIC: 
18:17:13.684 -> /v2.0/devices/scada
18:17:13.684 -> JSON dict: {"temp": [{"value": 0}], "pv-voltaqge": [{"value": 0}], "pv-current": [{"value": -32.8485}], "pv-power": [{"value": 0}], "battery-voltage": [{"value": 0}], "battery-current": [{"value": -32.8485}], "battery-power": [{"value": 0}]}
18:17:18.710 -> publishing to TOPIC: 
18:17:18.710 -> /v2.0/devices/scada
18:17:18.710 -> JSON dict: {"temp": [{"value": 0}], "pv-voltaqge": [{"value": 0}], "pv-current": [{"value": -32.8485}], "pv-power": [{"value": 0}], "battery-voltage": [{"value": 0}], "battery-current": [{"value": -32.8485}], "battery-power": [{"value": 0}]}

– With the 8th variable uncommented, these are the debug messages and the variables at Ubidots, they no longer update
Note that the payload is 260 characters long

18:34:35.253 -> .WiFi connected
18:34:35.253 -> IP address: 
18:34:35.253 -> 192.168.1.20
18:34:35.253 -> broker:industrial.api.ubidots.com
18:34:35.253 -> brokerPort:1883
18:34:35.253 -> 24:0A:C4:05:7C:3C
18:34:35.253 -> BBFF-c6IHY***************SkRM
18:34:35.253 -> Attempting MQTT connection...connected
18:34:40.700 -> publishing to TOPIC: 
18:34:40.700 -> /v2.0/devices/scada
18:34:40.700 -> JSON dict: {"temp": [{"value": 0}], "pv-voltaqge": [{"value": 0}], "pv-current": [{"value": -32.8485}], "pv-power": [{"value": 0}], "battery-voltage": [{"value": 0}], "battery-current": [{"value": -32.8485}], "battery-power": [{"value": 0}], "test": [{"value": 45.2345}]}
18:34:45.690 -> publishing to TOPIC: 
18:34:45.690 -> /v2.0/devices/scada
18:34:45.690 -> JSON dict: {"temp": [{"value": 0}], "pv-voltaqge": [{"value": 0}], "pv-current": [{"value": -32.8485}], "pv-power": [{"value": 0}], "battery-voltage": [{"value": 0}], "battery-current": [{"value": -32.8485}], "battery-power": [{"value": 0}], "test": [{"value": 45.2345}]}

Under the light of this information I was able to confirm that the issue is PubSubClient’s MQTT_MAX_PACKET_SIZE. By default, this is set to 256 bytes so I changed it to 512 in my local copy of the library. After that, I flashed the same code and variables started updating again, and the 8th became available:

Please do the same on your end and try again

–David

hi @dsr
can get the sketch using it to send 8 variables above

Hi @engjjd

What do you mean? I’m not sure if this already worked on your end or if you’re still facing issues?
If you mean the code, it’s at the beginning of my previous note

still not work please send code
I cant modified the code linked to me
thanks

The code is at the beginning of the David’s note, please read his comment carefully.

All the best