How do I make calculations with ThingSpeak fields?

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일

1 개 추천

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 커뮤니티

카테고리

도움말 센터File Exchange에서 ThingSpeak에 대해 자세히 알아보기

질문:

2022년 5월 28일

편집:

2022년 6월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by