stfn,
@stfn@fosstodon.org avatar

New blog post!

This one took weeks to write. It's about me finding a way to significantly reduce the power consumption of a Raspberry Pi Pico W working as a weather station, collecting environmental data.

I am also writing about powering the Pico using solar panels, and this time it's a success, my weather station can now run indefinitely, powered by the sun!

https://stfn.pl/blog/34-pico-power-consumption-solar-panels/

#RaspberryPi #RaspberryPiPico #Solar #offgrid

dj3ei,
@dj3ei@mastodon.radio avatar

Power reduction can be had by accumulating measurements and batch sending.

E.g., the actual connection to WiFi and sending out of accumulated data could be done if any of these conditions hold:

  • Last sending attempt ≥ 15 minutes ago.
  • Any of the current measurement values deviates significantly from the last that has been sent.

Otherwise, store the present measurement values to be sent later.

@stfn
@yvan
@steelman
@gim
@jo
@stfn
@quantensalat
@karlbunyan

dj3ei,
@dj3ei@mastodon.radio avatar

One detail: I deviously wrote "last sending ATTEMPT". If your WiFi becomes unreachable for a few hours, you do not want the power consumption to go up during that time.

Depending on RAM availability, a few hours of WiFi breakdown need not lead to loss of a single measurement.

Code becomes more complicated. Simply restarting the whole thing would lead to stored measurement amnesia, so do that only as last resort.

@stfn @yvan @steelman @gim @jo @quantensalat @karlbunyan

dj3ei,
@dj3ei@mastodon.radio avatar

Ah - come to think of it: Your present implementation seems to have a bug here:

If your WiFi becomes unavailable, then the device reboots every 10 seconds and constantly tries to connect to WiFi, which probably causes your power consumption to skyrocket towards your original 45 mA.

@stfn @yvan @steelman @gim @jo @quantensalat @karlbunyan

stfn,
@stfn@fosstodon.org avatar

@dj3ei @yvan @steelman @gim @jo @quantensalat @karlbunyan thank you for the contribution, you are making very good points. One place that would for sure make the code more complicated is that I would need to attach timestamps at the Pico level. Right now I just send data from the Pico, and InfluxDB handles time-stamping of incoming messages as they arrive.

quantensalat,
@quantensalat@astrodon.social avatar

@stfn Hey,

we're using pi picos for envitonment sensors with a Tpl5110

stfn,
@stfn@fosstodon.org avatar

@quantensalat wow, I did not know such a thing existed, and it looks like a perfect, simple solution! Thanks for sharing!

quantensalat,
@quantensalat@astrodon.social avatar

@stfn Cool, I myself learned it from a friend who designs weather stations. The disadvantage is that the timing is not mega precise, in case that's needed.

Also, the ready made tiny boards sold by adafruit become unstable when driving picos (as opposed to arduino boards I supoose), and we had to add 1 Ohm resistors in series to dampen the start up current. Also, we had to pull down the cutoff pin gently to ground for it to reliably wake up again.

stfn,
@stfn@fosstodon.org avatar

@quantensalat "Also, we had to pull down the cutoff pin gently to ground for it to reliably wake up again."

What do you mean by this? Sorry, I'm not that will versed in designing circuits

quantensalat,
@quantensalat@astrodon.social avatar

@stfn The pins are connected to ground (0 volts, negative supply) like so. When the pin is disenganged e.g because the raspi is turned off, the resistor makes sure that the pins go down to 0 Volts and don't remain charged. When the raspi turns the pin on, the resistor is large enough not to draw significant current.

stfn,
@stfn@fosstodon.org avatar

@quantensalat so it is to ensure that ground will always be 0V and not introduce some unwanted currents?

quantensalat,
@quantensalat@astrodon.social avatar

@stfn The ground is 0V by definiton.. The pin thoigh is switched on to 3.3V to trigger the timer, and then has to go back to the value.0V, and that happens more reliably if the pin is connected to the 0V line.

stfn,
@stfn@fosstodon.org avatar

@quantensalat right, now I get it!

jo,
@jo@macaw.social avatar

