Greets, All. I think I already know the answer, but will ask anyway. Is there any state into which the Photon can be placed which (a) allows the processor to continue executing User code and (b) reduces the current draw to something below about 40 mA? My incredibly simple code below results in the Photon drawing about 2 mA while sleeping, and about 40 mA while running. Since I’m trying to get a few days operation on a 3300 mAh lipo and need to fire up the WiFi about once per minute, 40 mA is just not going to cut it.
Any information would be most gratefully received.
Thanks,
'genio
Forgot to attach the code the first time round…
int led1 = D7;
void setup()
{
pinMode(led1, OUTPUT);
RGB.brightness(0);
}
void loop()
{
for (uint i = 0; i < 150; i++)
{
WiFi.off();
digitalWrite(led1, HIGH);
delay(50);
digitalWrite(led1, LOW);
delay(150);
}
System.sleep(D1,RISING,30);
}
I was also looking to sleep for less than a second to save some power.
(Sleeping for less than a second )
There is no official support in particle.
So I came up with this
void msSleep(unsigned long ms) {
unsigned long start = millis();
while(millis() - start < ms) {
__WFI();
}
}
which save some milli amps, but I do not know if it has some side effects for the rest of the system.
RobP
November 11, 2017, 11:00am
4
Hi @eugenio , you might give this a try:
Not sure if this will help anyone else, but I have found a way to reduce the runtime power consumption of the Photon. These things could be done by modifying the bootloader, but as I am currently unable to reflash the bootloader, I wanted to find a way to reduce power consumption without touching the bootloader.
Note: This is highly experimental, and it messes with the internal clocks, and there are various flow on effects. However I have always been able to recover to DFU mode even when things…
Hello RobP,
My apologies for not responding MUCH sooner. The Holidaze and all, don’t you know, have me pretty seriously “off my feed.”
In any case, much obliged for your rather thorough and well thought-out response. While I think your code may be out of my league (me being a rank noob, here), I do appreciate the time you’ve taken to respond. Based on the fact that I received only 2 responses, I’m thinking that either (a) no one knows how to get current draw down to about 1 mA, (b) it simply isn’t possible with existing Photon hardware and/or © not that many of us have such a stringent current budget. In any case, I think my best bet right now is to go looking for different hardware. Sorry, Photon!
Cheers,
Eugenio