I am running a local version of the cloud, where I have two Cores connected. Each Core has a sensor that I would like to be able to publish data to the server in a really high frequency (100ms for example).
I have seen in some posts that Spark.publish() has a limit to 4 per second.
Since I am running on my own server, is it possible to remove that limitation so that I can sample the sensor at the frequency I want?
Good question! The event rate limiting exists in two places, one is on the cloud, and the other is in the firmware. The firmware’s rate limiting is slightly more aggressive, but if you’re working locally you can certainly disable it.
If you’re using cores, then you’ll want to look in 0.3.4, the last firmware released for the cores, you can see some of the rate limiting code in the supporting core-communication-lib library here:
if (now - recent_event_ticks[evt_tick_idx] < 1000)
// exceeded allowable burst of 4 events per second
Totally, the location on the photon is slightly different, since it’d be using the newer HAL setup, but it sounds like you found it. It’s been a little while since I was in the local server codebase, but if I remember correctly, I left out the rate limiting on the local server for exactly this scenario
I am currently searching for doing this but I can’t. Can you explain what you’ve changed to make it works please. I’m a beginner so I don’t understand exactly what you have to change here. The cloud and the firmware of the photon. How do you made the one-time re-flash of the system firmware ?
First thing is this: you need to run your own local cloud before updating your Photon’s system firmware to disable rate limiting – Particle’s cloud implements its own rate limiting on the server side, plus it’s not too nice to attempt that on the cloud anyway
Local cloud instructions can be found here:
To disable rate limiting on your local cloud, you’ll need to download the firmware repository locally and modify the source code. Look at spark_protocol.cpp and comment out the rate-limiting code: