Badger Issues - Reset and Battery Indicator

Got my badger yesterday and loving it so far but a couple of oddities that’s confusing me. First on battery power (2 x AAA’s in Pimoroni battery box) it’s very difficult to reset. I have tried reset plus a front panel button as advised but it seems a very randon, most times I can bel; licklijmg buttons for a while before it will reset? Reset works fine on USB and if I disconnect USB once its reset I can press buttons and access functions fine so battery is working.

The other is the battery indicator, it shows the battery symbol with a line through it, I have added launcher.py and made the voltage adjustments.

Have sussed the reset thing, need to hold down a front button for a few seconds after pressing RST. Still not resolved the battery Indicator though :(

Yeah, on battery power it needs a solid press on one of the front buttons to wake it up after you press reset.

If you run battery.py (pimoroni-pico/battery.py at main · pimoroni/pimoroni-pico · GitHub) it will show you the voltage reading coming from the battery so you can tweak the voltage values in launcher.py. Oh - and check you’re running the most recent version of Badger MicroPython - I think the ability to replace the built-in examples with your own was only added in 1.18.3.

I added some suggested values for 2xAAA as comments in the code in battery.py in a recent pull request. As @hel mentioned, it might be worth running it connected to USB and with the battery power on, to see the values coming in on the terminal, to give you a sense of what the power actually is. It seems to be working for me now.

Thank you both. I’ve run battery.py in Thonny and it reports:

Battery Voltage = 2.72061V.

I’ve input into launcher.py these values:

MAX_BATTERY_VOLTAGE = 2.8
MIN_BATTERY_VOLTAGE = 2.5

But still get the battery indicator with a cross through it? I’m running 1.18.4 btw.

Hmm, odd. It will only update the battery icon in the launcher when the display is refreshed - could that be the issue?

Might also be worth checking you’ve got the most up to date launcher.py code if you’ve been tinkering with a custom version for a while?

Ooh - I think I see what might be going wrong. My main.py was pointing at _launcher.py - that’s the built in version of the launcher.

Try changing the contents of main.py to import launcher so it runs your custom one with the amended battery values!

1 Like

Ah fantastic, thank you that fixed it for the AA’s 👍🏻

1 Like

Mine says imprit _launcher already but only shows the battery with the line through. What can I do?

Since the introduction of the most recent battery saving code, Badger spends most of its time turned off and the launcher mostly doesn’t stay awake long enough to get a stable voltage reading from the battery. The good news is that batteries last for absolutely ages now though - don’t think I’ve had to charge mine up since!

The software folks are having a think about what’s best to do with the battery icon, there’s an issue here if you want to track progress: Badger 2040 badger_os get_battery_level, strange behaviour · Issue #334 · pimoroni/pimoroni-pico · GitHub

You can run this example if you want to find how much charge is left in your battery:

Hi @hel,
I edited a copy of launcher.py to change the battery voltages to 3.4/3.0 as suggested.
I saved it as mylauncher.py and loaded it to the badger root directory.
I edited main.py to import mylauncher

This works fine when I start Badger by running main.py from Thonny (i.e on USB) and displays the battery lindication nicely.
The clock app even displays the correct time.

When I return to the launcher though, the battery indicator is no longer working and the system freezes.

If I restart the Badger without USB, the battery indicator does not work and the clock defaults to 2022/2/28.

I just tried using import mylauncher to point to a mylauncher.py and it it seems to be working OK for me? Check there’s no underscore in import mylauncher maybe? (the underscore tells Badger to use the copy of the launcher that’s built into the file system).

Badger doesn’t have an onboard RTC, so won’t be able to keep track of the time when it’s powered off. You could add a RTC breakout if you wanted it to save the time? (currently out of stock but I think more are on the way).

We’re working on Badger at the moment for… reasons, so hopefully we should be able to take a look at addressing the battery indicator issue at the same time (there’s more details/discussion about that at the Github issue linked a few posts back).

Hi @hel
It seems to be working now. I think I just needed to hold down the buttons a bit longer. Perhaps worth pointing out in the documentation.
I understand about the RTC (logical), but the clock app is then only really useful as a demo of how to program that type of changing display.
I hope you get the battery display to work properly and look forward to any other improvements you make.
Thanks

1 Like

You could add an RV3028 via the QWICC connector. I’ve done this on several PICO setups.

1 Like