Original LoPy and DeepSleep shield machine.sleep current consumption
-
Dear All,
I searched the forum for previous discussions, but I think I am wanting to use a Lopy 1 with a DeepSleep shield and expansion board in a way that it is not normally used.
I want to build a monitor for my rather long driveway to detect vehicles and report to the house (using LoRa) when they are approaching. This will be battery powered.
Right now, I am thinking I want to wake up the LoPy rather often (2-5 times per second) to read the magnetometer (through I2C), decide whether the sensor has detected a vehicle, and report (via LoRa) if it has.
From what I have read about DeepSleep, I don't think I can use it because of the time needed to boot the LoPy will not allow me to wake up 5 times per second.
I have looked at machine.sleep (https://docs.pycom.io/firmwareapi/pycom/machine/), but I have not seen any data on current consumption when using this. Has anyone measured this?Is machine.sleep what I should be looking at using, or is there another way to minimize current consumption when waking up multiple times per second?
Thanks,
Duane
-
Perhaps you could use another type of magnetometer with a digital interrupt (or use an analog output and comparator circuit) that you could use to trigger a wakeup on the Lopy's deepsleep shield. My experience with the thing is limited, but according to this page: https://docs.pycom.io/datasheets/expansionboards/deepsleep/ you should be able to use P17 and P18 to trigger a wakeup. Once the wakup is triggered, all you need to do is send a lora packet and go back to sleep.
-
@Duane-Kaufman you definitely won’t be able to deep sleep and wake up that often, and any other sleep modes will substantially increase power consumption.
So unless you have a permanent power source or are prepared to change batteries extremely often, you need another way, using a sensor which draws very little power and can trigger a wake up of the LoPy when an event arises.
This could be an entirely passive sensor (think something which has an open contact most of the time, and the contact is closed when a vehicle approaches), or a sensor with a very low power mode which can by itself monitor at regular intervals and trigger an interrupt when some condition is met.
Look at vehicle counting systems for hints of the types of sensors you could use. This article lists quite a few. I believe the most common for temporary installations (I.e. not needing digging into the ground) are the pneumatic tubes, not sure what kind of sensor would be needed at the end of one if those, possibly a very simple spring-loaded button of some sort.
-
@Duane-Kaufman
Currently i suppose only way is to usesleep
andidle
.
Look also at this: https://forum.pycom.io/topic/7026/ulp-testing-pycom-firmware-with-ulp-support