Particle.variable(...) limitations and best approach to read multiple variables from different electron boards

Hi Particle Community,

Please help me to figure this out… I have a few electron boards, all of them are intended to run the same software, each will be installed on different units and ultimately each will pull individual set of data to be accessible through the particle cloud.

My original plan was to use particle.variable(…), but I just realized that for more than 100 variables per electron (integers 16-bit each), that might not fly at all.

What would be your suggestion, how should I wrap up the 100+ variables so they become accessible through the cloud? and how can I access them from a webpage?

Regards,
Jorge

Can you elaborate on why you need 100 16 bit variables for each electron? One way around this problem might be to convert the integers to a String, and combine them since a Particle variable can be 622 bytes long. Several of these String variables might get you to what you need.

1 Like

Thanks Ric,
Actually while waiting, I was writing that exact approach, my concern now would be, if the other end performs https:// GETs frequently, regardless if the variables change or not, would that imply data consumption on my electron on every GET call?.

Yeah, I’m pretty sure that any data transfer from the Electron is going to incur data usage. That’s why using GETs for this purpose is probably not a good idea. Without knowing more about what you’re trying to do, it’s hard to give you specific advice, but you might think about using Particle.publish (the data is only 255 bytes though), and only publish when the data changes. Of course, if you’re combining multiple ints into one string, then any time any one of those ints changes, the whole variable would be different thus invoking a publish.

Thanks Ric, I know I was a little bit vague with my explanation, but my approach is also very general.
Anyway, you still guide me to the right answer.
Look, seems like these two tutorials are exactly what I was looking for:

Wow! That’s a lot of data!

I believe there is a limit of 12 Particle.variable()'s in a firmware function, so you wouldn’t be able to register 100 of them. You would be able to use the Particle pub/sub system, though, to publish variables via the API so that can be stored/captured/consumed.