Low power mode with Tinker firmware on Photon?

Greetings. My son is doing a science project at school involving lighting up a Lego house with solar powered LEDs. I thought I’d get him hooked on electronics and programming, so I suggested that we use a Photon + PowerShield with two 2W solar panels and a 3.7V/2000mAh LiPo battery hooked up to a LiPo charger
from Adafruit. The idea being that the panels would provide sufficient energy to charge the battery and power the Photon. We haven’t tried it running for any prolonged time yet, so we’re not sure how long this setup can run on the battery. The board is currently flashed with the Tinker firmware so that my son can control the LEDs easily through his tablet. I’m wondering if there’s any way of putting the photon in a low power mode with the Tinker firmware. I assume it would lose the WiFi connection after going to sleep. I’m also not sure how to wake it up after it goes into low power mode. Are there any documents describing the various modes with some code examples? Would it be possible to have it wake up periodically and check some state somewhere? I can imagine using an IFTTT Button to change the state of the LEDs and the Photon would react on the next wake up cycle. Any ideas on how to make this experiment more energy efficient are highly appreciated. Thanks!

@Bluzcat, you are a cool dad! The System.sleep() modes are discussed here:

https://docs.particle.io/reference/firmware/photon/#sleep-sleep-

You can put the Photon in regular sleep mode where only the WiFi module is powered down or a deep sleep where the Photon goes to a very low power mode. With both, you can specify a time to sleep for so that it automatically wakes. Each wake mode has different advantages depending on your application.

The catch with waking and checking is that the Particle Cloud is not persistent in that it does not store any data to check on. You could run a nodejs program on a server or PC to act as the “somewhere” and use the Particle.publish() and Particle.subscribe() functionality to make events works for you. :smile:

2 Likes

Also, you can have the Photon sleep until a button is pressed. Of course you’ll need to add a button, and a little code for that. By the way, the Tinker firmware source code is online. It’s maybe a page long. You can use that as a base for your code, which will still allow the Tinker mobile app to control it, even though you’re using your own custom program with sleep support.

2 Likes

If you want to keep using Tinker app, you just need to keep the Particle.function() setup the same and e.g. dedicate a particular pin’s digitalWrite call to switch the Photon into somethink like System.sleep(SLEEP_MODE_DEEP, 60) (max. power save, and wake every 60 sec) - or System.sleep(pin, FALLING, 600) to have it either wake at a button press or every 10 minutes.

2 Likes

Thanks guys! Much appreciated. I’ll definitely explore the options suggested.