How do I make calculations with ThingSpeak fields?

3 vues (au cours des 30 derniers jours)
Muhammed Maral
Muhammed Maral le 28 Mai 2022
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.

Réponses (1)

Christopher Stapels
Christopher Stapels le 6 Juin 2022
Modifié(e) : Christopher Stapels le 6 Juin 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.
Use webread and the channels API to get metadata.
Use thingSpeakWrite to write the data to a new channel.

Communautés

Plus de réponses dans  ThingSpeak Community

Catégories

En savoir plus sur Read Data from Channel dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by