LoRa SX1276 draws power from SPI connections

Thread Starter

Electrodood

Joined Aug 31, 2023
7
I am using a LoRa SX1276 in a low-power project, powered by an 18650. When I use a P-channel MOSFET to cut the VCC of the SX1276, it draws power from the SPI pins. I am using an Arduino Nano and plan on using an Arduino Pro mini in the final device, the Nano normally draws 2.7mA in sleep, and when the LoRa is connected it draws 4.4mA which is expected as LoRa draws 1.8mA in sleep (1.7mA in my case), the problem is when I remove the VCC, manually and using a MOSFET, I do not see any change in the current drawn still 4.4mA. I measured the SPI pins and they draw power from the Nano, I tried using SPI.end(); but nothing changed. How can make this more efficient? Thanks in advance for any replies :)
 

Thread Starter

Electrodood

Joined Aug 31, 2023
7
Thank you for your replies. I pulled the clock and data pins (MISO, MOSI and SCK) low via software but there is no change.
And from Ya'akov's reply (Thanks!) i think I am putting the module to sleep wrongly. I am using the LoRa library by Sandeep Mistry and here is the loop function,


loop function:
void loop() {
  digitalWrite(mosfet, LOW);
  delay(2000);
  SPI.begin();
  LoRa.begin(868E6);
  sonic();
  shipData();
  LED = !LED;
  LoRa.end();
  SPI.end();
  digitalWrite(13, LOW);
  digitalWrite(12, LOW);
  digitalWrite(11, LOW);
//  digitalWrite(mosfet, HIGH);
//for (int i = 0; i <= 3; i++) {
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
  //}
}
sonic() can be ignored, it is not is use. Forgive me for the unorganised code
 

cmartinez

Joined Jan 17, 2007
8,124
If nothing else solves your problem, you might find it helpful to know that your module's quirks are not unique. I've had exactly the same problem with the MCP2221A, and the only way I could find to solve it was to use a buffer at its input and output. Now, depending on your application, you could use either a push-pull or an open drain output buffer. Both have advantages. And since my application is also power-critical, I'm using the same pFet to switch on and off both the MCP2221A and the buffers. So the extra power being drawn in total is negligible.

Have a look at this thread.

EDIT: I also had to add a 1k pull down between the MCP2221A Vcc and ground to make sure that it completely shut off as fast as possible when power was removed. This because said chip has a very large internal capacitance that would otherwise take a long time to discharge after being powered off.
 
Last edited:

Thread Starter

Electrodood

Joined Aug 31, 2023
7
If nothing else solves your problem, you might find it helpful to know that your module's quirks are not unique. I've had exactly the same problem with the MCP2221A, and the only way I could find to solve it was to use a buffer at its input and output. Now, depending on your application, you could use either a push-pull or an open drain output buffer. Both have advantages. And since my application is also power-critical, I'm using the same pFet to switch on and off both the MCP2221A and the buffers. So the extra power being drawn in total is negligible.

Have a look at this thread.

EDIT: I also had to add a 1k pull down between the MCP2221A Vcc and ground to make sure that it completely shut off as fast as possible when power was removed. This is because said chip has a very large internal capacitance that would otherwise take a long time to discharge after being powered off.
1695137081588.png
This is my circuit, it is a sensor node that wakes up every 10 minutes or so to transfer data and go to sleep again. Now this might sound stupid but why can't I use a pFet in series with the data pins? And if I need to go with a buffer does the CD4041 suffice.
 

Ya’akov

Joined Jan 27, 2019
8,567
According to the API documentation, the function you want is LoRa.sleep().
Reading the source, LoRa.sleep() writes to a particular register. The register and contents to be written are defined as constants in the code. I would:

  1. Get the datasheet for the LoRa part and make sure the register and contents are correct
  2. if not, try changing to what the datasheet says
  3. if so, try writing to that register yourself, and devise tests to check if it is, in fact sleeping and to see if it affects current consumption

I would do this completely outside the library. Remember, the manufacturer’s specs say the consumption in sleep mode is on the order of ㎂! All of the other stuff you are doing should be left for a desperate workaround, not for a proper design.
 

Thread Starter

Electrodood

Joined Aug 31, 2023
7
Reading the source, LoRa.sleep() writes to a particular register. The register and contents to be written are defined as constants in the code. I would:

  1. Get the datasheet for the LoRa part and make sure the register and contents are correct
  2. if not, try changing to what the datasheet says
  3. if so, try writing to that register yourself, and devise tests to check if it is, in fact sleeping and to see if it affects current consumption

I would do this completely outside the library. Remember, the manufacturer’s specs say the consumption in sleep mode is on the order of ㎂! All of the other stuff you are doing should be left for a desperate workaround, not for a proper design.
Thanks a ton, I'll try it :⁠-⁠)
 
Top