Hi - yes, it's expected that the 3.3v and VBAT rails will always be live - even when the Pico is asleep, it still needs a power source.
Is this the moisture sensor?. If so, it mentions it takes 7mA, which would probably explain your power draw.
Espruino's IO pins will actually supply 20mA, so you could just power your sensor directly from one of Espruino's IO pins, with no external components... However the spec on that page does say it expects 3.5v minimum, so it's possible that might not work.
For driving a transistor from Espruino, you should have a resistor. It might work for you right now, but it will be putting strain on the transistor and your Pico. Transistors work on current, and can only be supplied with around 0.7v - so if the Pico is trying to force it to 3.3v, something's going to be given a hard time!
You could however use a FET. They work on voltage, not current - so you don't need a resistor for them at all.
One quick question: what voltage is your battery? If it's greater than 5v then if you did use a transistor/FET, you'd have to be careful about exactly how you wired it up so the Pico wasn't over-volted when it was turned off.
Finally, it could be possible that the Pico isn't going into deep sleep. Writing setDeepSleep(1) will tell the Pico to enter deep sleep when it thinks it can (but it's not immediate), so it's not guaranteed.
To get a rough idea, maybe try setSleepIndicator - so setSleepIndicator(LED1). This will then light up LED1 when the Pico is not asleep - so if you're finding that it isn't lighting up for long periods of time then deep sleep will be working.
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's expected that the 3.3v and VBAT rails will always be live - even when the Pico is asleep, it still needs a power source.
Is this the moisture sensor?. If so, it mentions it takes 7mA, which would probably explain your power draw.
Espruino's IO pins will actually supply 20mA, so you could just power your sensor directly from one of Espruino's IO pins, with no external components... However the spec on that page does say it expects 3.5v minimum, so it's possible that might not work.
For driving a transistor from Espruino, you should have a resistor. It might work for you right now, but it will be putting strain on the transistor and your Pico. Transistors work on current, and can only be supplied with around 0.7v - so if the Pico is trying to force it to 3.3v, something's going to be given a hard time!
You could however use a FET. They work on voltage, not current - so you don't need a resistor for them at all.
One quick question: what voltage is your battery? If it's greater than 5v then if you did use a transistor/FET, you'd have to be careful about exactly how you wired it up so the Pico wasn't over-volted when it was turned off.
Finally, it could be possible that the Pico isn't going into deep sleep. Writing
setDeepSleep(1)
will tell the Pico to enter deep sleep when it thinks it can (but it's not immediate), so it's not guaranteed.To get a rough idea, maybe try setSleepIndicator - so
setSleepIndicator(LED1)
. This will then light up LED1 when the Pico is not asleep - so if you're finding that it isn't lighting up for long periods of time then deep sleep will be working.Hope that helps!