Over the last few days I have had big problems keeping my core online.
I got a AP which is only used for one spark core, and two electric imps. I made a page with just a javascript running and pulling data from the api on all of them.
Both of the electric imps are at 0.01% failures of all calls, where the spark core is currently at 9.32% and still counting up, so it is not just my connection dropping.
The spark core can do its breathing, then suddenly go into green flashing, rapid white flashing, then breathing again. Today it went even more crazy with going from breathing to green flashing to breathing, and just a few minutes after back go green flashing… Now it has then just sat there flashing blue for over 3 hours, and if the blue flashing state it is in right now (Flashing blue: Smart Config, waiting for Wi-Fi credentials), it looks like it would never be able to recover from that on its own.
The code running on it is nothing crazy
float temperature;
char tempStr[16];
void setup()
{
Spark.variable("temperature", &tempStr, STRING);
}
void loop()
{
readTMP36();
float targetTemp = 23.8;
float targetHyst = 0.25;
pinMode(D0, OUTPUT);
if (temperature < targetTemp-targetHyst)
{
digitalWrite(D0, HIGH);
}
else if (temperature > targetTemp+targetHyst)
{
digitalWrite(D0, LOW);
}
sprintf(tempStr, "%f", temperature);
}
int readTMP36value = -1;
unsigned long readTMP36last = 0;
void readTMP36()
{
if (millis() - readTMP36last >= 500)
{
readTMP36last = millis();
if (readTMP36value == -1) analogRead(A0);
readTMP36value += analogRead(A0);
readTMP36value /= 2;
float voltage = (readTMP36value * 3.3)/4095.0;
temperature = (voltage - 0.5) * 100.0;
}
}
And I don’t see anything in this that should be able to mess with the connection, or wifi credentials if that is the case.
What can I do? I planned to use this in my garage to control the garage door, but with all the problems I have had so far with it, with it daily losing connection a few times and often not being able to recover after having failed flashing itself with new firmware, I don’t feel like it is worth spending the time getting it to work, when the brain behind it all seems to be the biggest problem in the project.