Dumb and vauge question(s) regarding Sysetm.sleep and Electrons

Trying to understand a few ways to manipulate or use System.sleep. The way I understand…

System.sleep(SLEEP_MODE_DEEP, 15 * 60);

This basically shuts off the Cellular and most of the Pins on the Electron? I might be paraphrasing a bit. :no_mouth:

My Electron project is a free standing attendance Kiosk using an RFID scanner. So most likely would be running off battery power with solar recharging. And it would really only need to be awake from 730am to 5pm week days with some downtime in between.

Question 0: Thought of this after writing all the stuff below but it’s actually what my ultimate goal would be. Since the Kiosk doesn’t need to run on weekends, holidays, etc. and the schedules could vary by company. Kinda like Question 3, we can add wake/sleep schedules to our back-end system that could send wake and sleep commands to the Electrons. Or maybe this sent as a payload and stored on the Electron’s EEPROM? And each time its updated by the company admin a new payload is sent out? [OK, if this is the answer I am a frickn’ genius - if only I could find my pants…]

Question 1: I know this is dumb, but it possible to make the 15 minutes a variable. So if I sent a function like sleep, 45 or sleep, 1380 it would sleep for either 45 minutes, or 23 hours?

Question 2: Using

System.sleep(uint16_t wakeUpPin, uint16_t edgeTriggerMode);

Would it be possible to use a Photoresistor, or even an RFID Shield to wake up the Electron? I assume the RFID wouldn’t really work since it’d need power to run anyway. But thought I’d ask.

Also could I combine the two, or does it have to be one way or the other? What I mean is can I use the previous function and put the Electron in sleep mode for 23 hours, and but if something triggered it, it would wake up?

And finally,

Dumb Question 3: Is it possible to tell the Electron to wake (or even sleep) using a function(?) or a ATA command?

If you read through all this nonsense thank you very much. I really appreciate your help!


Answer 0:

Sure you can download holidays and events. Have your server respond to a webhook with a JSON object with the days, types, etc.

Answer 1:

yes, try it

Answer 2:

Yes, there are light sensors that will generate an interrupt… google “digital light sensor”

Answer 3:

Is it possible to tell the Electron to wake (or even sleep) using a function(?) or a ATA command?

hmmmm… wha do you mean? if the Photon is sleeping, a call to Particle.function() won’t respond…

1 Like

Oops, I meant AT Commands. I saw this post and it got me thinking their might be a way to do this. I realize it’s not supported at this time.