Some Smart Thinking About Always-On Wi-Fi Gets a Raspberry Pi Pico W Weather Station Sipping Solar
The simple act of having a device put its radio to sleep means a theoretically unlimited runtime — after an MQTT library patch, at least.
Pseudonymous developer and self-described tinkerer "stfn" has been working on a project to run a solar-powered weather station using a Raspberry Pi Pico W — and in service of that has come up with advice for reducing the microcontroller's power consumption.
"Almost a year ago I made my first attempt at making a solar panel powered weather station using a Raspberry Pi Pico . That attempt turned out to be a failure," stfn explains. "The solar panels I used were not able to prolong the the life of a Pico in any significant way. This time I am working in two directions: first I am investigating ways to reduce Pico's power consumption, and secondly, looking into better panels to power the Pico from the sun."
The Raspberry Pi Pico W, launched as a successor to the popular Raspberry Pi Pico, which retains the original's dual-core RP2040 microcontroller but adds Wi-Fi and Bluetooth radios, isn't exactly a power-hungry device — but when you're building a project that is to be powered only from energy harvested from the sun, every microwatt counts.
Using a low-cost USB power meter, stfn found that the Raspberry Pi Pico W running a sample Wi-Fi-enabled MicroPython program would draw 45mA. "45mA may not sound like a lot, but if you have a Pico running from a 3,000mA battery, you'll get 75 hours at best of runtime," the developer explains. "And small, cheap solar panels will not provide enough current to power the Pico and charge the batteries at the same time. This is why my previous attempt failed."
To get that figure down, stfn set about making one major change to the project: turning the Wi-Fi radio off until it's needed for data transmission, dropping idle power draw to under 10mA. This, unfortunately, caused issues with the MQTT broker — fixed by adding a simple timeout that would reboot the microcontroller in the event of connection issues.
Using the rewritten program, and a pair of supposedly "3.5W 6V" solar panels, stfn's second weather station proved much more stable. "After 10 days of running, the battery voltage was around 4.10V at their lowest level, and they are recharging to full charge every day," the developer says. "I am convinced that with the current setup, the Pi Pico W can run indefinitely, or well, at least until late Autumn, when the days will be much shorter. But we'll measure that bridge when we get there."
The full project write-up is available on stfn's website, along with source code. "The lessons learned are universal," the maker notes, "and can be applied to any device running from 5V or similar voltage."
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.