Prevent Photon from activating LED when Waking from Hibernate Sleep

Hi folks,

Short version: How can I totally disable the Photon’s LED when it’s waking up from Hibernate Sleep? RGB.control(true); RGB.brightness(0); only kicks in moments after it has woken up so there’s an unwanted momentary White flash whenever it wakes that wastes power.

Context:
-Running my Photon off 4x NiMh AA battery as an ultra low power project.
-Implemented the Hibernate sleep mode and wake by WKP rising signal.
-Photon will sleep and wake up whenever there is a rising signal on WKP, increment some values, do some quick time checks and go back to Hibernate sleep.
-A rising WKP signal happens once every few seconds.
-To keep it running at lowest possible power, I have attempted to disable the LEDs from consuming power by adding RGB.control(true); RGB.brightness(0); in setup.
-Used SYSTEM_THREAD(ENABLED); and SYSTEM_MODE(SEMI_AUTOMATIC);

My Issue:
-Whenever there’s a rising signal on WKP, the Photon wakes up, BUT the built-in LED gives off a bright white light for a split second before the LED is disabled by the RGB.control(true); RGB.brightness(0); in setup.
-The Photon consumes ~300+ microAmps with the brief White LED light during each wake and it drops to ~75 microAmps when the LED light is disabled by RGB.control.

Would like to totally disable the LED from lighting up whenever it wakes. (Short of physically removing the LED). Would I need to do some custom firmware modification for this?

Thanks in advance!

Hi @yihaot -

Welcome to the forum :slight_smile:

Quite an interesting project by the sound of it. I have worked on some power-sensitive projects before but have not yet encountered the need to completely shut down the ob LED, especially due to the fact that it can provide some vital system check feedback.

I am not 100% sure whether the 300mA you are measuring can be attributed purely to the brief white flash. My suspicion is that it might rather be a combination of the Photon consuming more power while coming out of hibernation as apposed to when it is in idle?? I had a brief look at some LED data sheets, seems LED blinking white should not (by itself) have that big impact. Then again, I might be wrong, lol.

Have you maybe measure the consumption of the Photon (while in idle) with the white LED on and without? You should be able to achieve this with very simple sketch taking control of LED, turning it on / off and measuring consumption in each state. This should give you a clear indication of the effect the LED has on consumption of the Photon?

I would refrain form removing the LED… it comes in handy when troubleshooting :wink:

Hope this helps, best of luck! Friedl.

@friedl_1977, I believe @yihaot indicate 300 microAmps not milliAmps. Nonetheless, you are correct that the 300uA consumed is due to the work required to wake up the Photon.

@yihaot, have you tried putting the RGB code in a simple function that you specify in a STARTUP() macro?

1 Like

@peekay123

oops sorry… and this just after another 6 months of unit conversion in Chem 2. My lecturer will be extremely disappointed :flushed:

Regards,.
Friedl.

1 Like

Thanks for the welcome!

Summary of project: Deployed a Photon at the power meter outside my apartment to have a sense of my household power consumption. Power meter gives off a red LED pulse for each 1/1000kWh, which I’m using LDR in a potential divider as the WKP signal. No power source that I can tap on at the power meter so it has to be battery powered.

Will try measuring the consumption using your setup later to gauge how much amps does the LED actually consume.

1 Like

Tried adding:
STARTUP(RGB.control(true));
STARTUP(RGB.brightness(0));

At the top of the code but no joy, the white LED still lights up momentarily upon waking from each Hibernate Sleep.

The three sub LEDs of the on-board LED are driven at 3.3V and a 1k current limiting resistor each.

According to the docs about STARTUP()

Hi -

I deployed some devices in remote areas a while ago. Power consumption was an important criteria as we used a very small solar panel (1W) to power/recharge the LiPo Battery.

Honestly, I could not see any noticeable/significant difference in performance/consumption with- or without the on board LED active.

