Select range from MATLAB plot to show into a webpage | MATLAB IoT Analytics | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Select range from MATLAB plot to show into a webpage
No permission to create posts
November 23, 2018
2:00 pm
Avatar
OmarPoch

Silver
Members
Forum Posts: 6
Member Since:
November 22, 2018
sp_UserOfflineSmall Offline

HI
i am very new in Thingspeak (and my english is not very good).

I have a project that makes that two pump water make a rotation each week. It uses Rabbit Semiconductor RCM3700 to make the control and shows the state into its embedded web server. The project have an ambient themperature sensor because the room where are the pumps is some hot. This is not a critical measurement.

When i saw about Thingspeak I thnk that I can add to a web page project a graphic showing the last month themperature register. I can do it without problem with MATLAB Visualization.

But now I want to add two field to web page, to define a range of months or for define the month and year to display (older than now). After this send the solicit with a button and get the graphic over the solicit period. It can be ussing other methode, of course.

I have looking for this, and I can not find how I can do it. I have read about REST API, but I am not sure that I can do it wih this.

Can you help me with this ???

Thanks a lot

Omar

November 24, 2018
11:50 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

Omar,
Your pump monitor sounds like a cool project.
You can definitely use ThingSpeak to get a specific date range to show on your plot.
Using the REST API, you can read a daterange of data. Here is an example:
http://api.thingspeak.com/channels/9/feeds.csv?start=2011-11-11%2010:10:10&end=2011-11-11%2011:11:11
from the read data doc page: https://www.mathworks.com/help/thingspeak/readdata.html
You can use the charts API to return a chart directly.:

https://api.thingspeak.com/channels/9/charts/2?title=Outside%20Ambient%20Temperature&xaxis=Time&yaxis=Average%20Temperature%20%5BF%5D&color=blue&type=column&width=500&height=500&average=10&yaxismax=100&dynamic=true

Here is the charts API page: https://www.mathworks.com/help/thingspeak/createchart.html

You can use the start and stop parameters in the charts API call as well. Be careful about the datetime format though, its pretty specific. Each parameter starts the & except the first one, which starts with a ?. Some parameters are not compatible with each other.

If you wanted to have user input to create the API call, you would probably have to make a web page with Javascript. Its not impossible, but there are a bunch of steps involved, and its not a ThingSpeak feature as much as something you can use the API to create.

If it is public, can you share your channel number? We are always looking for interesting projects.

November 25, 2018
10:56 am
Avatar
OmarPoch

Silver
Members
Forum Posts: 6
Member Since:
November 22, 2018
sp_UserOfflineSmall Offline

Hi cstapels thank you very much for your answer !!!!
... and for your comments about my project.

Your explanation is very clear . I have made some changes into the chart link that you send, by change the type parameter to line and it works ok !!!

At this moment i am working about send the commands from the RCM3700 to Thingspeak channels. I have made some test ussing curl command and all works OK.
Now I only need puts these command into the RCM3700 program :D.
After I can do it I will public the chanel and, of course, I will share its number.

On another hand I want to ask you how can I register digital states into a field chanel to show the change of its states. After your explanation I start to imagine other things to show, and I think to show the pump water state (on or off) too. I think that i can send the off state as a 0 and the on state as 10 to field 1, at sane time that i send the themperature value to field 2. How do you see ?

thanks a lot !!!

Omar

November 25, 2018
11:24 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 861
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

I haven't used the Rabbit core modules, I will definitely check them out.

There are a few ways to write digital states. The easiest is just to write a binary value to a field. Then you can add a numeric display widget or gauge widget to your channel to display the value.

https://www.mathworks.com/help/thingspeak/channel_display_widgets.html

You can also write text to any field or to the status field, for example if you wanted to display the word "On" or "Off". You can add a Status display to your channel on the channel configurations page.

When you write your pump data to the channel, you can write multiple fields simultaneously. Each write consumes only one message, even if you write multiple fields in a single write.
When you use the update field API call, just add additional parameters for each field:
https://api.thingspeak.com/update?api_key=XXXXXXXXXXXXXXX&field1=0&field2=2&field3=4...

The car counter channel uses a color display to show a binary state:
https://thingspeak.com/channels/38629

You can add a MATLAB visualization to your channel that reads a value and sets the color based on the value read.

November 25, 2018
5:07 pm
Avatar
OmarPoch

Silver
Members
Forum Posts: 6
Member Since:
November 22, 2018
sp_UserOfflineSmall Offline

Fantastic !!! tell me if i can help to you with Rabbit in some.

I will add a new update to this post when I have some to show.

Thanks a lot for your help !

Omar

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
11 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

briskpanda, Dejw0089, Yassine Ben Salah, anis, 43994554AKS, suda

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457