Electron detecting USB power while sleeping

Hi all,

I’m working on building a car tracker with one of my electrons and would like to identify when the cars ignition is turned on. I’m going to use a 12v feed from the car thats only live when the ignition is on and an inline 12v -> USB adaptor, and I can check the status of USB power via pmic. This all works while the electron isn’t awake. My question is, is there a way to do the same thing while the electron is sleeping? Ideally I would like it to send a message as soon as the ignition is turned on / usb power is present but I need to put it to sleep (not deep sleep) when the ignition is off as the car does not get used regularly and I want to save battery.

Would appreciate any ideas.

Thanks,
John

How about using the USB power as a wake trigger?
e.g.

  System.sleep(WKP, RISING, sleeptime);

and why is deep sleep out of question?

2 Likes

Thanks @ScruffR, I didn’t realise you could use USB power as a trigger, I should have been paying more attention when looking at the docs …

Deep sleep wasn’t out of the question, I had just assumed that I may be a little more limited on functionality while in deep sleep. I also want to keep data use to a minimum and reading the docs / comments it seems deep sleep shuts the radio down too? So you re-connect / handshake with the cloud when waking up again (unless I set system mode to manual and connect when I ‘really’ want to I guess).

Thanks

The recent pre-release system 0.6.0-rc.1 should cut the data usage on deep sleep, but I haven’t checked that out myself yet.

You can wire the VUSB pin (unpopulated solder eye) to any pin that’s a valid wake pin (but you should use a CHANGE trigger or use a voltage divider to get down to 3.3V - due to the pull-resistors getting auto-attached when going to sleep)

1 Like