I am working on some iot project that need to transmit data to server after 30 secs. My code works fine for more than hour while connect to usb or external power supply at 4.1
But my code stop working randomly after 10-30mins when just battery is connected, i have tested both 1000mah and 2000mah 3.7 lipo battery.
I am using simple gsm client sketch to upload to server using POST request.
Can you share your sketch with us, if you are not putting your device into a low power mode or turning it off then it may just be your battery running flat? Easiest way I can think to check that would be to read the battery voltage as part of your sketch and see if it goes down over the 1 hour it works for when on battery only.
I am not putting device into low power mode, however i am keeping a check over battery and battery remain over 4v. battery running flat is not a problem.
suggest me some way to trace the problem as the problem doesn't occur while connected to serial.
The basic included sketch with the MKR GSM 1400, which I've used to upload data to a website, runs once only, and then includes a for loop which ensures that the device does nothing after running once.
How has your sketch been configured to run multiple times?
Are you able to give us some help in troubleshooting your sketch by either sharing the sketch you use and the output from it if it does output to standard out. If you can share it, please use the Included code format markup to make it easier to read.
That's probably the best way of troubleshooting is to have the serial monitor open and include some print lines at key places within your sketch to demonstrate to yourself what your sketch is doing or running when it stops working.
smgs is correct.
We would need to see the sketch itself to be able to diagnose what you are seeing.
If there is a "while serial" statement (or similar) that would possibly cause issues as it waits for the USB/communications to be connected before it will continue.