Hi to all
I making project to measure weight of beehive and send it to cloud.
ESP8622 read weight and send it to cayenne after this go to deep sleep for half hour.
Everything work OK if I don’t put ESP in sleep mode. I think it is not sending data immediate. How can I fix this? It is important for me to ESP stay wake as lees time as possible. Battery supply…
part of code:
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
}
void loop() {
sensors_1.requestTemperatures();
temperatura = sensors_1.getTempCByIndex(0);
zajem_adc= analogRead(beri_senzor); // napetost na bateriji
Serial.print(“Reading: “);
// Serial.print(scale.get_units(), 3);
teza= scale.get_units(5), 3;
Serial.print (teza);
Serial.println(” kg”);
// Serial.print(" calibration_factor: ");
// Serial.print(calibration_factor);
// Serial.println();
if (digitalRead(TARA) == LOW) {
shrani_tara();
Serial.println(“tipka TARA.”);
}
Serial.print("zajem ADC ");
Serial.println(zajem_adc);
Serial.print(“temperatura “);
Serial.print(temperatura);
Serial.println(” st.C”);
baterija= 80;
Cayenne.loop();
delay(1000);
scale.power_down(); // put the ADC in sleep mode
Serial.print("gremo spat… ");
ESP.deepSleep(30e6); // ESP in deep sleep
}
CAYENNE_OUT_DEFAULT()
//CAYENNE_OUT(1)
{
long rssi = WiFi.RSSI(); // moč wifi signala
Cayenne.virtualWrite(0 , teza, “TEZA”, “kq”); // teža na tehnici (vključno z kompenzacijo temperature)
Cayenne.celsiusWrite(1, temperatura); // temperatura okolice
Cayenne.virtualWrite(2 , rssi, “RSSI”, “dbm”); // WiFi signal
Cayenne.virtualWrite(3, baterija, “bat”,“%”); // stanje baterije v %
}