Moteino M0 versus standard Moteino R6 current draw

Started by moallen, January 28, 2020, 06:52:41 PM

moallen

My project uses a remote Moteino with a BME280 sensor. I have a pair of Moteino R6's that are working well. Each has a RF95 radio and flash memory onboard. The remote is powered by 4.5 volts with a 3 AA cell battery pack. Using a 2 minute timed sleep with the lowpower library, I can get the current down to 14.3 microamps when it's sleeping. All is good.

Now I'm trying to do the same thing with a pair of Moteino M0's. Each of these also have a RF95 radio and flash memory onboard. They are also working fine or so I thought until I took some current measurements. The remote unit is powered by a 4.5 volt 3 cell AA battery pack and draws 10 milliamps sleeping and 23 milliamps when it wakes up and transmits sensor data. In this case with the M0, I'm using the RTCZero library for the 2 minute timed sleep. I'm also putting the bme280 and radio to sleep like I do with the standard Moteino. But obviously I'm missing something. That's like 700 times more current than the standard Moteino.

Next I loaded Felix's RTCZero periodic sleep example https://lowpowerlab.com/guide/moteino/moteinom0/  in the M0 and took some measurements. I know he says a bare M0 should draw 8.7 microamps, but I don't have a bare M0. My M0 with an onboard RF95 and flash memory draws 1.72 milliamps sleeping and 14.26 milliamps awake. Would that be normal? For this test I used his RTCZero periodic sleep example without any changes. In other words, I'm not putting the radio or flash to sleep, but then again I never enabled them in his example, either. But the real issue for me is in the paragraph above where I'm drawing 10 milliamps sleeping.




moallen

To add to my previous post - I'm fairly certain the M0 itself is going to sleep. The problem seems to be the RF95 radio and/or the BME280 is not going to sleep using the same functions that work OK on the standard Moteino. bme280.setMode(MODE_SLEEP); and rf95.sleep();

I did find gbsmith's 2018 post where he solved this same issue on a RFM69 radio on a M0 by doing a SPI write to the RFM69 Operation Mode register to sleep the radio. So far I haven't figured out how to do that with a RF95 radio.


moallen

#2
I've made some progress reducing the sleep current on my M0 with RF95 radio and BME280. By writing 0x00 directly to the RF95 OP_MODE register 01 to put the RF95 to sleep instead of using the rf95.sleep() function, I was able to get it down from 10 milliamps to 477 microamps. That's about a 20X reduction in sleep current but still way too high.

I have no idea why rf95.sleep() works with a standard Moteino but not with a M0.

Here's my sleep code.

writeRegister(0x01, 0x00); // put rf95 in sleep mode
delay(100); // settle time
LowPower.deepSleep(120000); // put M0 in sleep mode
delay(100); // settle time
writeRegister(0x01, 0x03); // put rf95 in transmit mode
delay(100); //  settle time
bme280.setMode(MODE_SLEEP); // put bme280 in sleep mode



Edit:

I don't know why rf95.sleep() apparently doesn't put the radio to sleep on the M0. It works ok on a standard R6. Eventually I discovered I could write 0x00 directly to the 01 register and truly put the RF95 to sleep. And then wake it up by writing 0x03 (transmit) to the same register.

The other part of the high current draw was the bme280. It also wasn't going to sleep on the M0. bme280.setMode(MODE_SLEEP) worked ok on a R6 but seemed to do nothing on the M0. In this case, I was causing my own problem by doing a bme280.begin() each time I wanted it to wake up so the radio could transmit another batch of sensor data. Turns out all I needed to do to wake it up was, for example, a bme280.readTempC().

When all was said and done, I got the M0 sleep down to 15.9 microamps with the RF95 radio and BME280 sensor.

arf

Did you create this writeRegister function?  I couldn't find any documentation on it?

Jason

Disclaimer: I am not moallen.

It looks like moallen may be using the Arduino Lora library instead of the Radiohead library.

void writeRegister(uint8_t address, uint8_t value);
https://github.com/sandeepmistry/arduino-LoRa
https://github.com/sandeepmistry/arduino-LoRa/blob/01bf044b769a2ab276b59fa8cb24e587b24fc787/src/LoRa.h#L110