Best of luck. You are in good hands with @ScruffR and @peekay123 in this discussion :wink:

Regards, Friedl.

2 Likes

I redid my STARTUP() code but still no joy, white LED still lights up momentarily upon wake from Hibernate Sleep.

Code block before setup():

STARTUP(startupFunctions());

void startupFunctions() {   
    RGB.control(true);
    RGB.brightness(0);
    System.enableFeature(FEATURE_RETAINED_MEMORY);
}

SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(SEMI_AUTOMATIC);

SystemSleepConfiguration config;

//bunch of retained memory variables and other variables

That would mean that in theory, the 3x LEDs will consume 9.9mA for white light.

I’ve did a quick slow-mo filming of the Photon and it seems the white light is active for 8/240th of a second, 0.0333s (240FPS slow mo) every time it wakes.

The numbers seems insignificant at first, but I did some quick math…
Considering that 9.9mA for the white LED is 132x the Hibernating Sleep current of 75microAmps, this means it’s taking away 4.4 seconds worth of Hibernate sleep time power for every LED activation during wake.
I estimate that the Photon will have to sleep/wake ~380,000 times each month (my average monthly electricity consumption is 380kWh and the power meter will give off 380k light pulses to WKP monthly). The energy savings from the LED could in theory give an extra 19.3days worth of power to do Hibernation Sleep per month. :joy:

Unfortunately, the power meter is situated deep indoors and it is not feasible to deploy any solar panel to keep the batteries charged up, hence the need to be very frugal with the power consumption.

The dream scenario will be to keep this running for a year just off 4x 2000mAh AA NiMh batteries :smiley:

Extra background: Currently it’s doing a Wifi Data upload once every hour by checking RTC, and also syncing RTC once a day. Will experiment extending these intervals if needed to prolong battery life too. Wifi is off until it needs to do these and then it’ll be switched back off.

Although I don’t quite follow the 19.3 day gain of potential sleep time per month and also don’t see the calculation of the power consumption while awake, you can always remove the LED entirely.

BTW, one cycle of problematic WiFi reconnect will potentially cost you more than hundreds of LED cycles. Consequently I’d consider this question rather academic :sunglasses:

With 380kWh per month you could also consider inductive power harvesting :wink:

1 Like

HI @yihaot -

We actually just finished an entire subject on electrochemistry at ASU. If I am recalling correctly, you should be far better off using LiPo as apposed to NiMh??

The advantages of lithium batteries compared to NiMH batteries are undeniable.
The weight/power ratio in LiPo batteries is significantly better. LiPo batteries are noticeably lighter and they can store the same amount or more energy relative to their capacity than NiMH batteries. The power output of LiPo batteries is greater in quality and quantity. The power output of LiPo batteries is steady throughout the discharge, whereas the power output of NiMH batteries starts to decrease soon after charging because of higher discharge rate of the battery type.

Therefore with a LiPo battery with the same capacity as a NiMH battery a longer drive time and better performance can be achieved.

Maybe this can make up for the "hibernation days lost" by simply using i.e couple of Lipo batteries as apposed to NiMH??

I agree. Feels like a very theoretical example problem I have faced during the electrochem course :slight_smile: IMHO... I don't think it will play out this way in practise. I think there might be alternative areas to focus on if you want to save these sort of power consumption levels i.e. as @ScruffR pointed out correctly. Making sure your WiFi does not drop every now and then, will have greater effect on power consumption :wink: Optimising code to avoid restarts is one and shortening program run times might be another.

Coming to think of it, maybe see if you can implement wireless charging if need be :nerd_face:

At least... these are my experiences. I might be wrong.

Best of luck!!

If you want really low power consumption MCU off a battery then best not to use the Photon IMHO - an Argon or a Xenon (if you can get one - I know sadly deprecated) and use BLE comms to the Argon or base. Then you would have a LiPo PMIC and the Device OS (especially 2.0) optimised for low power project.

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.