Feather M0 powering up but code mode executing on battery

I’m building a project using a feather M0 WiFi - ATSAMD21 + ATWINC1500

I have a few sensor hooked up into it, using the 3v pin for power.

Everything works fine when plug it on the usb, but if I plug it in the battery it seems the code doesn’t work.

If I plug it in the battery first and then in the usb, the moment I plug it on the usb it starts to work, and after I disconnect it it still works for ~10m then it stops.

I’m not sure if it is a problem with the battery is not feeding the 3v port properly, or if maybe I’m drawing too much power between the DHT, accelerometer, GPS and the onboard WiFi. (I did set the automatic power saving to the WiFi and I’m triggering only one every minute)

I’ll try to get creative on my debugging, maybe turn down a few sensors and see if that help, maybe use the BAT pin, but I’m more sure because I have it all soldered already, so I’ll try this as last resort.

Just decided to throw this out here to get any thoughts and also help other with similar issues.

Does your code wait until the serial port is established? If so that is where it is stuck because there is no USB data connection then the code never gets past this point.

Oh mannn! That was exactly it! Thank you so much, I wish I could pay you a beer or something! super helpful! I remove the wait and all Serial.prints and it works now

Glad that worked for you. You can leave the serial prints in if you like they don’t care nothing is connected.