Will it wake from deep sleep when USB power arrives, or can it be configured to do so?
Yes, it should do that automatically.
If I comnect both battery and USB I presume this is safe but will there be zero draw from the battery while USB is connected?
Absolutely - just make sure you connect the battery using either the JST connector that you can solder to the bottom, or via the BAT_IN wire. There's special circuitry in there to handle the switchover of power sources.
When deep sleep is entered, sounds like 3.3V output on the Pico will be off.
Nope, it's actually fine. The GPIOs keep working (including pullups/etc) - just use the button like you would do normally and it'll keep working with deep sleep.
Lastly, if I want to use both VBat and 3.3V outputs, can the circuits share the same ground?
Absolutely - in fact that's the best way of doing it.
if I just set a pin to 1 using digitalWrite, I assume that is a 3.3 v output, and if so how does it differ from the main 3.3V output
It might not be quite 3.3v because of the circuitry in the IC, but it'll be close. Also you'll only be able to draw around 20mA from it. If you're using the 3.3v you could draw near 400mA (for short periods of time).
Saw the very helpful tip on another thread about measuring incoming battery voltage through E.getAnalogVRef in another thread
Only thing I'd say with that is E.getAnalogVRef() is measuring the voltage on the regulated 3.3v line - so realistically you'll only ever see that value change when the battery voltage is higher than 3.3v. It only starts to drop when the voltage gets near or lower than 3.3v and the regulator can't keep the voltage high enough...
But that's often fine - the STM32 will run down to something crazy like 2 volts, so you've got a lot of time below 3.3v before you have problems.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi,
Yes, it should do that automatically.
Absolutely - just make sure you connect the battery using either the JST connector that you can solder to the bottom, or via the
BAT_IN
wire. There's special circuitry in there to handle the switchover of power sources.Nope, it's actually fine. The GPIOs keep working (including pullups/etc) - just use the button like you would do normally and it'll keep working with deep sleep.
Absolutely - in fact that's the best way of doing it.
It might not be quite 3.3v because of the circuitry in the IC, but it'll be close. Also you'll only be able to draw around 20mA from it. If you're using the 3.3v you could draw near 400mA (for short periods of time).
Only thing I'd say with that is
E.getAnalogVRef()
is measuring the voltage on the regulated 3.3v line - so realistically you'll only ever see that value change when the battery voltage is higher than 3.3v. It only starts to drop when the voltage gets near or lower than 3.3v and the regulator can't keep the voltage high enough...But that's often fine - the STM32 will run down to something crazy like 2 volts, so you've got a lot of time below 3.3v before you have problems.