How do I make calculations with ThingSpeak fields?

3 ビュー (過去 30 日間)
Muhammed Maral
Muhammed Maral 2022 年 5 月 28 日
編集済み: Christopher Stapels 2022 年 6 月 6 日
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.

回答 (1 件)

Christopher Stapels
Christopher Stapels 2022 年 6 月 6 日
編集済み: Christopher Stapels 2022 年 6 月 6 日
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.
Use webread and the channels API to get metadata.
Use thingSpeakWrite to write the data to a new channel.

コミュニティ

その他の回答  ThingSpeak コミュニティ

カテゴリ

Help Center および File ExchangeRead Data from Channel についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by