Arduino MKR NB 1500 sleep mode after charge cycle

Hi All,
I'm having trouble with an MKR NB 1500 stopping publishing messages to Azure IoT Central after a battery charge cycle.

In the MKR NB 1500 product description it states:
"The chip is programmed with 4 hours of charging time, then it goes into automatic sleep mode. "
https://create.arduino.cc/projecthub/products/arduino-mkr-nb-1500
Does this mean it puts the whole system to sleep or just the charge controller?

I am using the below github sketch, modified to take measurements from the pressure transducer and battery level, which seems to work very well for a period of time then stops. See attached image.
Original Sketch: GitHub - mjksinc/TIC2019: Code repo for connecting MKRNB 1500 device to Azure IoT Hub as part of the Telstra Innovation Challenge 2019

The modified sketch with measurements is attached as a txt file as it it too large to add as a code.

I am using a 2000mAh 3.7V lipo plugged into the JST connector and a USB output solar panel connected to the USB port.

I have a WNK8010-TT pressure transducer connected by 3v3 I2C measuring water tank level.

I'm not sure whether it is the charge controller putting everything to sleep or a problem in the sketch.

I would ideally like to take and publish measurements every ten minutes with a sleep mode in between to reduce battery use. I've pushed the publish message out to 1 minute and it worked all night but then stopped at around 1:50pm after a solar charge cycle. It doesn't seem to connect to the broker if I push the message time out to ten minutes. Not sure if it will charge the battery if it is in sleep mode.

Any help would be greatly apreciated.
Cam.

ps

I went out and reset the board. It ran for a few minutes, then shut down again. I've just unplugged the solar panel and pressed reset again and its now been running happily for the past three hours. I'm guessing the on board charge controller is putting it to sleep. I will try a separate solar charge controller like this:

Unless some one has a solution to stopping the board from sleeping after a charge cycle.

tank level sensor MKR NB 1500.txt (11.5 KB)

I2C+Communication+Protocol+Specifications.pdf (191 KB)

WNK8010-TT.pdf (240 KB)

Cabsteena:
Does this mean it puts the whole system to sleep or just the charge controller?

Only the charge controller.

Thanks Pert,
Much appreciated.
Any idea what might be causing it to stop publishing messages to Azure IoT Central after a period of time. The best its done is 21 and a half hours of continuous publishing from 4:15pm yesterday to 1:50pm today at 60 second intervals. I'm going to try 20 seconds tonight.
I thought maybe it was the charge controller, but it stopped at 2am two nights ago with 3.80V of battery and obviously no charging going on from the solar panel.
So could it be the broker disconnecting? I thought this part of the loop code kept it alive:

// poll for new MQTT messages and send keep alives
  mqttClient.poll();

Ideally I'd like to take readings and publish every ten minutes but I haven't been able to get it to work at that frequency.
My newbie guess at this stage is it is keep alive related so I'm searching that at the moment if you have any ideas.
Thanks,
Cam

update:
I changed the code a fair bit to make it publish every hour and deep sleep in between. It also sets the tank height automatically by using the greatest mm as the max level.

I think the crashing was caused by it disconecting from the network in the "while" part of the "void connectMQTT();" part of the code.

Changes to the while part of the code below:

  while (!mqttClient.connect(broker, 8883)) {
    // failed, retry
    Serial.print(".");
    Serial.println(mqttClient.connectError());
    delay(5000);
    if (nbAccess.status() != NB_READY || gprs.status() != GPRS_READY) {
    connectNB();
  } 
  }

Don't forget to get the other libraries needed from here: GitHub - mjksinc/TIC2019: Code repo for connecting MKRNB 1500 device to Azure IoT Hub as part of the Telstra Innovation Challenge 2019

The updated code that seems to work well is attached.

MKRNB1500_tank_level_deep_sleep.txt (16.7 KB)