Ubidots Boron UDP Issue throubleshooting

boron
Tags: #<Tag:0x00007f1ca341bfb0>

#1

Greetings to everybody, I am currently working in an update to the actual Ubidots Particle library, we would like to support both Boron and Argon devices for sending data using UDP. Actually, the Argon works properly but we have faced an issue with the routine to send data using the Boron.

I have created a debug script so anyone in the community may give me some hints to solve the problem, this script works properly using an Electron (which is the other cellular device by Particle) but unfortunately it does not work as expected with the Boron

/****************************************
 * Include Libraries
 ****************************************/

/****************************************
 * Define Constants
 ****************************************/

const char *HOST = "industrial.api.ubidots.com";
const int PORT = 9012;
const char *USER_AGENT = "Ubidots/Boron";
const char *TOKEN = "BBFF";
const char *DEVICE_LABEL = "boron";
const char *VARIABLE_LABEL = "udp";
const int MAX_BUFFER_SIZE = 700;
UDP _client_udp_ubi;

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

// Put here your auxiliar functions

IPAddress getServerIp(const char *hostName)
{
    IPAddress serverIpAddress;
    serverIpAddress = Cellular.resolve(hostName);

    return serverIpAddress;
}

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

void setup()
{
    // Sets the max buffer size to send data
    _client_udp_ubi.setBuffer(MAX_BUFFER_SIZE + 1);
}

void loop()
{
    /* Builds payload */
    float value = random(0, 1000) * 1.0;
    char payload[MAX_BUFFER_SIZE];
    sprintf(payload, "%s|POST|%s|%s:%s=>%s:%f", USER_AGENT, TOKEN, DEVICE_LABEL,
            DEVICE_LABEL, VARIABLE_LABEL, value);

    Serial.printf("payload: %s\n", payload);

    /* Sends data */
    IPAddress serverIpAddress = getServerIp(HOST);
    Serial.print("Solved IP:");
    Serial.println(serverIpAddress);
    _client_udp_ubi.begin(PORT);

    Serial.println("Sending value");

    if (!(_client_udp_ubi.beginPacket(serverIpAddress, PORT) &&
          _client_udp_ubi.write(payload) && _client_udp_ubi.endPacket()))
    {
        Serial.println("ERROR sending values with UDP");
    }
    else
    {
        Serial.println("Value sent");
    }

    _client_udp_ubi.stop();

    delay(5000);
}

The Ip Address is solved properly but these lines:

  if (!(_client_udp_ubi.beginPacket(serverIpAddress, PORT) &&
          _client_udp_ubi.write(payload) && _client_udp_ubi.endPacket()))
    {
        Serial.println("ERROR sending values with UDP");
    }
    else
    {
        Serial.println("Value sent");
    }

plots me in the serial Port that the values were sent without errors, but, we do not see any of them in our cloud. Is there any issue with this way for sending data using UDP? I have just read the official Particle docs but I do not see any error. I also tried setting a fixed IP address, without success.

The tests were run in a device owned by @Backpacker87 as at my actual location there is not LTE CAT-M1, @Backpacker87 may you gently share in this post your firmware device version?

Any help from the community is really appreciated.


#2

@ParticleD, or @mstanley are you able to assist?


#3

Hi @ScruffR, sorry to bother you here, any advice or hint in this case?


#4

I think this is best handled by @mstanley.
For one I have no way LTE Cat M1 coverage either and the nitty gritty differences between Electron and Boron are best compared in a short loop between support and engineers within Particle (I’m not an employee).


#5

Hey @jotathebest, sorry on the delay to get back to you on this. Support has been particularly busy and this took a little longer to get around to than expected.

I’m afraid that this particular type of issue is outside of my scope of knowledge. @rickkas7 is our documentation writer and might be able to offer some additional information if you can provide specific documentation references in terms of caveats or implementations.

Although, given the issue at hand, I cannot guarantee he’ll necessarily have the answers, but I imagine he’ll be able to provide some insight into good next steps and with whom we can bring into the conversation from our engineering team to figure this out. :slight_smile:


#6

I ran your test program above on a Boron LTE running 0.9.0 and it functioned properly.

I replaced your server hostname with one of my servers on the public Internet and ran netcat to listen on a UDP port. The server received the values successfully.

$ nc -u -l 9012
Ubidots/Boron|POST|BBFF|boron:boron=>udp:747.000000Ubidots/Boron|POST|BBFF|boron:boron=>udp:85.000000Ubidots/Boron|POST|BBFF|boron:boron=>udp:576.000000

Here’s the serial debug output:

Serial monitor opened successfully:
payload: Ubidots/Boron|POST|BBFF|boron:boron=>udp:747.000000
Solved IP:65.19.178.42
Sending value
Value sent
payload: Ubidots/Boron|POST|BBFF|boron:boron=>udp:85.000000
Solved IP:65.19.178.42
Sending value
Value sent
payload: Ubidots/Boron|POST|BBFF|boron:boron=>udp:576.000000
Solved IP:65.19.178.42
Sending value
Value sent

#7

Is there a rate limit imposed on passing variables to ubidots?

We have 14 values from a weather station, but only the first 10 arguments of ubidots.add() make it to ubidots from the Boron running 0.9.0 (using UDP).


#8

Not from Particle’s side. You’d have to ask that the Ubidots folks :wink:


#9

I believe there’s a limit of 10 variables that can be passed to ubidots with a ubidots.sendall command. After you send them, the ubidots library flushes the buffer. To send your other variables, simply add them to the buffer and send them next.