Hans on IoT

ThingSpeak, MATLAB, and the Internet of Things

Send Bulk Sensor Data to ThingSpeak for Analysis 3

Posted by Hans Scharler,

Many IoT projects collect data from a sensor and send the data to ThingSpeak at the same time over and over. To continuously collect and send data to the cloud requires the device to be powered and connected all of the time. A battery-powered IoT device like a Particle Photon or Onion Omega2 would run out of power quickly. There are many IoT applications where you want your IoT device to collect the data offline over a long period of time, then send the data all at once to ThingSpeak for analysis.

The ThingSpeak team at MathWorks is excited to announce Bulk-Update! This new ThingSpeak feature is targeted at IoT devices trying to optimize battery use by allowing the device to update a lot of data at once. To help you get started with bulk-update, we have written examples for Arduino, ESP8266, Particle Photon, and the Raspberry Pi 3.

Once your data is on ThingSpeak, it is easy to analyze using the MATLAB Analysis and Visualization apps within ThingSpeak, MATLAB Online, or Desktop MATLAB. To read data from ThingSpeak into MATLAB, use the ThingSpeak Support Toolbox and the thingSpeakRead command. We have released documentation and examples to help you get started with bulk-update on ThingSpeak.

Resources for Bulk-Update

3 CommentsOldest to Newest

Eight19_FC replied on : 1 of 3

I am trying to implement this bulk transfer from the Particle Electron. I have tried directly copying the example code for the photon, but in the “Response code” published I reliably get either a 1, 0, or 500, and my ThingSpeak channel is not updated.

I have also attempted using the webhook method recommended by Particle, but although I have done my best to format the JSON file in the publish as it is in the documentation, there is usually a 401 (invalid API key or channel mismatch), but the API key I have put into the json and the channel number in the url are both correct.

Can anyone advise me on implementing this bulk transfer method for an Electron? My project needs to be as low-powered as possible, and the methods in the particle documentation are insufficient as there does not appear to be any other way of ensuring that published data points are associated with their own particular timestamp rather than the timestamp of the publish.

Hans Scharler replied on : 3 of 3

I have taken a closer look at the issue. In your code do you have a line that looks like this?

strcpy(data,”write_api_key=”+WriteAPIKey+”&time_format=absolute&updates=”);

Make sure “time_format” has an underscore.

Let us know if that helps.

Add A Comment

What is 4 + 8?

Preview: hide