StuartsProjects / SX12XX-LoRa

Library for SX12XX LoRa devices
315 stars 68 forks source link

Inconsistent power usage #56

Closed BioScout-Tom closed 1 year ago

BioScout-Tom commented 2 years ago

Hello,

Firstly, thanks for the fantastic library Stuart. It has truly made LoRa implementation (particularly as one of the few references for 2.4GHz) more accessible to the community!

I am implementing a LoRa sensor node, and experiencing a bizarre behaviour with regards to transmit current consumption. The behaviour I am seeing is:

From my testing, this spike occurs during the transmit() function itself. I am using a version of the ESP32 example modified for my pin configuration, code as attached.

103_LoRa_Transmitter_Detailed_Setup_ESP32.zip

I'm just wondering if anyone has had any experience with this behaviour? Is the higher current peak 'correct' or is the lower peak 'correct'? Based on my reading, it doesn't seem as if the SX1280 should be able to draw 300mA no matter how hard it tries, so it's likely an interaction with the ESP32.

StuartsProjects commented 2 years ago

There have been no issues reported, caused by the library, when power consumption in transmit is so high.

If you lengthen the packet sent to a couple of seconds, you will be able to measure the current consumption with a multimeter.

You included two copies of the program you are using in the ZIP file, and the newer one (29\10\22) does not appear to be for an ESP32 as some of the pins used as outputs are input only.

BioScout-Tom commented 1 year ago

Sorry about the files, the most recent one is the one I am working with and it is for an esp32s2-mini-1 (no PSRAM). I understand that isn't officially supported but I am keen to work it out. I will dig further into all of my signals with a scope and see if there is any funny business going on.

To your knowledge is there anything in the library that may flip-flop in this way?

I have just repeated testing on an MKR NB 1500 and a LAMBDA80 Sx1280 module, and found that it doesn't display the same issue:

image
StuartsProjects commented 1 year ago

Thats not behaviour I have seen before. I cannot see how you could configure the SX1280 to suddenly use 5 or 6 times the amount of current it would normally use at the maximum confugurable power output of 12.5dBm.

Which SX1280 module are you using on the ESP32 S2 ?

What are the RSSI readings for a receiver picking up the low current and high current packets ?

"I have just repeated testing on an MKR NB 1500 and a LAMBDA80 Sx1280 module, and found that it doesn't display the same issue:"

Which library were you using ?

BioScout-Tom commented 1 year ago

For the MKR NB 1500 testing, I was using the non-esp32 equivalent example program from your library, with only pin allocation changed.

MKRNB1500_103_LoRa_Transmitter_Detailed_Setup.zip

Qualitatively, I think the RSSI readings are higher for the larger current spikes, and the lower current messages are prone to reporting an error on Rx side, (and unsuccessful ACK on Tx side when using reliable comms functions).

The ESP32-S2 is on a custom PCB with my own implementation of the SX1280 reference design, I used the same schematic as that used in the ExpressLRS project:

image

As you say, that much current has to be going somewhere. I modified my code to send 500mS packets as quickly as possible, and indeed the SX1280 chip itself starts heating, giving a terrifying square-wave from 100-300mA. At this point I for some reason I ripped out the filter from the RF output of the SX1280 with snips, and connected the antenna directly to the output of the chip. This resolved the power draw issue.

Here is the component seemingly at fault: tdk dea102450

Happy its resolved, but very confused. I will test across some further hardware to see if that component is simply not correct, as I have some Semtech-endorsed 2450FM07D0034T, that I can replace it with. If the behaviour persists with that component, then there might actually be a really interesting bug going on. Otherwise, happy to call it a hardware error.

Thanks for your time Stuart. As some small return insight, happy to let you know that I've now used the library across ESP8266, ESP8285, ESP32-E, ESP32S2, NRF52840, as well as been successfully able to port the library to the Particle IDE and use it with a Particle Boron.

StuartsProjects commented 1 year ago

No issue found with library.