Imp stop communication with other devices after hours

imp read sensors data from Arduino through UART, then send these data to cloud.
the process going well but after hours, imp seems stop receive data form Arduino.
The IDE status is "/ device online / agent running / agent link " , it seems internet connection okay.

the code is here:
function readserial() {}
imp.wakeup(1, readserial);

please help to advise! How to keep the imp running, nonstop. Thanks

Since you’re setting the loop to run after one second with imp.wakeup(), you probably don’t need the imp.sleep(), so I’d drop that. It may even cause the problem: imp sleeps for a second then continues running readSerial(), but in that time, the imp.wakeup() timer has fired and caused readSerial() to be run again, and so on, and so on…

I would also check the logs in case there are any indications the device reconnected. If the imp can’t communicate with the server it will, by default, go into deep sleep for nine minutes. When it wakes, it reboots your Squirrel.

You might want to log data received from the Arduino to the server using server.log(), just to ensure that the imp is getting the data you think it should be receiving.

Check out ‘Running an imp Offline’ to learn how to avoid the nine-minute deep sleeps if that’s the problem, and ‘Device Sleep and Pause States Explained’