Greetings,
setup is argon+mesh, but I don’t have devices yet for mesh like xenon, it’s just for trial… but, argon keep disconnecting from wifi after 30~40minutes. I am not sure how to debug this… the only message I can see is from the console Device Vitals
I am sure there are no heavy workloads inside argons, it just checks temp from DHT11, and store it in Particle.variable
and some simple Particle.function
that lits up LED lights from the example.
The device is disconnecting from the Particle Cloud too frequently. Large numbers of cloud disconnects are often caused by poor signal strength or network congestion. If possible, move the device to a place with better Cellular signal.
I already check this thread, I don’t think have heavy tasks… I can share the code…
// This #include statement was automatically added by the Particle IDE.
#include <TM1637Display.h>
// This #include statement was automatically added by the Particle IDE.
#include <PietteTech_DHT.h>
int led1 = D0; // Instead of writing D0 over and over again, we'll write led1
int led2 = D7; // Instead of writing D7 over and over again, we'll write led2
int pos = 0;
int led3 = D1;
Servo myservo; // create servo object to control a servo
// system defines
#define DHTTYPE DHT11 // Sensor type DHT11/21/22/AM2301/AM2302
#define DHTPIN D10 // Digital pin for communications
#define DHT_SAMPLE_INTERVAL 2000 // Sample every two seconds
PietteTech_DHT DHT(DHTPIN, DHTTYPE);
int CLK = D13; //Set the CLK pin connection to the display
int DIO = D12; //Set the DIO pin connection to the display
int NumStep = 0; //Variable to interate
int currentTemp = 0;
int currentHumid = 0;
TM1637Display display(CLK, DIO); //set up the 4-Digit Display.
void setup() {
myservo.attach(D5);
Serial.begin(9600);
Serial.println("starting..");
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
Particle.function("led", ledToggle);
Particle.function("feedFish", feedFish);
Particle.function("feedFish2", feedFishReset);
Particle.variable("currentTemp", currentTemp);
Particle.variable("currentHumid", currentHumid);
display.setBrightness(0x0a); //set the diplay to maximum brightness
display.showNumberDec(0);
}
void loop() {
retrvTempAndSave();
}
int retrvTempAndSave() {
int defTemp = 0;
int result = DHT.acquireAndWait(1000); // wait up to 1 sec (default indefinitely)
switch (result) {
case DHTLIB_OK:
{
Serial.println("OK");
currentHumid = (int)DHT.getHumidity();
currentTemp = (int)DHT.getCelsius();
display.showNumberDec(currentTemp);
Particle.publish("azure-temp", String(currentTemp), PRIVATE);
String data = String::format("{ \"tags\" : {\"id\": \"%s\"},\"values\": {\"temp\": %i, \"humidity\": %i}}", "beee-11-30-2", currentTemp, currentHumid);
Particle.publish("influx-particle-io", data, PRIVATE);
}
return defTemp;
// break;
case DHTLIB_ERROR_CHECKSUM:
Serial.println("Error\n\r\tChecksum error");
break;
case DHTLIB_ERROR_ISR_TIMEOUT:
Serial.println("Error\n\r\tISR time out error");
break;
case DHTLIB_ERROR_RESPONSE_TIMEOUT:
Serial.println("Error\n\r\tResponse time out error");
break;
case DHTLIB_ERROR_DATA_TIMEOUT:
Serial.println("Error\n\r\tData time out error");
break;
case DHTLIB_ERROR_ACQUIRING:
Serial.println("Error\n\r\tAcquiring");
break;
case DHTLIB_ERROR_DELTA:
Serial.println("Error\n\r\tDelta time to small");
break;
case DHTLIB_ERROR_NOTSTARTED:
Serial.println("Error\n\r\tNot started");
break;
default:
Serial.println("Unknown error");
break;
}
delay(1000);
return defTemp;
}
int getTemp() {
}
int feedFish(String pos) {
myservo.write(pos.toInt());
}
int feedFishReset(String pos) {
myservo.write(pos.toInt());
delay(800);
myservo.write(0);
}
int ledToggle(String command) {
if (command=="on") {
// digitalWrite(led1,HIGH);
// digitalWrite(led2,HIGH);
digitalWrite(led3, HIGH);
return 1;
}
else if (command=="off") {
// digitalWrite(led1,LOW);
// digitalWrite(led2,LOW);
digitalWrite(led3, LOW);
return 0;
}
else {
return -1;
}
}
Another weird thing is, I keep getting getting updated message from Event Logs
, meaning Particle.publish
is working… but I can’t see functions and variables, it only says the Device is Offline
thank you for the help.