So I have a Photon 2 which is once a minute measuring air quality related data and publishing it to the Particle cloud. The sensor is a Grove SENS5 all-in-one environmental sensor using I2C, the Photon 2 is attached to a Grove Shield FeatherWing.
The program is also writing data to the serial terminal, as well as to an OLED-display, but the display is physically disconnected, and as I'm normally powering the device with a power bank, a serial terminal is not in use
As I'm using a power bank, I'd like to put the device to sleep, but it seems it's not working as a USB charger doctor measures 120-130 mA all the time. It is also blinking the normal slow-breath cyan. I've put below in the setup()-function, interval2 is 60000.
I suppose I'm misunderstanding something with how the sleep is working, so would need some guidance.
I'll probably later increase the interval from 1 to 2 or more minutes.
.network(NETWORK_INTERFACE_CELLULAR) is not a valid option for the Photon 2, a Wi-Fi device. The sleep is probably not occurring because of invalid options. Try it with that removed.
Thx!
It helped in that the device right away goes to sleep for a minute, then wakes up, but then never sleeps again.
I did not beforehand consider that the sensor also might (?) lose power during the sleep, which might reset at the VocIndex to its starting point of 100. So I might skip the sleep in this project, but would of course be nice to know how to get a continuous sleep
Where is your sleep call? When you use STOP mode sleep, execution continues after wake at the line after System.sleep. Anything that's in setup won't be run again on wake.
It was in setup, but when I moved to loop, it started to work...
But, how to flash new firmware to it when it's just awake for a few seconds?
I was finally able to do a local flash, and the program runs, but the device don't have cloud connection anymore, it's fast blinking blue.
I did restore it this way, but still no cloud connection.
I'll now try to reestablish cloud connection somehow.
Edit: Ok, reconfigured the WiFi, not sure what happened, but now it works again. I'll refrain from using sleep until I understand it better, anyhow in this case I'll probably won't be able to use it due to the sensor characteristics.