WiPy shutting down after a few hours
I'm experiencing a strange problem. I have a WiPy 2.0 power from a 12V USB adapter that is connected to the load terminals of a solar charge controller. I have a solar panel and 7.4 AHr battery connected to the charge controller. The battery has never dipped below 50% charge (12.2 volts displayed on charge controller). The code in main.py reads data from soil and air sensors via an SDI-12 interface board every five minutes then sends it to ThingSpeak (https://thingspeak.com/channels/451589). I use a "while True" statement as the main loop in my code.
The problem is the WiPy shuts down every few hours. It doesn't restart until I hit the reset button on the board or Ctrl-D from the REPL in ATOM. ATOM is able to connect to the WiPy after the board stops sending data.
If the power to the board drops enough to shutdown the board, shouldn't it restart the main.py code again once power is restored? What would cause the board to stop executing main.py but maintain connection to ATOM?
@robert-hh The hearbeat LED flashes when the board and code are working properly. If I notice that the data is not updating, I'll go look at the board and the heartbeat LED won't be flashing. I'll hit the reset button on the board and everything will work normally again.
I think I'll setup an identical rig but power the USB power port from a variable DC supply. Then I can turn the voltage down and see what happens.
@jmpratt The heartbeat LED also stops flashing if your code is in a tight busy loop like:
I do not know what happens in a brownout condition. The CPU and it's I/O can run on slightly lower voltage than the analog section including WiFi. That may cause the WiFi to lock up. But since you have pretty large battery, I still would assume some kind software issues.
@jmarcelino I don't think it's dropping wifi. The heartbeat LED won't be flashing when it stops sending data.
Shouldn't the WiPy boot back up when power is restored?
jmarcelino last edited by
Can I ask why/what you call a shutdown?
Actually the MicroPython interpreter must be running if it catches Ctrl-D from Atom.
Maybe the board just dropped off WiFi?
@jmpratt So you are calling sleep(300).
@robert-hh The code sleeps for 300 seconds between readings. I've waited 12 hours and the code has not resumed.
@jmpratt You say that you read the sensor every five minutes. How dop you determine that interval?
And if you wait long enough (a few hours), does the transmission resume?