ThingSpeak Community
Writing X & Y values for a bar graph, not time dependant
Stuart
2023-3-30
最新活动 由 Christopher Stapels
回复于 2023-3-30
Hello,
I am setting up a home energy monitoring system, all started from a blank sheet in arduino and its really working very well.
I would like to send data to thinkspeak which is not time dependant, i.e. send the X and Y values and format as a bar graph. The reason is, i have 12 channels monitoring energy (Wh) and i have this in an array which i plot on a local LCD and throughout the day the bars grow in height as the usage attributed to that channel grows. How can i do something similar in thing speak which by default applies a time stamp to received data.
Very simply, each channel has an ID (0-11) and a number associated with the accumulative Wh. I have a similar thing in excel for development where my serial port data is saved to a csv which excell imports every minute and updates a bar graph a bit like this;

Ive had a good look (perhaps not good enough!) and i just cant see how this may be acheived with thingspeak without a clumbersome combination of 2 channels (given each channel has 8 fields) and then using a matlab visualisation to pull it all together. Perhaps its not has hard / messy as it sounds? I am paid user so can create extra channels if required.
Thanks,
Stuart
3 个评论
Nice project! I think a MATLAB vis plus channels would not be too hard / messy (I have 100 of both).
But there may be a simpler way. Is all the data in ThingSpeak now? Does the data you use to make the plot come from ThingSpeak? If so, then we can definitely do it with just a MATLAB vis (no extra channels required)
As a paid user, you can set the MATLAB visualization plot to autoupdate as well.(though I think it is every 5 minutes that it will autorefresh)
Alternatively, you could use one channel, and write the 12 values you want to the channel, and then set the plot to only show the last 12 entries. Set the type as bar or column. Then you get something like this, though the axis still shows time. If you wrote timestamps (created_at) with your values where the timestamps has the present time to the minute, but then were 1 second apart starting with 1 second then 2 seconds, etc, then the scale at the bottom would roughly have the label that you want.

So I tried that, and you have to expand the plot to get the axis to do what you want, but it was fun to try. Here it is:

I know its a big hack, so if you need help wiht the MATLAB code for a custom vis, let us know what format the data in in and we can give you some hints.