Simple stats on the app/platform

I am thinking of a project where multiple sensors of the same type (let’s say temperature sensor) will be sending values to the same Blynk app. I believe this is possible because they all share the same token but use different pin numbers. The app is expected to show all values, perhaps as line graphs. I haven’t actually tried this but I think it’s possible on Blynk. Sensors will be in different locations.

What I what to do next is the Blynk app to display the average value of all the sensors at that point in time and show this as a line graph. I think is this currently not possible. If it’s already possible, do let me know how. Thanks.

We could expand this to show max, min, median and so on.

For sure what you require is possible. As long as you put your data on a value display (total, average, max, min, median etc) it is available to the history graph widget.

In value display, I see pin selection, range and frequency. Where do I specify avg, min, max, etc.

In your sketch you work out the average, for example, and then write it to a value display that is tied to a virtual pin. This virtual pin is then selected in the history widget.

So value display on V0.

Blynk.virtualWrite(V0, youraverage);

It cannot be done in a sketch because the values are coming from different sensors at different locations.

You said the sensors share the same token so their location is not important, that is the beauty of the ioT.

Maybe explain in more detail if I have misunderstood what you wish to do.

Yes, location is not important but maybe I am missing something.

In a sketch at one location, only the sensor value of that location is available. It’s only the Blynk app that has access to values from all locations. Hence averaging can be done only at the app. At least, this is my understanding.

You wrote “What I what to do next is the Blynk app to display the average value of all the sensors at that point in time and show this as a line graph.”

This is what I was responding to, this is available, yes?

Yes, that statement is still valid. Is it possible?

To put it differently, I would like the averaging done across channels, not across time of a particular channel. Hope it’s clear.

Yes it is possible and you can have at least 32 sensors as there are 32 virtual pins and it is done as I have outlined above.

Your term channel is not clear to me. Please explain.

Could you explain where this averaging is done in your approach? It will help me understand.

Channel is a term borrowed from other IoT platforms such as Xively. Carriots for example uses the term Stream. So for example, if Arduino is sending temperature and humidity, each one can be considered as a channel or a data stream.

So my requirement is 4 temperature sensors in 4 locations A, B, C, D. They start sending data as follows (4 channels):

A: A1, A2, A3, A4, …
B: B1, B2, B3, B4, …
C: C1, C2, C3, C4, …
D: D1, D2, D3, D4, …

App is required to display each sensor readings as a line graph. Thus we will have four line graphs.

Plus, app should display the average value, let’s call it Z. Thus Z line graph should have:
Z1, Z2, Z3, Z4, …

where Zn = (An + Bn + Cn + Dn)/4

The sketch in one (or all) of the sensors would be doing the average of all the sensors.

In short:

Simple Timer writes the current value of a sensor A (A1) to value display 1 on V1, sensor B (B1) to value display 2 on V2 etc at your required intervals, say 10 minutes. After 10 minutes it reads A2, B2, C2, D2 and then 10 minutes later A3, B3, C3, D4 etc.

With Simple Timer again the sketch reads the values of the virtual displays (V1, to V4) at intervals and stores them in a variable. So you have the total values of the sensors and with a loop counter you have the average Z1 which you send to another value display (say V5). 10 minutes later you have Z2 etc. The history graph is linked to V5 and shows you the average readings of the 4 sensors.

1 Like

Thank you. It’s clear. I will try it out later this week.

@iotesque Blynk.virtualWrite() already does “averaging” if you opens it via History Graph widget. Our history graph ideally fits your needs :wink:. The only problem at the moment - lack of space. One project will allow you to place only 3 graphs (12 sensonrs). You can go with multiple projects approach. Also
very soon we will release new Tabs widget. That will increase space in 4 times.

How may sensors do you expect to have in total?