Newbie question: Transferring long strings or binary

Hi all,

I have a device that returns data in pages; 1031 bytes or 2062 bytes of hex. There is usually only one or two pages but there may be up to 13 pages; a string of 27 kB.

I have been looking at the reference for a while and I can't see a way to send this data back as a contiguous string or array. Am I missing something?

Alternately I could get the Particle device to send the data pages directly to my API. Is that permitted? Does anyone have any other ideas?

Thanks in advance,


First we'd need to clarify some possible misconceptions.
When you say

we'd need to know whether you get a 1031 long stream of bytes or if you get a stream of 2062 bytes where each byte represents the hex digit of a nibble (four bit or half byte) of the original byte.

I guess it is the former and the HEX thing is merely a virtual representation of the actual payload.

If you represented your 1031 byte stream in decimal notation you wouldn't call that 3093 bytes of dec either :wink:

With this out the way, we'd need to know how you'd request the data from the device so that it would return the pages it in response.
Or do you mean the device sends the data on its own?
What interface and what protocol are you using?
Also, would you know how many pages to expect?

The "page" is generated by an 8 bit MCU. It is always 1031 bytes; 1024 bytes of data from the MCU flash memory plus a CRC, a few control bytes and a continuation byte. My mobile app grabs the stream, checks the CRC, converts it to hex, creates a CRC for that hex and sends it to the API. I can deal with either a binary stream/array or a string of hex. No numeric values.

I get the Particle device to poll the MCU. I would probably use the API to send a command to the Particle device to poll the remote MCU and either return the data or populate a set of variables to grab later. I could split up my 2062 byte hex string into three strings of less than 1024 bytes if that is the limitation.

Normal operation is only two polls per day, so I don't need to stint on data operations.

Basically my question is: Is the biggest thing I can transfer from a particle device to a 1024 byte string? Is there any way to send a larger payload and/or a binary stream/array?

I can guess approximately how many pages I will be expecting.

As a matter of interest. What is the biggest array of bytes (uint_8) or length of string I can declare in, say, a Boron?

I forgot to thank you for your response. Thank you for your response.

I have been looking at Webhooks. Is there a limit on the size of the payload transmitted by a Webhook?


1 Like

Webhook responses sent to your Particle device have a limited chunk size (see reference docs for your respective Particle device) but one response can have multiple parts and each part comes with its own "serial number".
Hence your data should be transferable via Webhooks.
However, arbitrary binary streams cannot be sent this way. Only a subset of the 256 possible bit combinations are allowed. Your HEX stream would satisfy that or Base64/Base85 would do the trick too (with less overhead).

You can check the amount of free memory with System.freeMemory().
That would be the theoretic maximum you could use, but I'd save some for dynamic needs of the device OS.

Thank you. I think I will do this:

For each poll command, issue a UID.

The response from the remote device is a sequence of 1031 byte streams.

Each stream is split in two and each half is converted to Base64 and prepended with the UID, sequence number (n of x) and half identifier.

The server collects all the parts and pieces them together.

A bit of a faff but I only have to do it once.