The main things you need to do is make sure the GPS is off, and also put the LoRa module in sleep mode.
To ensure the GPS is off set GPS_ENABLE to OUTPUT and LOW.
To put the LoRa module to sleep for 60 seconds you will need to open Serial1 at 57600 and send (with line endings, e.g. using println()) the following command: “sys sleep 60000”. The duration is specified in milliseconds.
@GabrielNotman, I don’t get anywhere near 50 uA when using this sketch. It’s 0.8 mA for me. If I add
USBDevice.detach();
Then the current drops to 0.36 mA, still not close to 50 uA. I disconnected the active GPS antenna, just to be sure, but that does not make any difference in sleep mode.
Any ideas where this remaining power use can be? I’m powering via USB, does that make a difference?
@reneh You probably lose some power in the USB-to-3.3 V regulator. With a 3.7 V LiPo battery, I get a sleep current of about 70 uA with Gabriel’s sketch.
That is also what I am seeing. With the default sketch from Gabriel, no modifications whatsoever I get also something like 170 uAmp. So no where near the 50 uAmp.
Another thing that I see is that the power usage changes a lot. By flashing exactly the same code into the same device and using the same battery and measuring equipment, I see a different power usage every time the device boots. And the difference is rather big. One time it can be a steady 3 mA the next time a steady 300 uA and often I see it fluctuating between 200 uA and 500 uA.
If you are seeing such fluctuations, it is likely some component on the board is not powering down correctly. The 3mA reading suggests that it might be the LoRa chip.
I tested two version of the SodaqONE, tonight a Rev.2 board (BETA) and a Rev.3 board.
Using the above sketch the Rev.3 board read at ~45uAs, and the Rev.2 board at about ~53uAs.
One thing I would suggest is power cycling the board after uploading the test sketch. There are instances when the LoRa chip becomes unresponsive after programming the board. The power cycling the board resets the LoRa chip.
Hello Gabriel, do you also see these values after initializing the LoRa module, waking it up, sending a message and then putting the board into deep sleep? What we see is the following sequence after programming + a power cycle;
board does power up (~ 40 - 50mA)
setup runs, GPS powers down, LoRa powers down, LSM303 powers down, USB disconnects, we sometimes go to ~ 70 uA. But often it stays at 3 mA
In case we’ve seen the 70 uA we send a LoRa msg, then put the device back into deep sleep. In that case we never see anything in the micro amps, always milli amps.
It appears that when the LoRa chip has been used for transmitting anything, it refuses to go back to sleep.
We use code derived from Sodaq One Tracker (main code) and we use Sodaq libraries for the other parts (so we replaced the ublox code with the sodaq gps lib because we only power down the GPS, nothing else.)
The device wakes up every hour to send a status message and then goes back to deep sleep. At least that is what we try to do, the board always stays at 3 mA or higher.
My guess is that in some case it may be trying to send the command to the LoRa module to enter sleep mode to soon after the transmission. This is then resulting in that command being ignored.
Try adding a 10 second delay before trying to send the LoRa module to sleep and see if that fixes the issue.
My bad, the universal tracker runs a watch-dog timer. A 10 second delay is sufficient to trigger the watch-dog timer to reboot the board if you have used the standard method delay(uint32_t ms).
The method sodaq_wdt_safe_delay(uint32_t ms) should be used instead.