Author Topic: RFM69HCW current usage in high power mode  (Read 2957 times)

brolly759

  • Jr. Member
  • **
  • Posts: 64
  • Country: us
RFM69HCW current usage in high power mode
« on: February 28, 2018, 07:58:21 PM »
I am finding that the RFM69HCW is using about 70mA in TX and depending on the data, the TX spike is 3.8 to 6.12 ms long. According to the datasheet the TX current @ +20db is supposed to be 130mA on PA_BOOST.

Here is the code stripped down

Code: [Select]
#include <RFM69.h>         //get it here: https://www.github.com/lowpowerlab/rfm69
#include <RFM69_ATC.h>     //get it here: https://www.github.com/lowpowerlab/rfm69
#include <SPI.h>           //included with Arduino IDE install (www.arduino.cc)

#define NODEID        2    //must be unique for each node on same network (range up to 254, 255 is used for broadcast)
#define NETWORKID     100  //the same on all nodes that talk to each other (range up to 255)
#define GATEWAYID     1

#define FREQUENCY     RF69_915MHZ
#define ENCRYPTKEY    "sampleEncryptKey" //exactly the same 16 characters/bytes on all nodes!
#define IS_RFM69HW_HCW  //uncomment only for RFM69HW/HCW! Leave out if you have RFM69W/CW!

#define SERIAL_BAUD   115200

int TRANSMITPERIOD = 200; //transmit a packet to gateway so often (in ms)
char payload[] = "123 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char buff[20];
byte sendSize=0;
boolean requestACK = false;
RFM69 radio;


void setup() {
  Serial.begin(SERIAL_BAUD);
 
  radio.initialize(FREQUENCY,NODEID,NETWORKID);

  radio.setHighPower(true); //must include this only for RFM69HW/HCW!
  radio.encrypt(ENCRYPTKEY);
  radio.setPowerLevel(31);
}



long lastPeriod = 0;
void loop() {

  //check for any received packets
  if (radio.receiveDone())
  {
    Serial.print('[');Serial.print(radio.SENDERID, DEC);Serial.print("] ");
    for (byte i = 0; i < radio.DATALEN; i++)
      Serial.print((char)radio.DATA[i]);
    Serial.print("   [RX_RSSI:");Serial.print(radio.RSSI);Serial.print("]");

    if (radio.ACKRequested())
    {
      radio.sendACK();
      Serial.print(" - ACK sent");
    }
    Serial.println();
  }

  int currPeriod = millis()/TRANSMITPERIOD;
  if (currPeriod != lastPeriod)
  {
    lastPeriod=currPeriod;

    //send FLASH id
    if(sendSize==0)
    {
    //  sprintf(buff, "FLASH_MEM_ID:0x%X", flash.readDeviceId());
      byte buffLen=strlen(buff);
      if (radio.sendWithRetry(GATEWAYID, buff, buffLen))
        Serial.print(" ok!");
      else Serial.print(" nothing...");
      //sendSize = (sendSize + 1) % 31;
    }
    else
    {
      Serial.print("Sending[");
      Serial.print(sendSize);
      Serial.print("]: ");
      for(byte i = 0; i < sendSize; i++)
        Serial.print((char)payload[i]);

      if (radio.sendWithRetry(GATEWAYID, payload, sendSize))
       Serial.print(" ok!");
      else Serial.print(" nothing...");
    }
    sendSize = (sendSize + 1) % 31;
    Serial.println();
  }
}




LukaQ

  • Sr. Member
  • ****
  • Posts: 301
  • Country: si
Re: RFM69HCW current usage in high power mode
« Reply #1 on: March 01, 2018, 12:29:27 AM »
Is your antenna perfect match for output? ie. 50 ohm? If not, your current will be less. Also check current limit, what you have set in registers

brolly759

  • Jr. Member
  • **
  • Posts: 64
  • Country: us
Re: RFM69HCW current usage in high power mode
« Reply #2 on: March 01, 2018, 01:55:37 AM »
I am using the stock library from Felix and using the below code. As far as the Antenna, I am using an antenna wire from HopeRF cut to the correct length and soldered directly to the antenna pad.

LukaQ

  • Sr. Member
  • ****
  • Posts: 301
  • Country: si