@stfn Nice!

I had a similar project: https://macaw.social/@jo/109841115289284814

I found deepsleep to not work reliably. Program code got corrupted with it. I think I pushed it to max power saving at <3mA idle/lightsleep, with a lot of clock tweaking etc.

In hindsight I'd say 2W solar & 600mAh was prob on the low end of feasible :D

stfn,
@stfn@fosstodon.org avatar

@jo did you use C or microPython for your project? I'm curious how you changed the clock speeds. And the charging circuitry is kind of complicated, if I understand correctly you implemented your own solution instead of using an off the shelf controller?

Right now I'm also working on a different project, and I am also using Tupperware for the case, and had problems with placement of the sensors. I'll publish a blog post on it soon. Thanks for sharing!:D

karlbunyan,
@karlbunyan@mastodon.gamedev.place avatar

@stfn I've used an external board from Adafruit that turns the Pico on at specified intervals https://www.adafruit.com/product/3435 Every 30 minutes(ish) it checks plant moisture levels and powers down when it's done. It's been running for a year from a half-shaded 1W panel in UK sun

stfn,
@stfn@fosstodon.org avatar

@karlbunyan Thank you, you're the second person in the replies using that board, I need to take a closer look at it

gim,
@gim@lou.lt avatar

@stfn possibly naive question(s): if you over charge battery, 1) I'm assuming power manager will cut it off and will then instead dissipate voltage as heat?
2) if that's the case, what if it (power manager) will get overheat (I'm guessing it's gonna shut down or burn)

stfn,
@stfn@fosstodon.org avatar

@gim Yes, it does do overdischarge and overcharge protections, and it has a small radiator at the bottom to dissipate heat. As for 2), I don't know, I haven't reached that point yet

steelman,
@steelman@mstdn.io avatar

@stfn I know nothing about RPiP but I expect it has some power management features that allow for significant reduction of power consumption. I also expect that Python's time.sleep() does not support those features. Third issue I can see here is that the program can sleep much longer b/c the time constants of environmental conditions is way longer.

PS. Take a look here https://ghubcoder.github.io/posts/deep-sleeping-the-pico-micropython/

stfn,
@stfn@fosstodon.org avatar

@steelman

There is also machine.lightsleep(), but from my testing, it did now make any difference from time.sleep(). And deepsleep is not yet implemented in MicroPython. Maybe it's different in C, but I don't know C (yet).

And yes, it can sleep longer if you want less granular data.

I read the article that you posted, I even linked it at the end of my post.

Nonetheless, thank you for the feedback, I really appreciate it!

steelman,
@steelman@mstdn.io avatar

@stfn Re: granularity

The thing is that 1m granularity makes little sense for environmental parameters as they don't change that fast if you measure them properly (Nyquit-Shannon sampling theorem).

I played with BME280 and DS18B20 and they both are very sensitive and need something (enclosure, a heat sink) to increase their inertia. Otherwise they are able to detect very minor changes. Eg. I had to flip the circuit upside down b/c an ESP8226 running for 20 seconds heated the sensor by ~0.5°C.

stfn,
@stfn@fosstodon.org avatar

@steelman So you are saying that when the interval is too small, the sensor itself will heat and skew the results?

yvan,
@yvan@toot.ale.gd avatar

@stfn very nice work - bookmarked for when I finally get around to trying to turn the box of parts I bought a year ago into a Pico W greenhouse monitor/controller! (Good further reference material too.)

stfn,
@stfn@fosstodon.org avatar

@yvan thank you! and good luck with your project, I'd love to hear about it :)

  • All
  • Subscribed
  • Moderated
  • Favorites
  • RaspberryPi
  • Durango
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • osvaldo12
  • khanakhh
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • everett
  • ngwrru68w68
  • kavyap
  • InstantRegret
  • JUstTest
  • GTA5RPClips
  • cubers
  • ethstaker
  • normalnudes
  • tacticalgear
  • cisconetworking
  • tester
  • Leos
  • modclub
  • megavids
  • provamag3
  • anitta
  • lostlight
  • All magazines