LILYGO TTGO SIM800 & ESP32 Module with MQTT

Thank you Shramik, I’ve also screened one of your earlier posts:

I’ve started adding feature by feature from the minimum working example.

The critical part was adding a delay before shutting down the module…I’ve kind of confirmed this by trying it multiple times with and without:

Can you recommend a best practice number of bytes? In the current version, I am using 6 double values via MQTT. Is that a bit much?

Also, the module has occasional problems connecting to Cayenne when only powered by battery but that’s hardware related, where it’s impossible for you to troubleshoot it…might be the pure wires delivered by the manufacturer. So if we assume the wire resistance is around 100-200mOhm and the SIM800 takes a maximum of 2000mA when sending, the voltage drop will be around 200-400mV, which could be enough to cause problems for the 3.7V LiPo and the voltage regulator afterwards.

Cayenne.virtualWrite(0, temperature, “temp”, “c”);
Cayenne.virtualWrite(1, signal_str, “signal”, “null”);
Cayenne.virtualWrite(2, distance, “analog_sensor”, “null”);
Cayenne.virtualWrite(3, humidity, “rel_hum”, “p”);
Cayenne.virtualWrite(4, (double)(pressure), “bp”, “hpa”);
Cayenne.virtualWrite(5, (double)(batterylvl), “batt”, “p”);
delay(3000);
modem.gprsDisconnect();
SerialMon.println(F(“GPRS disconnected”));
//After all off
modem.poweroff();
SerialMon.println(F(“Poweroff”));
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
esp_deep_sleep_start();