I’m looking for examples or guidance on programming lower power (i.e. STOP mode) modes for the SWAN, to be awakened by external event interrupts or internal timer. Ideally with C++ on VS Code/PlatformIO programming environment.
Zak Fields “Sleepy sensor” approach of controlling the EN pin of a MCU doesn’t fit my application.
Thanks!
Hey @JimM,
The demos we have on our documentation mostly use the EN pin approach, but there are a few examples in the STM32duino GitHub repo that you might find useful: STM32LowPower/examples at main · stm32duino/STM32LowPower · GitHub.
Also, @zfields is at an event right now, but he’ll probably have some ideas when he gets back
TJ
@tjvantoll @zfields I am trying the stm32duino/STM32LowPower approach on the SWAN with some success. I am able to programmatically put the SWAN to sleep and have it awake by either a timer, or an event on a pin. However, upon awaking, the Serial.print statements no longer work as the serial port on the Swan does not seem to be reactivating upon being awoken. Other functions (reading pins, sending data to a radio module, etc. seem to execute fine, just an inactive serial port after being put to sleep and awoken). I am not using the deepSleep, just the “sleep” option. Thanks for getting me this far!
I also tried the “deepSleep” mode with same results of no serial port functionality upon reawakening the SWAN. Nice power reduction, but have yet to see how to reenable the USB serial port.
@tjvantoll @zfields Some followup on low power consumption of the SWAN. The STM32duino/STM32 Low Power library works with the SWAN. Interestingly, I get the same low level of current (~650-700 uA per Current Ranger with Battery power) for both the DeepSleep and ShutDown modes.
Correction. DeepSleep works, but the LowPower.shutdown function does NOT seem to put SWAN in any low power state.
Hey @JimM,
That’s super cool that you got that working, and thanks for sharing it here!
Can you share the minimal code snippet it takes to get that running, so I can play with it as well?
Thanks,
Zak
@zfields Sorry, I should have been more specific. For gauging the SWAN sleep power levels, I used the example code in the library STM32duino/STM32 Low Power. Specifically the TimedWakeup example and AlarmTimedWakeup . I am using PlatformIO extension in VS Code to upload to the SWAN, then power the SWAN via battery with Current Ranger. Note, using the library in my application (using C++ directly in VS Code), the serial monitor of VS Code fails to reconnect when the SWAN awakes from sleep. I had the same issue with PlatformIO or Arduino IDE. My suspicion is the SWAN serial port is not reactiving after sleeping?
The lowest SWAN power state I am seeing is 650-700 uA).