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:
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?
Magtag high current consumption
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- sj_remington
- Posts: 997
- Joined: Mon Jul 27, 2020 4:51 pm
Re: Magtag high current consumption
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:
It would be nice of Adafruit to publish a full sized PDF of the schematic.line 7721, column 10: redefinition of name 'supply1' in tag <library>
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
- sj_remington
- Posts: 997
- Joined: Mon Jul 27, 2020 4:51 pm
Re: Magtag high current consumption
Thanks but no clues there. A dive into the wakeup code would be the next step.
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Magtag high current consumption
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
https://github.com/adafruit/tinyuf2
The Magtag specific files are under ports/espressif/boards/adafruit_magtag_29gray
- picofun
- Posts: 23
- Joined: Fri Jul 29, 2022 9:22 am
Re: Magtag high current consumption
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.
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.
- ElliotGarbus
- Posts: 8
- Joined: Thu Jul 07, 2022 4:36 pm
Re: Magtag high current consumption
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
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
- picofun
- Posts: 23
- Joined: Fri Jul 29, 2022 9:22 am
Re: Magtag high current consumption
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.
- ElliotGarbus
- Posts: 8
- Joined: Thu Jul 07, 2022 4:36 pm
Re: Magtag high current consumption
Thanks for your response. Yes, setting the magtag.network.enabled = False does disable wifi.radio.
Thanks!
Thanks!
Please be positive and constructive with your questions and comments.