sandeepmistry / arduino-LoRa

An Arduino library for sending and receiving data using LoRa radios.
MIT License
1.62k stars 621 forks source link

Support +20 dBm for SX1276 #77

Closed dontsovcmc closed 5 years ago

dontsovcmc commented 6 years ago

It's will be good to add +20 dBm mode for SX1276 board and written in manual http://www.semtech.com/images/datasheet/sx1276.pdf

see 5.4.3. High Power +20 dBm Operation

I have 2 boards: https://www.ebay.com/itm/LoRa32u4-II-Lora-LiPo-Atmega32u4-SX1276-HPD13-868MHZ-EU-Antenna/282623601184

settings:
    LoRa.setSignalBandwidth(31.25E3); 
    LoRa.setSpreadingFactor(12); 
    LoRa.setCodingRate4(5);
    LoRa.enableCrc();

I check board current when transmitting at 17dBm and 20 dBm settings (as read in manual):

17 dBm: LoRa.setTxPower(17); current receive mode: 23mA current transmit 1 byte with crc: 66mA (~4sec), 73mA (~2 sec)

20 dBm:

    writeRegister(REG_PA_CONFIG, PA_BOOST | (17 - 2));
    writeRegister(REG_PA_DAC, 0x87);  //turn on 3rd amplifier, see 5.4.3
    writeRegister(REG_OCP, 0x20 | 18); //increace power protection to 150mA RegOcp, see 5.4.4

current receive mode: 23mA current transmit 1 byte with crc: 92mA (~4sec), 98mA (~2 sec)

I also see ~2 RSSI difference on receiver between 17 and 20 modes. I hadn't measure distance, sorry.

p.s. to turn off 20 dBm call:

    writeRegister(REG_PA_DAC, 0x84); //turn off 3rd amplifier, see 5.4.3
    writeRegister(REG_OCP, 0x20 | 0x0B); //RegOcp default
sandeepmistry commented 6 years ago

Hi @dontsovcmc, please submit a pull request for the suggested changes.

Sukuri commented 6 years ago

@dontsovcmc is this can be used in RFM96? and can I know what is the RFM96 PA_BOOST pin?, I'm confused about this pin because I didn't get it in datasheet

dontsovcmc commented 6 years ago

I don't read your manual. RFM96 should be the same & pin should be soldered on board.

halukmy commented 6 years ago

@dontsovcmc add 1278 support too

Sivick commented 6 years ago

Hi, I'm experimenting with this library and I'm measuring the maximum range

I have the SX1276 Lora Shield --- Dragino Lora Shield based RF95, according to what I have investigated I can place up to 20 db of power.

LoRa.setTxPower (20);

In this post I do not understand what they do to not limit to 17 db Thank

dontsovcmc commented 6 years ago

What is the question? I don't test code with RF95. Please, check current before measure range.

Sivick commented 6 years ago

Currently the arduino reaches me approximately 1 km with 17 db, my question is for the libery, I am limited to 17 db, yes it supports me up to 20 db? I just want to make it work a range of 2 km as the specifications of the shield

dontsovcmc commented 6 years ago
  1. LoRa range depends of radio settings: LoRa.setSignalBandwidth(31.25E3); LoRa.setSpreadingFactor(12); LoRa.setCodingRate4(5);
  2. Check your antenna DB value. There is a big difference between 9cm wire (0db) and SMA antenna (+5db). Check frequency of antenna. 433 is bad for 868/915 Mhz. Antenna from wi-fi router is bad (2.4Ghz). After this knowledge, you should think about +20dBm.

1km is bad. I got >2km with SMA antennas +17dBm with SX1276. I got 1km in the city througth buildings.

DaveCalaway commented 6 years ago

I done the same test with RFM96:

I read 20-25 mA during transmission. According to https://goo.gl/H9ZdmN, by default, my code was enabled to used +17dB.

But from the datasheet http://www.hoperf.com/upload/rf/RFM95_96_97_98W.pdf ( page 13 ) i should read 80/90 mA. 20 mA is the value for + 7 dBm.

Someone can help me?

dontsovcmc commented 6 years ago

read 20-25 mA during transmission - you use simple multimeter or oscilloscope ? 20mA - is receiving current. Increase transmitting time to see transmitting current on multimeter:

  1. write a very long message
  2. set: LoRa.setSignalBandwidth(31.25E3); LoRa.setSpreadingFactor(12);

check current

DaveCalaway commented 6 years ago

@dontsovcmc You are right, now i see something around 100mA.

dontsovcmc commented 6 years ago

@DaveCalaway, yeah =) I don't understand, are you turn on +20dBm or use default +17dBm? Please, check the current using my additional code for +20dBm! https://github.com/sandeepmistry/arduino-LoRa/pull/79 Can you measure a range between +17dBm and +20dBm power?

sandeepmistry commented 5 years ago

Closed via #153.