Hi,
I need an idea on how to calculate STD in particle photon.
I currently have temperature data monthly.
I need to calculate the standard deviation each months to predict some outcome.
I’ve search the libraries in Particle Web IDE, but none.
Can anyone help me?
Oh, sorry… before I forget, the monthly data will be gathered from google spreadsheets.
I want to add a new topic about google spreadsheet and particle photon, but I think this conversation is related. So… I need help and guidance from the expert.
I have successfully send temperature data from Particle Photon to Google Spreadsheet.
Now, I want to read back the data from spreadsheet to particle photon, in order for me to calculate the STD (monthly) from the sheets.
I have search in google on how to do it, but the searching result is not as expected.
Can anyone suggest me some ideas that work this problem out?
This thread is four years old and you have posted the “same” in a separate - double posting is not really appreciated in any forum as it skatters the conversation over multiple threads and ties down resources without extra benefit.
Hence I’ve moved the double post from the old thread to your own dedicated one.
If you want to pull in expertise from other users, you can tag them via their forum handle like this --> @Semp
However, I actually still need to read the data from google spreadsheet in order for me to use the math (std)…
As corrected and merged by @ScruffR on my posted about “Google Spreadsheet + Particle Photon”.
Do you have any idea on how to read back the data from spreadsheet to particle photon, in order for me to calculate the STD (monthly) from the sheets?
Hi, @Moors7…
Can you help me with my “Google Spreadsheet + Particle Photon” problem.
I can send data from particle to spreadsheet. Now, I want to read the data in spreadsheet, in order for me to calculate the std of the data from the sheet.
@semp, though you can send the data to the cloud for long term analysis, you can also store several months of data locally on the Photon itself. You can use EEPROM() to store data or attach a FRAM or microSD to store your data. You can then do your calculations on the Photon without needing the data back from Google sheets. One thing to be aware of is that even if you lose internet or cloud connectivity, you can operate independently with local storage.
I’m aware of EEPROM.
But I’m eager to know whether it is possible to read back the data that we saved in the cloud? Because, I’m also have done some other work that used cloud storage; the data can be pushed, but it seems hard(impossible) to red back the data. I don’t know why.
I need your opinion,
possible or not to read back data in cloud storage. If possible, how.
I have some news about my problem.
Now, I’m almost sure that I can do statistics using data in EEPROM.
Here I attach the code.
void loop() {
// read the pushbutton input pin:
buttonState = digitalRead(buttonPin);
ButtonState = digitalRead(ButtonPin);
EEPROM_START = 0;
EEPROM_END = count;
//Particle.publish("EEPROM_ENDe: ", String::format("{\"number =\": %d}", count));
if (buttonState == HIGH) {
Particle.publish("on1");
t = writeTemp();
EEPROM.write(address, t); //write value to current address counter address
Particle.publish("Temp Value:", String::format("{\"temp =\": %0.2f}", t));
Particle.publish("Sensor value stored at address:", String::format("{\"address =\": %d}", address));
address++;
count = address + 0;
Particle.publish("Testing value: ", String::format("{\"Contcount =\": %d}", count));
delay(1000);
//Particle.publish("Button press count:", String::format("{\"count =\": %d}", buttonPushCounter));
}
else if (ButtonState == HIGH) {
Particle.publish("on2");
float mean;
for (int i = EEPROM_START; i < EEPROM_END; i++)
{
sum = sum + EEPROM.read(i);
Particle.publish("Summation:", String::format("{\"sum =\": %d}", sum));
delay(2000);
}
mean = sum / count;
Particle.publish("Average Value:", String::format("{\"mean =\": %d}", mean));
delay(1000);
//Particle.publish("Button press count:", String::format("{\"count =\": %d}", ButtonPushCounter));
}
delay(2000);
}
However, I’m getting 0 value when I’m doing sum operation.
Need your idea on how can I get the sum operation better.
Below is a screenshot of the web IDE console.
EEPROM.write() and EEPROM.read() only write/read one single byte. float is using four. EEPROM.put() and EEPROM.get() would be the functions you need to use instead.
For style, try using more descriptive and different names. buttonPin vs. ButtonPin and buttonState vs. ButtonState are not the best of choices.
Also unifying multiple events into one and sending them as PRIVATE would be better too.