Third attempt for setPower support, it's user-friendly. 'User' optionally writes lora.setPower(17); to set +17dBm, or lora.setPower(-80) for -80dBm. If user does not use lora.setPower(), default is +17dBm (like adafruit original TinyLoRa). But I discovered some weird stuff.
The documentation I think is wrong, or I didn't understood something! I would like someone to verify my remarks. p. 79 and p. 89 documentation states:
i. Pmax = 10.8 * 0.6 * MaxPower [dBm] (this seems ok)
ii. Pout = Pmax - (15 - OutputPower) [dBm] instead of
iii. Pout = Pmax - (15 + OutputPower) [dBm] It's not logical with increased power to have less dBm's!
Datasheet / Documentation: https://www.hoperf.com/data/upload/portal/20190801/RFM95W-V2.0.pdf
So I use the last (iii) formula for the calculations, not the documentation's (ii).
Even more bizzare. The documentation says the range is -4 to +17dBm (+20 special case), but in my test is -80 to +17 (+20 untested). Huge gap between 0 and -80dBm. I didn't test +20.
We have three options with HOPE RFM9x.
a. without PA_BOOST (-4 to +15dBm) - in my tests: approx. -75 to -84.
b. with PA_BOOST (0 to +17dBm) - in my tests: -0,20 to -14,50 (see first test)
c. with PA_BOOST and HI_POWER (aka: +20dBm) - untested. It requires antenna with at least 3:1 VWSR (I have DIY antenna with cable 1/4 monopole as stated in adafruit tutorial). I don't want to risk damage.
Conclusions
It works.
Greeater range than documented. Instead of -4 to +20, -84 to +20.
and finally
Does not break old .ino's like my first attempt.
I can submit an ino file that cycles lora.setPower.
a. to have access to all combinations (some are overlapping).
b. Granularity of 1dBm is fine.
How setPower works:
The chip has 4 (four) possible 'values' in two registers. PA_BOOST, MAX_POWER, OUTPUT_POWER (one register), HIGH_POWER_SETTINGS (second register). With the c programm, I tried to deciph what I needed.
So I splitted the options in three categories / ranges.
-4 to 0dBm is abandoned (in reality -80 to -83). Overkill to have this option. I kept only -80 option. PA_BOOST forbidden, HIGH_POWER_SETTINGS disabled (aka value 0x84), OUTPUT_POWER=0, MAX_POWER variable 0 to 7
0 to 17dBm PA_BOOST enabled, HIGH_POWER_SETTINGS disabled, OUTPUT_POWER=0 to 15, MAX_POWER=7
This is wrong. Instead of -4dBm it seems approx. -80dBm. No reception in 3 meters and SF10, I don't find usefull to deploy this range: overkill to my taste. Using only -80 (equals -84).
(MaxPower = 0-7, OutputPower 0)
Third attempt for
setPower
support, it's user-friendly. 'User' optionally writeslora.setPower(17);
to set +17dBm, orlora.setPower(-80)
for -80dBm. If user does not use lora.setPower(), default is +17dBm (like adafruit original TinyLoRa). But I discovered some weird stuff.Pmax = 10.8 * 0.6 * MaxPower
[dBm] (this seems ok) ii.Pout = Pmax - (15 - OutputPower)
[dBm] instead of iii.Pout = Pmax - (15 + OutputPower)
[dBm] It's not logical with increased power to have less dBm's! Datasheet / Documentation: https://www.hoperf.com/data/upload/portal/20190801/RFM95W-V2.0.pdfSo I use the last (iii) formula for the calculations, not the documentation's (ii).
Even more bizzare. The documentation says the range is -4 to +17dBm (+20 special case), but in my test is -80 to +17 (+20 untested). Huge gap between 0 and -80dBm. I didn't test +20.
We have three options with HOPE RFM9x. a. without PA_BOOST (-4 to +15dBm) - in my tests: approx. -75 to -84. b. with PA_BOOST (0 to +17dBm) - in my tests: -0,20 to -14,50 (see first test) c. with PA_BOOST and HI_POWER (aka: +20dBm) - untested. It requires antenna with at least 3:1 VWSR (I have DIY antenna with cable 1/4 monopole as stated in adafruit tutorial). I don't want to risk damage.
Conclusions
and finally
lora.setPower
.Happy testing / undestanding.
To undestand the situation I also wrote a c program https://github.com/clavisound/hope-rfm9x/blob/master/hope-rfm9x-dbm.c I wanted to check which values are easy / meaningful to use. I think it's overkill:
a. to have access to all combinations (some are overlapping). b. Granularity of 1dBm is fine.
How setPower works: The chip has 4 (four) possible 'values' in two registers. PA_BOOST, MAX_POWER, OUTPUT_POWER (one register), HIGH_POWER_SETTINGS (second register). With the c programm, I tried to deciph what I needed.
So I splitted the options in three categories / ranges.
Tests not done:
Testing made with SF7, approx. 12cm distance from concentrator (n-fuse, 2dBi antenna) @CH7 (867.9Mhz). DIY antenna on adafruit LoRa, not optimized.
setPower uses this range with values: PaBoost = 1, MaxPower = 7, OutputPower = 0-15.
Tests done with 'private' library.
This is wrong. Instead of -4dBm it seems approx. -80dBm. No reception in 3 meters and SF10, I don't find usefull to deploy this range: overkill to my taste. Using only -80 (equals -84). (MaxPower = 0-7, OutputPower 0)
Only 4dB more power that previous test. Also not deployed to this library.
Experiment with MaxPower = 7, OutputPower 0-15)
I have also added / deleted some whitespaces.