Re: RFM69HCW current usage in high power mode
« Reply #3 on: March 01, 2018, 05:57:32 AM »
cut to the correct length
Which in your case is how much?
I got to ask, because two modules (if I remember right) one next to other WITHOUT antennas had some RSSI, but with pretty ok length antennas, it was always around -30s
« Last Edit: March 01, 2018, 05:59:38 AM by LukaQ »

brolly759

  • Jr. Member
  • **
  • Posts: 64
  • Country: us
Re: RFM69HCW current usage in high power mode
« Reply #4 on: March 01, 2018, 12:36:49 PM »
Excuse my ignorance but how does an antenna dictate how much the overall chip can draw? I am not measuring the current from the antenna, I am measuring the current being sourced into VCC. Regardless, the answer to your question is about 78mm

LukaQ

  • Sr. Member
  • ****
  • Posts: 301
  • Country: si
Re: RFM69HCW current usage in high power mode
« Reply #5 on: March 01, 2018, 12:57:59 PM »
It's all about impedance RFM has on its output. Needs to be 50 ohm, so that antenna can radiate max power (max power also delivered from RFM at that point), everything else means your antenna is mistuned and RFM won't be able to transfer the power onto antenna.

For your antenna, do you have bare wire or insulated?
Your 78mm is close, but probably a bit long. Not that if you have insulated wire, you will need to have it a bit shorter than bare wire.
https://lowpowerlab.com/guide/rf-best-practices/velocity-factor/

try 74mm, or even better, set your module to lower freq., all the way to 890MHz. (I assume your antenna wire in insulated, and you have 78mm, which would be right for bare wire @ 915M, but also right for insulated wire @ 868M)


brolly759

  • Jr. Member
  • **
  • Posts: 64
  • Country: us
Re: RFM69HCW current usage in high power mode
« Reply #6 on: March 01, 2018, 01:20:16 PM »
4mm difference would account for about a 60mA drop in current draw?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6499
  • Country: us
    • LowPowerLab
Re: RFM69HCW current usage in high power mode
« Reply #7 on: March 01, 2018, 02:18:21 PM »
4mm difference would account for about a 60mA drop in current draw?

No, any reflected power is actually wasted as heat and can burn your RF amp stages or do other damage in the transceiver. That's why impedance matching is important, you want the transceiver's output to be radiated in the air rather than reflected back into the circuit and producing heat in there.

If we could save power by trimming the antenna, we would not have half the discusssions in this forum  ;)

brolly759

  • Jr. Member
  • **
  • Posts: 64
  • Country: us
Re: RFM69HCW current usage in high power mode
« Reply #8 on: March 01, 2018, 03:06:05 PM »
Felix, I still dont see the answer explained to my initial issue. If the RFM69HCW can supposedly draw over 100+mA in TX, why when I "think" I set everything up to +20db output I am only seeing about 60mA current in TX drawn from VCC ?

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: RFM69HCW current usage in high power mode
« Reply #9 on: March 01, 2018, 03:30:47 PM »
Felix: This is your setPowerLevel routine. There's a division by 2 in the _powerLevel.
Code: [Select]
void RFM69::setPowerLevel(uint8_t powerLevel)
{
  _powerLevel = (powerLevel > 31 ? 31 : powerLevel);
  if (_isRFM69HW) _powerLevel /= 2;
  writeReg(REG_PALEVEL, (readReg(REG_PALEVEL) & 0xE0) | _powerLevel);
}

Now, this would be using the 'forbidden' values because apparently only 16-31 should be used. This is where it gets interesting, 0-15 do produce output according to this article:
https://andrehessling.de/2015/02/07/figuring-out-the-power-level-settings-of-hoperfs-rfm69-hwhcw-modules/

If you look carefully at that the current consumption for PA1+PA2[HP] with a power level setting of 15 it takes about 80mA (roughly what the OP is seeing), but the current consumption with a power level setting of 31 takes 110mA. So instead of dividing by 2 I think you need to make the range you write to power level register 16-31 from 0-31, not convert it to 0-15.

@brolly759: Could you try an experiment, comment out the divide by 2 in the setPowerLevel routine?

Mark.
« Last Edit: March 01, 2018, 03:44:39 PM by perky »

