How do I make calculations with ThingSpeak fields?
15 views (last 30 days)
Show older comments
In my project, I have 5 channels which gathers the data as in the following fields:
1-) Temperature
2-) Light
3-) Humidity
4-) Particles in Air
5-) Flammable gas
6-) Vapor and smoke
7-) Movement
8-) Sound
Since ThingSpeak channels only retrieve 8 fields, I've created 5 more channels to make visualisations regarding with my data.
I would like to read the data from my channel feeds and calculate AIR Quality Index. Every field in channels will have a coefficient to calculate AQI (Air Quality Index). Eg:
Flammable gas data is more important than Light data in terms of AQI. As a result the fields will have following coefficients.
1-) Temperature (5)
2-) Light (5)
3-) Humidity (5)
4-) Particles in Air (15)
5-) Flammable gas (30)
6-) Vapor and smoke (30)
7-) Movement (5)
8-) Sound (5)
As sum, they will add up to a score over 100 and they will be displayed in a Gauge Widget and an Environmental Status box.
0 Comments
Answers (1)
Christopher Stapels
on 6 Jun 2022
Edited: Christopher Stapels
on 6 Jun 2022
Use the MATLAB analysis app. Write MATLAB code to read your channel data, do the calculation, and write the AQ value to a new channel. You can store the coeficients in the metadata for your channel.
Read channel data with thingSpeakRead. I prefer to use 'outputformat', 'timetable' so that you can refer to the individual field data by field name and dot notation in the timetable.
0 Comments
Communities
More Answers in the ThingSpeak Community
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!