LoRa devices for long range wireless applications

srnet

Senior Member
This is a demonstration of the use of the Dorji DRF1278 wireless transceiver module which uses the Semtech SX1278 LoRa device. The PICAXE code should work with other modules that use the SX1278. The program will run on either the 40X2 or the 28X2.

The Dorji module is is a bare module similar to a RFM22B in size and connection;

http://www.dorji.com/pro/Wireless-module/Semtech_LoRa_SX1272_SX1276_SX1278_Module.html

To quote Semtech;

“The SX1276/77/78 transceivers feature the LoRaTM long range modem that provides ultra-long range spread spectrum communication and high interference immunity whilst minimising current consumption.”

This test program can be used for transmit (TX) or receive (RX) or both. The SX1278 does support AddressFiltering of received packets based on the setting of the NodeAddress register, but in this example program bytes to identify the destination station, source station and packet type are manually added to the start of the packet. Following these 3 header bytes are the actual data payload, which in this example is the 5 bytes that are the ASCII representation of a word variable (00000 to 65535) that increments for every packet sent.

The packet type can be used to inform the RX what to do with the data, or to get the RX to perform some action

The PICAXE scratchpad is used to store the data payload to be transmitted from scratchpad location $00 and to store the payload received from scratchpad location $80. To send a packet load the data into the scratchpad, set the payload length in variable ‘ TXpayloadL’ (defaults to 5 in this example) and call the Transmit subroutine.

The same program is used for receive, in the main program loop (loop1) just select the ‘gosub Receive’ line. The RX program then receives the packet and prints out the source station, packet type, destination station and data payload separately.

In this implementation the total packet length is limited to 64, so 61 bytes of payload.

Settings for LoRa bandwidth, header type, coding rate and spreading factor are specified by the BandWidth, CodeRate, HeaderMode and SpreadFactor symbols listed below, see the section labelled 'Set LoRa Modem parameters'.

Use of a CRC for the packet is assumed. RX and TX must have matching settings.

To calculate the effective data rate in bps, you will need to feed the LoRa settings into the Semtech LoRa calculator, download from the ‘Docs and Resources’ tab here;

http://www.semtech.com/wireless-rf/rf-transceivers/sx1276/

Comparing the performance of the RFM22B when loaded with the settings used for $50SAT indicate the LoRa modems have a 10 times distance improvement over the RFM22B. Granted that the RFM22B is operating at 1kbps and the LoRa modem is at 60bps, but I recall that the RFM22B did not improve much at data rates below 1kbps.

If your data transfer requirements are modest, and 60bps is enough, then the LoRa modules used with simple quarter wave antenna wires and 10mW ought to give a LOS range of around 125kM, which is very impressive indeed.

Range test comparisons in a dense urban environment (at 10mW) were carried out with the TX antenna approximately 1M off the ground. A handheld receiver gave a range of circa 120M for the RFM22B and 650M for the LoRa device.
 

Attachments

Last edited:

srnet

Senior Member
The program prints out a fair bit of stuff to the serial terminal that tells you what is going on, it needs to be viewed in a fixed size font;

Here is the log in TX mode;

Startup:
DRF1278 TX and RX V1.BAS - Stuart Robinson September 2014
SX1278setup:
SX1278print:

Reg 0 1 2 3 4 5 6 7 8 9 A B C D E F
-----------------------------------------------------
$00 = 00 88 1A 0B 00 52 6C 80 01 F3 09 0B 03 01 80 00
$10 = 00 00 00 00 00 00 00 00 00 00 00 00 00 32 77 FF
$20 = 00 0C 01 FF 00 00 04 00 00 00 00 00 00 50 14 40
$30 = 00 C3 05 27 1C 0A 03 0A 42 12 40 1D 00 A1 00 00
$40 = 00 00 12 24 2D 00 03 00 04 23 00 09 05 87 32 2B
$50 = 14 00 00 11 00 00 00 0F E0 00 0C 00 08 00 5C 78
$60 = 00 19 0C 4B CC 0F 01 20 04 47 AF 3F D2 00 35 0B
$70 = D0 01 10 00 00 00 00 00 00 00 00 00 00 00 00 00

FillFIFOandTransmit:
ClearandSetIRQ
DestinationStn,2
SourceStn,1
PacketType,A
Payload,00001
SendingPacket,8bytes
TXOFF:

FillFIFOandTransmit:
ClearandSetIRQ
DestinationStn,2
SourceStn,1
PacketType,A
Payload,00002
SendingPacket,8bytes
TXOFF:

And in RX mode;

Startup:
DRF1278 TX and RX V1.BAS - Stuart Robinson September 2014
SX1278setup:
SX1278print:

Reg 0 1 2 3 4 5 6 7 8 9 A B C D E F
-----------------------------------------------------
$00 = 00 88 1A 0B 00 52 6C 80 01 F3 09 0B 03 09 80 00
$10 = 00 8F 00 00 00 00 00 00 00 00 00 00 00 32 77 FF
$20 = 00 0C 01 FF FF 00 04 00 00 00 00 00 00 50 14 40
$30 = 00 C3 05 27 1C 0A 03 0A 42 12 40 1D 00 A1 00 00
$40 = 00 00 12 24 2D 00 03 00 04 23 00 09 05 87 32 2B
$50 = 14 00 00 11 00 00 00 0F E0 00 0C 00 07 00 5C 78
$60 = 00 19 0C 4B CC 0E 81 20 04 47 AF 3F B9 00 2D 0B
$70 = D0 01 11 00 00 00 00 00 00 00 00 00 00 00 00 00


Receive:
RXtoReady:

**** PacketReceived ****
RXpacketL,8
DestinationStn,2
SourceStn,1
PacketType,A
PayloadContents,00001
RXpacketcount,1
CRCerrors,0
RXOFF:


Receive:
RXtoReady:

**** PacketReceived ****
RXpacketL,8
DestinationStn,2
SourceStn,1
PacketType,A
PayloadContents,00002
RXpacketcount,2
CRCerrors,0
RXOFF:
 

srnet

Senior Member
And a warning for those that wish to tinker.

The DRF1278\SX1278 will operate in standard FSK data mode or LoRa mode.

You can use the FSK mode to manually drive the data out or shift the carrier frequency, these features are useful for generating audio tones and for modes like FM Morse, AFSK RTTY and FSK RTTY.

However some of the registers have different meanings depending on whether the device is in FSK or LoRa mode, so you need to be careful switching between modes or very strange things can happen.
 
Top