Comment on RPi Pico "disconnects" after a few minutes to days
dgriffith@aussie.zone 1 year ago
Perhaps slightly adjust your logic a little and see what it does.
Read from the sensors first, then connect to wifi and send the data, then disconnect. That would reduce the maximum power draw as only one function is active at once.
agressivelyPassive@feddit.de 1 year ago
I tried that. The loop was:
That should nicely separate everything, but it still ran into similar issues.
dgriffith@aussie.zone 1 year ago
Hmm I’m not sure of the pin drive currents on the Pico, but can you power the sensor off a pin? At least then you can programmatically power cycle the sensor if you need to.
agressivelyPassive@feddit.de 1 year ago
Not really, at least I wouldn’t really know how. The sensor needs +3V, GND and two data pins, and the pico only has one 3V out, that seems to connect directly to the voltage regulator. I guess, I could try to use a GPIO pin as a switchable 3V out, but that seems rather hacky.
Unfortunately, a simple machine.reset() seems not to be enough. I didn’t use “real” watchdogs, but what a Java dev knows: try/catch. I wrapped the entire loop in a try/except block and simply call machine.reset() if something goes wrong. That does work sometimes, but not always. Of course the possibilities are a) some exception isn’t getting caught b) there is some electronic issue, maybe the SPI interface to the DHT is “stuck” or not properly reset. I can resolve the problems by completely disconnecting the device for a while from power.