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;
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;
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.