Magtag high current consumption

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
picofun
 
Posts: 23
Joined: Fri Jul 29, 2022 9:22 am

Magtag high current consumption

Post by picofun »

I am using the Magtag for a simple clock. Attached to the Magtag is an I2C-RTC and a AHT20 (for temp/humidity).

Once a day I update the RTC using wifi from worldtimeapi. Every minute the Magtag wakes up, reads the external RTC, updates the display and then goes to deep-sleep again.

I can measure the following current-consumption:
magtag-current.png
magtag-current.png (28.12 KiB) Viewed 112 times
The first peak is from fetching the time using wifi. The other peaks are during update of the display.

Now I wonder why the current consumption of the Magtag is so high during normal updates. It seems like CP inititializes the modem of the ESP32-S2 during boot although it is actually not used. If this is true, is there a chance that this could be changed in the future?

User avatar
sj_remington
 
Posts: 997
Joined: Mon Jul 27, 2020 4:51 pm

Re: Magtag high current consumption

Post by sj_remington »

On the off chance that an I/O pin might control the WiFi power (or whether some similar operation can be achieved), I tried to open the Magtag schematic from the Github repo with Eagle 6.5.0. That fails with a fatal error message:
line 7721, column 10: redefinition of name 'supply1' in tag <library>
It would be nice of Adafruit to publish a full sized PDF of the schematic.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Magtag high current consumption

Post by adafruit_support_mike »


User avatar
sj_remington
 
Posts: 997
Joined: Mon Jul 27, 2020 4:51 pm

Re: Magtag high current consumption

Post by sj_remington »

Thanks but no clues there. A dive into the wakeup code would be the next step.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Magtag high current consumption

Post by adafruit_support_mike »

The TinyUF2 source code is over in our Github repo:

https://github.com/adafruit/tinyuf2

The Magtag specific files are under ports/espressif/boards/adafruit_magtag_29gray

User avatar
picofun
 
Posts: 23
Joined: Fri Jul 29, 2022 9:22 am

Re: Magtag high current consumption

Post by picofun »

I solved the issue by lazy-loading the wifi-module. The import statement does not have to be at the top of the file, you can have it within your code.

Only loading the wifi-module when I actually need it reduces average current in my use case by about 38%, translating to 50% longer battery life.

User avatar
ElliotGarbus
 
Posts: 8
Joined: Thu Jul 07, 2022 4:36 pm

Re: Magtag high current consumption

Post by ElliotGarbus »

I'm curious what your code looks like. Are you using the MagTag() object? I access the wifi using the MagTag object and do not use the wifi module directly. Are you accessing the Wifi module directly to reduce power consumption?

I'm using the network enable/disable to turn the network on and off - but I don't have any power monitoring - so I have no idea if this is providing any power savings.
Here is an example from my code: https://github.com/ElliotGarbus/MagtagW ... de.py#L218

User avatar
picofun
 
Posts: 23
Joined: Fri Jul 29, 2022 9:22 am

Re: Magtag high current consumption

Post by picofun »

Correct, I'm not using the magtag-module, but the wifi module directly. Regarding the enable/disable of the network: you could look at the source code of the magtag-module. If disabling the network also disables wifi.radio, then it does save current.

User avatar
ElliotGarbus
 
Posts: 8
Joined: Thu Jul 07, 2022 4:36 pm

Re: Magtag high current consumption

Post by ElliotGarbus »

Thanks for your response. Yes, setting the magtag.network.enabled = False does disable wifi.radio.

Thanks!

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”