brolly759

  • Jr. Member
  • **
  • Posts: 64
  • Country: us
Re: RFM69HCW current usage in high power mode
« Reply #10 on: March 01, 2018, 04:46:02 PM »
I commented out
if (_isRFM69HW) _powerLevel /= 2;

Shows same thing, right now I am hitting 79.2mA

brolly759

  • Jr. Member
  • **
  • Posts: 64
  • Country: us
Re: RFM69HCW current usage in high power mode
« Reply #11 on: March 01, 2018, 05:22:52 PM »
I have been trying a lot of combinations out. So this is what I found. If I call radio.setPowerLevel(31); at the beginning during setup, my TX packets are using 75mA. If I call radio.setPowerLevel(31); before every send command, my TX packets are using 85.6mA. That leads me to believe I may be close to +17dB transmit. The question still remains on how to get to +20dB

ChemE

  • Sr. Member
  • ****
  • Posts: 419
  • Country: us
Re: RFM69HCW current usage in high power mode
« Reply #12 on: March 01, 2018, 06:58:43 PM »
You could call readAllRegsCompact() just prior to Tx and look up using the datasheet what the relevant registers are set at.

LukaQ

  • Sr. Member
  • ****
  • Posts: 301
  • Country: si
Re: RFM69HCW current usage in high power mode
« Reply #13 on: March 01, 2018, 11:34:35 PM »
I commented out
if (_isRFM69HW) _powerLevel /= 2;

Shows same thing, right now I am hitting 79.2mA
HW does not have 32 states of power, only half, that is why you have /=2
And I don't know why you want to hit max current draw. You should be measuring RF power of output, do that. Because you really don't care about current. Current does not equal transmitted power

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6499
  • Country: us
    • LowPowerLab
Re: RFM69HCW current usage in high power mode
« Reply #14 on: March 02, 2018, 08:14:26 AM »
@brolly759,
How exactly do you measure current? Via what device or what method? Any burden voltage can affect the reading.

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: RFM69HCW current usage in high power mode
« Reply #15 on: March 02, 2018, 09:04:11 AM »
HW does not have 32 states of power, only half, that is why you have /=2
The sx1231h datasheet actually states it's the upper values 16-31 of PAlevel that are used, technically the lower values 0-15 are undefined. Dividing by 2 forces the values to 0-15. Those values seem to work to a degree, but close examination of the current consumption in the link I gave above seems to show 80mA at a value of 15 and 110mA at a value of 31 (for PA1+PA2+HP), so I'm not convinced using 0-15 is the same as 16-31. Interestingly Radiohead uses 16-31.

Mark.

TomWS

  • Hero Member
  • *****
  • Posts: 1929
Re: RFM69HCW current usage in high power mode
« Reply #16 on: March 02, 2018, 10:07:59 AM »
The sx1231h datasheet actually states it's the upper values 16-31 of PAlevel that are used, technically the lower values 0-15 are undefined. Dividing by 2 forces the values to 0-15. Those values seem to work to a degree, but close examination of the current consumption in the link I gave above seems to show 80mA at a value of 15 and 110mA at a value of 31 (for PA1+PA2+HP), so I'm not convinced using 0-15 is the same as 16-31. Interestingly Radiohead uses 16-31.

Mark.
Good point.  I found that there is also a difference in output when a single PA is used, ie PA1 != PA2.  Unfortunately I don't remember which one to use if you're using a single (PA2, I think), I'd have to look at my old ATC code to confirm.

Tom

ChemE

  • Sr. Member
  • ****
  • Posts: 419
  • Country: us
Re: RFM69HCW current usage in high power mode
« Reply #17 on: March 02, 2018, 10:22:19 AM »
This is one of the better write ups I've found over the years on the subject: http://www.electrobob.com/rfm69-output-power/

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: RFM69HCW current usage in high power mode
« Reply #18 on: March 02, 2018, 10:57:06 AM »
This is one of the better write ups I've found over the years on the subject: http://www.electrobob.com/rfm69-output-power/
This firmware 'fix' is in the Radiohead library now.

brolly759

  • Jr. Member
  • **
  • Posts: 64
  • Country: us
Re: RFM69HCW current usage in high power mode
« Reply #19 on: March 02, 2018, 04:25:30 PM »