
SX1262 LoRa Proteus Library | Arduino RadioLib Simulation

Hello friends, I hope you are doing well. In today's tutorial, I am going to share our SX1262 LoRa Proteus Library. The SX1262 is the newer LoRa chip from Semtech with an output power of up to +22 dBm. With this library, we can place two SX1262 modules in one Proteus design, connect each of them to an Arduino Mega 2560 and send messages from one board to the other at 868 MHz. The Arduino code uses the popular RadioLib library, and a row of distance buttons lets us test a link of up to 20 km.
We will start with the basics of the SX1262 and see how it differs from the older LoRa chips. Then we will install the library files, wire the circuit and run the supplied simulation. The main part of this tutorial is the control panel of the module. We will read every line of it and test how the distance, the spreading factor, the bandwidth and the output power decide whether a packet arrives. Finally, we will understand both Arduino sketches and repeat the calculations of the model by hand.
This tutorial uses our V1.0 package, the TEP Arduino Mega 2560 and a 16 MHz clock. The package notes record a test of the supplied project in Proteus 8.5 SP0. In the running screenshot below, the sender is on the left and the receiver is on the right. The sender has sent three messages with a time on air of 41 ms each. The receiver has printed all three of them with an RSSI of -77.0 dBm and an SNR of 10.00 dB at the default distance of 100 m.
What Is the SX1262 LoRa Module?
The SX1262 is a long-range radio transceiver chip from Semtech for frequencies below 1 GHz. A transceiver can both transmit and receive, so the same part is used on each side of a wireless link. The chip contains a LoRa modem and is sold on small modules from several manufacturers. The microcontroller controls it through SPI. Semtech describes the chip in the SX1261/2 data sheet.
Main Features of the SX1262
- It covers the frequencies from 150 to 960 MHz without a gap, so one chip serves the bands at 433, 868 and 915 MHz.
- Its output power goes up to +22 dBm.
- Its LoRa modem supports the spreading factors 5 to 12 and bandwidths from 7.8 to 500 kHz.
- Its receiver needs a current of only 4.2 mA.
- Its data buffer holds 256 bytes.
- Its supply range is 1.8 to 3.7 V.
- Its BUSY pin tells the microcontroller when the chip is ready for the next command.
SX1262 and the Older SX1276 and SX1278
The older LoRa chips are controlled through registers. The microcontroller writes a value into a register, and the chip changes its behavior. The SX1262 is controlled through commands. Every command has a code and some parameters, such as the command for the frequency or the command for sending. This has three consequences for our circuit:
- The chip needs a short time for every command. During this time, the BUSY pin is high, and the driver waits.
- The interrupt output is named DIO1, and the driver uses it for every sent and every received packet.
- The driver is larger. For this reason, our example uses the Arduino Mega 2560 instead of the Arduino Uno.
How LoRa Reaches a Long Range
LoRa stretches every symbol into a long sweep over the whole bandwidth. The receiver adds up the energy of the complete sweep, so it can decode a signal that lies below the noise. The range is paid for with time, because a slow setting keeps the packet on the air for much longer. Three settings control this exchange:
- Spreading factor (SF): a number from 5 to 12. Each step doubles the length of a symbol, and the receiver can work with a signal that is 2.5 dB weaker.
- Bandwidth (BW): the width of the signal. Half the bandwidth means 3 dB less noise, but twice the time.
- Coding rate (CR): the amount of error correction. A rate of 4/5 sends five bits for every four data bits.
Important Terms
- dBm: a unit of signal power. A value of 0 dBm is 1 mW, and negative values are weaker signals.
- RSSI: the received signal strength indicator. It tells us how strong the signal was at the receiver.
- SNR: the signal-to-noise ratio in dB. A negative SNR means that the signal is weaker than the noise.
- Sync word: a value that separates networks. The receiver accepts only packets with its own sync word.
- CRC: a checksum at the end of the packet. The receiver uses it to detect a damaged packet.
- Time on air: the time that one packet needs for its transmission.
- TCXO: a temperature-compensated oscillator. Many SX1262 modules use it as their frequency reference.
Features of Our Proteus Model
- The component is named SX1262TEP and has nine pins.
- Every LoRa module placed in the same design shares one virtual band, so no wire is needed between the sender and the receiver.
- A control panel beside each module shows its live mode, its settings, its counters and the last packet.
- Eight distance buttons, from 10 m to 20 km, set the distance to the other radios.
- A prediction line tells us whether the present settings can cover the selected distance.
- The BUSY pin and the DIO1 pin behave as on the chip, so the unmodified RadioLib driver works with the model.
- The model belongs to our LoRa family. It can exchange packets with our SX1278 and RFM95W modules in the same design.
Keep one distinction in mind. This is a functional model of the LoRa modem with a simple range calculation. It does not simulate antennas, buildings, reflections or interference. The distance buttons teach us how the LoRa settings and the distance are related, but they do not predict the range of a real installation.
Download the SX1262 LoRa Library for Proteus
First of all, download the V1.0 package using the button below. Extract the complete ZIP into a normal folder before opening the project, and keep the files of the simulation folder together.
Download SX1262 LoRa Proteus Library V1.0 and Arduino Simulation| Folder or file | Contents and purpose |
|---|---|
| Proteus Library Files | TEPSX1262.LIB for the radio module, and the TEP Arduino LIB/IDX files with the Arduino Mega 2560. |
| Proteus Model Files | TEPSX1278.DLL in version 1.2, which is the model of our LoRa family. |
| Proteus Simulation | SX1262-ArduinoMega2560.pdsprj, SX1262_Sender.hex, SX1262_Receiver.hex and a local copy of the DLL. |
| Arduino Code | Both sketches, the RadioLib 7.8.1 driver, the AVR core archive and a firmware rebuild script. |
| Model Source | The chip models, SPI transports, shared radio band and Proteus adapters. |
| Documentation | Model notes, third-party notices, a preview of the board artwork and a screenshot of the running example. |
| README.txt and SHA256SUMS.txt | Quick-start instructions and checksums of the packaged files. |
Why the Model File Is Named TEPSX1278.DLL
One model file serves all of our LoRa modules, and it keeps the name of the first one. The device name tells the model which chip it has to be. SX1262TEP is the SX1262, SX1278TEP is the Ra-02 module and RFM95TEP is the RFM95W. All LoRa modules of a design must use the same file, because only then do they share one radio band.
- This package contains version 1.2 of the file. It is the first version that knows the SX1262.
- Version 1.2 runs the SX1278 and the RFM95W as before, so it can replace the older file.
- Do not copy the file of an older SX1278 or RFM95W package over it afterwards. The older versions do not know the SX1262.
The Proteus library and the Arduino library have different jobs. The LIB file defines the component that we place on the schematic, and the DLL gives it its behavior. RadioLib gives our sketch the functions for talking to the radio. Installing the Arduino library alone will not make SX1262TEP appear in Proteus.
How to Install the SX1262 Library in Proteus
Copy the Library and Model Files
Save your work and close Proteus before copying the files. Then follow these steps:
- Open the extracted Proteus Library Files folder.
- Copy
TEPSX1262.LIBinto the library directory configured for your Proteus installation. - Copy
ArduinoV3TEP.LIBandArduinoV3TEP.IDXfrom the same folder if our TEP Arduino library is not installed already. - Open Proteus Model Files and copy
TEPSX1278.DLLinto your configured ProteusMODELSdirectory. Replace an older file of the same name. - Restart Proteus, open Pick Devices and search for SX1262TEP. A search for LoRa finds the module as well.
- Place the module on the schematic, or open the supplied project to use the completed circuit.
Points to Remember
- Use the library and model folders that your installation actually searches. Their locations differ between installations.
- The module is supplied as a LIB file without a separate IDX. The included IDX belongs to the Arduino boards.
- Keep the extra DLL beside the project in the Proteus Simulation folder.
- If the panel of an SX1262 shows the title SX1278, an older DLL is installed. Copy the file of this package into MODELS.
- The two HEX files are programs for the two Arduino boards. The radio module does not need a HEX file.
- Proteus 7 has not been tried.
The Arduino board in this project comes from our Arduino Library for Proteus V3.0. Start with the supplied project, so that the boards, wiring and firmware match the demonstration.
SX1262 Pinout and Arduino Mega 2560 Wiring
The TEP module has nine pins along its lower edge. From left to right, they are VCC, GND, NSS, BUSY, RST, DIO1, MISO, MOSI and SCK. This order was chosen so that the wires of the example do not cross. Start each wire at the exposed pin endpoint below the board artwork.
| Module pin | Connection | Purpose |
|---|---|---|
| VCC | Positive supply terminal | Powers the digital model. |
| GND | Ground | Provides the shared reference. |
| NSS | Arduino Mega D10 | Selects the module for an SPI command. It is active low. |
| BUSY | Arduino Mega D9 | Output of the module. It is high while the chip is not ready for a command. |
| RST | Arduino Mega D3 | Reset input NRESET. It is active low. |
| DIO1 | Arduino Mega D2 | Interrupt output for a sent or a received packet. |
| MISO | Arduino Mega D50 | Data from the module to the Arduino. |
| MOSI | Arduino Mega D51 | Data from the Arduino to the module. |
| SCK | Arduino Mega D52 | SPI clock from the Arduino. |
Both boards use the same wiring. The Arduino named ARD1 works with module U1 as the sender, and ARD2 works with U2 as the receiver. There is no wire between U1 and U2, because the two modules are connected only through the simulated radio band.
The Four Control Pins
- NSS, DIO1, RST and BUSY are given to the driver in this order. In both sketches, the line is
new Module(10, 2, 3, 9). - The BUSY wire is necessary. The driver waits for a low level on BUSY before and after every command. Without this wire, the start of the radio fails.
- The DIO1 wire is necessary as well. The driver uses it to notice the end of a transmission, and the receiver sketch uses it as an interrupt. D2 is an interrupt pin of the Arduino Mega.
- SCK, MISO and MOSI must go to D52, D50 and D51, because these are the SPI pins of the Arduino Mega 2560.
Why the Example Uses the Arduino Mega 2560
The SX1262 driver of RadioLib needs about 44 KB of program memory. The Arduino Uno has 32 KB, so the program does not fit. The Arduino Mega 2560 has 256 KB. Its board is part of the TEP Arduino library, which is included in the package.
Virtual Terminal Connections
- Connect Arduino D1/TX0 to RXD on the Virtual Terminal of each board.
- Set both terminals to 9600 baud, eight data bits, no parity and one stop bit.
- The return connection to D0/RX0 is shown in the circuit, but these sketches do not read typed commands.
Notes for Physical Hardware
- The real SX1262 is a 3.3 V part with a supply range of 1.8 to 3.7 V. Connecting its supply to 5 V can damage it.
- The Arduino Mega 2560 works with 5 V signals. Use a level converter between the board and a real module, or use a board with 3.3 V signals.
- The model does not check the supply voltage, so a working simulation does not prove that your hardware supply is correct.
- The data sheet lists a current of 118 mA for +22 dBm in the bands at 868 and 915 MHz. Check that your 3.3 V supply can deliver this current.
- Both sketches use the standard setting of RadioLib for a module with a TCXO. For a module with a normal crystal, the documentation of RadioLib tells us to set the TCXO voltage of
radio.begin()to 0. - Connect a suitable antenna before you transmit with a real module.
- Use 868 MHz or 915 MHz according to your region, and follow the local rules for power and transmission time.
Run the Two-Arduino Simulation
Start the Simulation
- Open
Proteus Simulation/SX1262-ArduinoMega2560.pdsprjfrom the extracted package. - Keep both HEX files and
TEPSX1278.DLLin that folder. - Double-click ARD1 and confirm that its Program File is
SX1262_Sender.hex. - Double-click ARD2 and confirm that its Program File is
SX1262_Receiver.hex. - Confirm the 16 MHz clock on both boards and 9600 baud on both terminals.
- Press Run. If the two terminal windows open on top of each other, drag them apart and make them wider.
Read the Terminal Output
- Both boards print their title and then [SX1262] Initializing ... success!
- The receiver prints [SX1262] Starting to listen ... success!
- About once per second, the sender prints
[SX1262] Transmitting: Hello TEP #0with a growing number. - After every transmission, the sender prints
[SX1262] Sent OK, time on air 41 ms. - For every message, the receiver prints
[SX1262] Received: Hello TEP #0and a second line such as[SX1262] RSSI: -77.0 dBm SNR: 10.00 dB.
In the running screenshot at the top, the sender has sent the messages 0 to 2, and the receiver has printed the same three messages. The two panels agree with the terminals. The sender's panel shows SENT 3, and the receiver's panel shows RECEIVED 3 and the last message "Hello TEP #2" with 12 bytes.
Watch the time on air when the counter reaches 10. The message "Hello TEP #10" has 13 bytes instead of 12, and the sender then prints a time on air of 46 ms. We will calculate both values later.
Read the Simulation Log
The model also writes short messages into the Simulation Log of Proteus. Each message starts with TEP SX1262 and the name of the module, such as U1.
| Message | Meaning |
|---|---|
| model started, with the chip and the distance | The model has been loaded for this component. |
| powered | The model accepts the VCC and GND connections. |
| NOT powered (check VCC/GND) | VCC is low or GND is high. |
| TCXO enabled on DIO3 | The driver has switched on the supply of the oscillator. |
| first packet sent, with the output power | This radio has completed its first transmission. |
| first packet received, with RSSI and SNR | This radio has received its first packet. |
| packet heard but too weak to decode | A packet with the right settings was below the sensitivity. |
| distance set to, with the new distance | A distance button was clicked. |
At the start, Proteus itself writes a few lines about a changed clock frequency of the AVR SPI. They come from the model of the microcontroller when the Arduino SPI library sets its clock, and they are harmless.
Understand the SX1262 Control Panel
The control panel is the most interesting part of this library. It shows what the radio is doing at every moment, and its distance buttons let us test the link without changing the code. The following picture shows the sender's module U1 and its panel after seven messages.
The title of the panel is SX1262 LoRa CONTROLS. Let us go through the panel from top to bottom.
The Mode Banner and Its Colors
| Banner text | Color | Meaning |
|---|---|---|
| SLEEP | Blue | The radio is in its power-saving mode. |
| STANDBY RC | Blue | The radio is on and waits for commands. It uses its internal RC oscillator. |
| STANDBY RC (BUSY) | Blue | The chip is starting or calibrating. BUSY is high. |
| STANDBY XOSC | Blue | The radio waits with its crystal oscillator running. |
| FS | Blue | The frequency synthesizer is running. |
| TX - SENDING | Orange | A packet is being sent. |
| RX CONTINUOUS | Green | The radio listens until the sketch changes the mode. |
| RX SINGLE | Green | The radio listens for one packet and stops after a timeout. |
| CAD | Green | The radio checks whether a LoRa signal is present on the channel. |
| A mode with the addition GFSK - NOT MODELLED | Blue | The chip is not in LoRa mode. The model covers the LoRa modem only. |
| IN RESET - NRESET LOW | Red | The RST pin is low, so the chip is held in reset. |
| NO POWER - CHECK VCC / GND | Red | The module is not powered. |
| SX1262: OUT OF BAND, with the frequency | Red | The selected frequency is outside the range of the chip. Nothing is sent or received. |
The colors make the state of the link visible at a glance. Green means listening, orange means sending, blue means waiting and red means a problem.
Watch One Packet on Both Panels
With the supplied sketches, one message passes through these steps:
- The receiver's banner is green and shows RX CONTINUOUS. It stays green for the whole simulation.
- The sender's banner is blue and shows STANDBY RC while the sketch waits.
- The sender writes the message into the data buffer of the chip and gives the command for sending. Its banner changes to TX - SENDING for about 41 ms.
- The packet ends. The chip of the sender raises DIO1 and returns to STANDBY RC, and its SENT counter increases by one.
- At the same moment, the chip of the receiver raises its DIO1 pin. The RECEIVED counter increases, and the LAST PACKET lines show the new message.
- The interrupt of the receiver sets a flag, and the sketch reads the packet from the chip.
At the default settings, the orange banner is visible only for a moment. With a high spreading factor, a packet needs up to one second, and you can see the orange color clearly.
The Two Settings Lines
The next two lines show the radio settings. They are taken from the commands that the chip has received, so they show what the sketch has really configured.
| Value in our example | Meaning | Driver function |
|---|---|---|
| 868.000 MHz | Carrier frequency | radio.begin() or radio.setFrequency() |
| SF7 | Spreading factor, 5 to 12 | radio.setSpreadingFactor() |
| BW 125 kHz | Bandwidth, 7.8 to 500 kHz | radio.setBandwidth() |
| CR 4/5 | Coding rate, 4/5 to 4/8 | radio.setCodingRate() |
| SYNC 0x1424 | Sync word in the form of the SX1262 | radio.setSyncWord() |
| CRC ON | CRC setting, ON or OFF | radio.setCRC() |
| EXPLICIT | Header mode, EXPLICIT or IMPLICIT | radio.explicitHeader() and radio.implicitHeader() |
| +14 dBm | Output power, -9 to +22 dBm | radio.setOutputPower() |
Two values need an explanation:
- The sync word has two bytes. The sketch uses the private sync word 0x12 of RadioLib. The SX1262 stores it as 0x1424. The public sync word 0x34 of LoRaWAN is stored as 0x3444.
- The CRC is on. RadioLib switches the CRC on when it starts the radio. The arduino-LoRa driver of our SX1278 and RFM95W examples leaves it off.
These lines are the quickest way to find a configuration mistake. Put the two panels side by side. The frequency, the spreading factor, the bandwidth, the sync word and the header mode must be the same on both panels.
The Counters
- SENT counts the packets that have left this radio. It increases even when no radio receives the packet.
- RECEIVED counts the packets that this radio has received without an error.
- TOO WEAK counts the packets that matched the settings of this radio but were too weak for its spreading factor.
- CRC ERR appears at the end of the line after the first packet with a CRC error.
| Receiver panel | Receiver terminal | Meaning |
|---|---|---|
| RECEIVED increases. | Received, RSSI and SNR | The link works. |
| TOO WEAK increases. | Nothing | The settings match, but the distance is too large for the spreading factor and the power. |
| CRC ERR appears. | CRC error! | The signal is at the edge of the sensitivity. |
| No counter changes. | Nothing | The frequency, the spreading factor, the bandwidth or the sync word is different, or the receiver is not listening. |
The Last Packet Lines
Before the first packet arrives, the panel shows LAST PACKET RECEIVED with a dash below it. You can see this on the sender's panel, because the sender never receives anything. After the first packet, the upper line shows the RSSI and the SNR of the latest packet. The lower line shows the payload in quotation marks, followed by its length. In the running screenshot, the receiver shows -77 dBm, an SNR of 10.0 dB and "Hello TEP #2" with 12 bytes. A payload that is not readable text is shown as hexadecimal bytes.
The Distance Buttons and the Prediction Line
Below the heading DISTANCE TO THE OTHER RADIOS, there are eight buttons: 10 m, 100 m, 1 km, 2 km, 5 km, 10 km, 15 km and 20 km. The selected button is dark blue, and the default is 100 m. Click a button while the simulation runs.
The line below the buttons is a prediction. In the picture above, it reads AT 100 m: -77 dBm, SF7 NEEDS -125 dBm -> OK. It has three parts:
- AT 100 m: -77 dBm is the signal strength that a packet from this radio has at the selected distance.
- SF7 NEEDS -125 dBm is the weakest signal that the present spreading factor and bandwidth can decode.
- OK or TOO WEAK is the result of comparing the two values.
The prediction uses the settings of its own panel only. It changes at once when you click another button, and it also changes when the sketch sets a new spreading factor, bandwidth or output power. The line below the hint names the chip with its frequency range and its highest output power.
Panel Combinations: Distance, Spreading Factor and Power
Now comes the exciting part. The result of a transmission depends on several settings together, and the panel lets us try them one after the other. The values for 100 m agree with the screenshots of this tutorial, and the package notes record the test with the 5 km button in Proteus. The other values are calculated with the formulas of the model, which we will work through after the code.
Combination 1: The Distances on the Two Panels
Each radio has its own distance buttons. For a packet between two radios, the model uses the larger of the two selected distances.
| Sender panel | Receiver panel | Link distance | RSSI on the terminal | SNR on the terminal | Result |
|---|---|---|---|---|---|
| 100 m | 100 m | 100 m | -77.0 dBm | 10.00 dB | Received |
| 1 km | 100 m | 1 km | -107.0 dBm | 9.75 dB | Received |
| 100 m | 2 km | 2 km | -116.0 dBm | 0.75 dB | Received |
| 10 m | 5 km | 5 km | None | None | Too weak |
| 5 km | 10 m | 5 km | None | None | Too weak |
This rule has three consequences:
- To move the radios apart, one click on either panel is enough.
- To bring them together again, both panels must show a short distance.
- The prediction line of one panel can show OK while the packets are too weak, because the other panel has a larger distance. The LAST PACKET line always shows the real value.
Try the Distance Buttons
- Let the simulation run at 100 m and note the RSSI of -77.0 dBm and the SNR of 10.00 dB.
- Click 10 m on both panels. The RSSI rises to -47.0 dBm, and the SNR stays at 10.00 dB.
- Click 1 km on one panel. The RSSI changes to -107.0 dBm, and the SNR drops slightly to 9.75 dB.
- Click 2 km. The RSSI changes to -116.0 dBm, and the SNR is only 0.75 dB. The signal is now hardly stronger than the noise.
- Click 5 km. The prediction line shows -128 dBm and TOO WEAK. The receiver stops printing, and its TOO WEAK counter increases with every message of the sender.
- Click 100 m again. The reception returns with the next message.
Combination 2: Distance and Spreading Factor
The hint on the panel says that a higher SF reaches further. The following table shows the result for the standard power of the sketches. The CRC is switched on, so a packet at the edge of the sensitivity arrives with a CRC error.
| Distance | Signal | SF5 to SF8 | SF9 to SF12 |
|---|---|---|---|
| 10 m | -47 dBm | Received | Received |
| 100 m | -77 dBm | Received | Received |
| 1 km | -107 dBm | Received | Received |
| 2 km | -116 dBm | Received | Received |
| 5 km | -128 dBm | Too weak | Received |
| 10 km | -137 dBm | Too weak | Too weak |
| 15 km and 20 km | -143 dBm and -146 dBm | Too weak | Too weak |
With +14 dBm, the link ends at 5 km. At 10 km, even SF12 misses its limit by 0.2 dB. For larger distances, we need the full power of the chip.
| Distance | Signal | SF5 | SF6 to SF8 | SF9 | SF10 | SF11 | SF12 |
|---|---|---|---|---|---|---|---|
| Up to 2 km | -108 dBm or more | Received | Received | Received | Received | Received | Received |
| 5 km | -120 dBm | Too weak | Received | Received | Received | Received | Received |
| 10 km | -129 dBm | Too weak | Too weak | CRC error | Received | Received | Received |
| 15 km | -134.5 dBm | Too weak | Too weak | Too weak | Too weak | CRC error | Received |
| 20 km | -138 dBm | Too weak | Too weak | Too weak | Too weak | Too weak | Too weak |
The price of a larger range is time. The next table shows the time on air of our message for every spreading factor.
| Spreading factor | Lowest SNR | Weakest signal | Largest distance at +14 dBm | Largest distance at +22 dBm | Time on air |
|---|---|---|---|---|---|
| SF5 | -2.5 dB | -119.5 dBm | 2 km | 2 km | 13 ms |
| SF6 | -5 dB | -122.0 dBm | 2 km | 5 km | 24 ms |
| SF7 | -7.5 dB | -124.5 dBm | 2 km | 5 km | 41 ms |
| SF8 | -10 dB | -127.0 dBm | 2 km | 5 km | 82 ms |
| SF9 | -12.5 dB | -129.5 dBm | 5 km | 5 km | 144 ms |
| SF10 | -15 dB | -132.0 dBm | 5 km | 10 km | 289 ms |
| SF11 | -17.5 dB | -134.5 dBm | 5 km | 10 km | 578 ms |
| SF12 | -20 dB | -137.0 dBm | 5 km | 15 km | 1155 ms |
- The two distance columns show the largest distance without a CRC error.
- To change the spreading factor, change the third parameter of
radio.begin()in both sketches, or callradio.setSpreadingFactor(9)after it. - The spreading factor must be the same on both sides. A packet with a different spreading factor is not received and not counted.
- After the change, the first settings line shows SF9, and the prediction line shows SF9 NEEDS -130 dBm.
- The sender waits until a packet has been sent. At SF12, every message therefore takes more than two seconds instead of one.
Combination 3: Distance and Bandwidth
The bandwidth sets the noise that the receiver collects. A narrow bandwidth has a lower noise floor, so the same signal has a better SNR.
| Bandwidth | Noise floor | Weakest signal | Largest distance | Time on air |
|---|---|---|---|---|
| 31.25 kHz | -123.1 dBm | -130.6 dBm | 5 km | 165 ms |
| 62.5 kHz | -120.0 dBm | -127.5 dBm | 2 km | 82 ms |
| 125 kHz | -117.0 dBm | -124.5 dBm | 2 km | 41 ms |
| 250 kHz | -114.0 dBm | -121.5 dBm | 2 km | 21 ms |
| 500 kHz | -111.0 dBm | -118.5 dBm | 2 km | 10 ms |
- To change the bandwidth, change the second parameter of
radio.begin()in both sketches, or callradio.setBandwidth(31.25)after it. The value is given in kHz. - The bandwidth must be the same on both sides.
- At 500 kHz, a packet needs only 10 ms, and the link still reaches 2 km.
- At 31.25 kHz, SF7 reaches 5 km. This is the same distance as SF9 at 125 kHz, and the time on air is similar.
Combination 4: Distance and Output Power
The driver function radio.setOutputPower() accepts the levels -9 to +22 dBm. The output power moves every signal value up or down by the same amount.
| Output power | Signal at 100 m | Signal at 2 km | Signal at 5 km | Largest distance |
|---|---|---|---|---|
| +22 dBm | -69 dBm | -108 dBm | -120 dBm | 5 km |
| +20 dBm | -71 dBm | -110 dBm | -122 dBm | 5 km |
| +17 dBm | -74 dBm | -113 dBm | -125 dBm | 2 km |
| +14 dBm | -77 dBm | -116 dBm | -128 dBm | 2 km |
| +10 dBm | -81 dBm | -120 dBm | -132 dBm | 2 km |
| 0 dBm | -91 dBm | -130 dBm | -142 dBm | 1 km |
| -9 dBm | -100 dBm | -139 dBm | -151 dBm | 100 m |
- To change the power, change the sixth parameter of
radio.begin()in the sender, or callradio.setOutputPower(22)after it. The panel then shows +22 dBm. - For a packet, only the power of the sending radio matters.
- The step from +14 to +22 dBm gives 8 dB. At SF7, this moves the end of the link from 2 km to 5 km.
- With +22 dBm and SF12, the link reaches 15 km. At a bandwidth of 125 kHz, the distance of 20 km stays out of reach at 868 MHz.
Combination 5: SNR, CRC Errors and the Edge of the Range
LoRa can decode a signal below the noise, so the SNR is as important as the RSSI.
- The reported SNR is limited to +10 dB. This is why 10 m and 100 m show the same SNR of 10.00 dB, although their RSSI values are different.
- At 2 km, the signal is 0.8 dB above the noise. The terminal shows 0.75 dB, because the chip stores the SNR in steps of 0.25 dB.
- At 5 km, the signal is 11.2 dB below the noise. SF7 needs at least -7.5 dB, and SF8 needs -10 dB, so both are too weak. SF9 needs -12.5 dB and receives the packet with an SNR of -11.25 dB.
The CRC adds a zone between received and too weak. A packet that is less than 1 dB above the limit of its spreading factor gets a CRC error in the model. The following happens:
- The chip of the receiver raises DIO1 as for a good packet.
- The driver function
radio.readData()returns the error for a wrong CRC. - The receiver prints [SX1262] CRC error!
- CRC ERR appears on the panel, and the RECEIVED counter does not increase.
With +22 dBm, this happens at 10 km with SF9. The SNR is -12.2 dB, and the limit is -12.5 dB. With SF10, the same packet arrives without an error.
Combination 6: The RSSI Scale of the SX1262
The chip reports the RSSI as one byte in steps of 0.5 dB. The weakest value that this byte can hold is -127.5 dBm. For this reason, the terminal and the panel can show different values for a very weak packet.
| Distance | Spreading factor | LAST PACKET line of the panel | RSSI on the terminal | SNR on the terminal |
|---|---|---|---|---|
| 100 m | SF7 | -77 dBm | -77.0 dBm | 10.00 dB |
| 2 km | SF7 | -116 dBm | -116.0 dBm | 0.75 dB |
| 5 km | SF9 | -128 dBm | -127.5 dBm | -11.25 dB |
For weak signals, the SNR is therefore the better value. It still changes when the RSSI has reached the end of its scale.
Combination 7: Settings That Must Agree
| Setting | Result of a difference |
|---|---|
| Frequency | Nothing is received, and no counter of the receiver changes. |
| Spreading factor | Nothing is received, and no counter of the receiver changes. |
| Bandwidth | Nothing is received, and no counter of the receiver changes. |
| Sync word | Nothing is received, and no counter of the receiver changes. |
| Header mode | Nothing is received, and no counter of the receiver changes. |
| Coding rate | The packet is received, because the explicit header tells the receiver the coding rate. |
| CRC setting | The packet is received, because the explicit header tells the receiver whether a CRC follows. |
| Output power | The packet is received when the signal is strong enough. |
A small frequency difference is accepted. The model receives a packet when the two frequencies differ by no more than a quarter of the bandwidth, which is 31.25 kHz at the default settings. The data sheet of the chip gives the same limit of 25 percent of the bandwidth.
Combination 8: 868 MHz, 915 MHz and 433 MHz
The first parameter of radio.begin() is the frequency in MHz. The SX1262 covers all three common bands, so we can compare them with the same component.
| Frequency | Loss of the first metre | Signal at 100 m | Signal at 5 km | Largest distance |
|---|---|---|---|---|
| 433 MHz | 25.2 dB | -71.2 dBm | -122.1 dBm | 5 km |
| 868 MHz | 31.2 dB | -77.2 dBm | -128.2 dBm | 2 km |
| 915 MHz | 31.7 dB | -77.7 dBm | -128.6 dBm | 2 km |
- Use the same frequency in both sketches.
- The lower band has 6 dB less loss in the model, which is worth a little more than two steps of the spreading factor.
- RadioLib checks the frequency. A value outside 150 to 960 MHz is refused, and
radio.begin()fails with the code -12.
Arduino Code for the SX1262 Sender
The following is the exact sender sketch included in the download. It uses the bundled RadioLib library, version 7.8.1. Use the supplied copy for your first build, so that your firmware matches the packaged HEX file.
// SX1262 LoRa sender - TEP SX1262 LoRa Library for Proteus demo
// Arduino Mega 2560 + RadioLib (based on RadioLib's SX126x_Transmit_Blocking example)
// www.TheEngineeringProjects.com
//
// Wiring (RadioLib's standard SX126x pins):
// NSS -> D10 DIO1 -> D2 NRST -> D3 BUSY -> D9
// SCK -> D52 MISO -> D50 MOSI -> D51 VCC -> 3.3 V GND -> GND
#include <RadioLib.h>
SX1262 radio = new Module(10, 2, 3, 9); // NSS, DIO1, NRST, BUSY
int count = 0;
void setup() {
Serial.begin(9600);
Serial.println(F("TEP SX1262 LoRa sender (Arduino Mega 2560 + RadioLib)"));
Serial.print(F("[SX1262] Initializing ... "));
// 868.0 MHz, BW 125 kHz, SF7, CR 4/5, private sync word 0x12, +14 dBm
int state = radio.begin(868.0, 125.0, 7, 5, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, 14);
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
}
void loop() {
String str = "Hello TEP #" + String(count++);
Serial.print(F("[SX1262] Transmitting: "));
Serial.println(str);
int state = radio.transmit(str);
if (state == RADIOLIB_ERR_NONE) {
Serial.print(F("[SX1262] Sent OK, time on air "));
Serial.print(radio.getTimeOnAir(str.length()) / 1000);
Serial.println(F(" ms"));
} else if (state == RADIOLIB_ERR_TX_TIMEOUT) {
Serial.println(F("[SX1262] Timeout!"));
} else {
Serial.print(F("[SX1262] Failed, code "));
Serial.println(state);
}
delay(1000);
}
Create the Radio Object
The line SX1262 radio = new Module(10, 2, 3, 9) creates the radio object. The four numbers are the Arduino pins for NSS, DIO1, the reset and BUSY. The SPI pins are not listed, because the driver uses the hardware SPI of the board.
Start the Radio
The function radio.begin() receives six values in our sketch:
| Position | Value | Meaning |
|---|---|---|
| 1 | 868.0 | Frequency in MHz |
| 2 | 125.0 | Bandwidth in kHz |
| 3 | 7 | Spreading factor |
| 4 | 5 | Coding rate 4/5 |
| 5 | RADIOLIB_SX126X_SYNC_WORD_PRIVATE | Sync word 0x12 for private networks |
| 6 | 14 | Output power in dBm |
The function does a lot of work. It resets the chip, waits for the BUSY pin and checks the version text of the chip. Then it sends the commands for all settings. It returns the value 0 for success and a negative code for an error. The sketch prints the code and stops when the start has failed.
Send a Packet
- The sketch builds the text from "Hello TEP #" and the counter.
radio.transmit(str)sends the text. The function returns when the chip reports the end of the transmission on DIO1.radio.getTimeOnAir()calculates the time on air for the length of the text. It returns the time in microseconds, so the sketch divides it by 1000.- The sketch waits for one second.
Arduino Code for the SX1262 Receiver
The start of the receiver is the same as in the sender. The reception itself works with an interrupt. Here is the exact sketch from the package:
// SX1262 LoRa receiver - TEP SX1262 LoRa Library for Proteus demo
// Arduino Mega 2560 + RadioLib (based on RadioLib's SX126x_Receive_Interrupt example)
// www.TheEngineeringProjects.com
//
// Wiring (RadioLib's standard SX126x pins):
// NSS -> D10 DIO1 -> D2 NRST -> D3 BUSY -> D9
// SCK -> D52 MISO -> D50 MOSI -> D51 VCC -> 3.3 V GND -> GND
#include <RadioLib.h>
SX1262 radio = new Module(10, 2, 3, 9); // NSS, DIO1, NRST, BUSY
// set by the DIO1 interrupt when a packet has arrived
volatile bool receivedFlag = false;
void setFlag(void) {
receivedFlag = true;
}
void setup() {
Serial.begin(9600);
Serial.println(F("TEP SX1262 LoRa receiver (Arduino Mega 2560 + RadioLib)"));
Serial.print(F("[SX1262] Initializing ... "));
// must match the sender: 868.0 MHz, BW 125 kHz, SF7, CR 4/5, sync word 0x12
int state = radio.begin(868.0, 125.0, 7, 5, RADIOLIB_SX126X_SYNC_WORD_PRIVATE, 14);
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
radio.setPacketReceivedAction(setFlag); // DIO1 -> INT0 (D2)
Serial.print(F("[SX1262] Starting to listen ... "));
state = radio.startReceive();
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F("success!"));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true) { delay(10); }
}
}
void loop() {
if (receivedFlag) {
receivedFlag = false;
String str;
int state = radio.readData(str);
if (state == RADIOLIB_ERR_NONE) {
Serial.print(F("[SX1262] Received: "));
Serial.println(str);
Serial.print(F("[SX1262] RSSI: "));
Serial.print(radio.getRSSI(), 1);
Serial.print(F(" dBm SNR: "));
Serial.print(radio.getSNR(), 2);
Serial.println(F(" dB"));
} else if (state == RADIOLIB_ERR_CRC_MISMATCH) {
Serial.println(F("[SX1262] CRC error!"));
} else {
Serial.print(F("[SX1262] Failed, code "));
Serial.println(state);
}
}
}
Listen With an Interrupt
- The function
setFlag()is the interrupt routine. It only sets the variable receivedFlag. radio.setPacketReceivedAction(setFlag)connects this function to the DIO1 pin.radio.startReceive()puts the chip into the continuous receive mode. The function returns at once, and the chip listens on its own.- The loop checks the flag. As long as it is false, the Arduino is free for other work.
This is the reason why the banner of the receiver shows RX CONTINUOUS. The chip stays in this mode after every packet, so no packet is missed while the sketch prints the last one.
Read the Packet and Its Values
radio.readData(str)copies the packet from the chip into a text variable. It also reports a CRC error.radio.getRSSI()returns the signal strength of the packet in dBm. The sketch prints it with one decimal.radio.getSNR()returns the SNR of the packet in dB. The sketch prints it with two decimals.
More Functions of RadioLib
RadioLib offers a function for every setting that we have seen on the panel. Call them after radio.begin(). The package notes list these settings as tested with the model on a PC.
| Function | Accepted values or purpose | Error code for a value outside the range |
|---|---|---|
radio.setFrequency() | 150 to 960 MHz | -12 |
radio.setBandwidth() | The LoRa bandwidths in kHz | -8 |
radio.setSpreadingFactor() | 5 to 12 | -9 |
radio.setCodingRate() | 4 to 8 | -10 |
radio.setOutputPower() | -9 to +22 dBm | -13 |
radio.setSyncWord() | One byte, such as 0x12 or 0x34 | Not applicable |
radio.setCRC() | 0 switches the CRC off, and 2 switches it on | Not applicable |
radio.scanChannel() | Checks whether the channel is free | Not applicable |
radio.sleep() and radio.standby() | Change the mode of the chip | Not applicable |
Calculate the Link Budget
A link budget tells us whether the signal at the receiver is strong enough. The model uses four steps, and we can repeat them with a calculator.
Step 1: Calculate the Path Loss
The model uses the free-space loss for the first metre, and then a loss that grows with 30 dB for every ten-fold increase in distance:
Path loss in dB = 20 × log10(4 × pi × f / c) + 30 × log10(distance in metres)
Here, f is the frequency in Hz and c is the speed of light. At 868 MHz, the first part is 31.22 dB. For 2 km, the second part is 30 × 3.301 = 99.03 dB. The path loss at 2 km is therefore 130.25 dB.
Step 2: Calculate the RSSI
RSSI = output power - path loss
- 100 m: the path loss is 31.22 + 60 = 91.22 dB, so the RSSI is +14 - 91.22 = -77.22 dBm. The chip stores it in steps of 0.5 dB, and the terminal shows -77.0 dBm.
- 2 km: +14 - 130.25 = -116.25 dBm, which the terminal shows as -116.0 dBm.
- 5 km: the path loss is 31.22 + 110.97 = 142.19 dB, so the RSSI is -128.19 dBm.
Step 3: Calculate the Noise Floor
Noise floor in dBm = -174 + 10 × log10(bandwidth in Hz) + 6
The value -174 dBm is the thermal noise in a bandwidth of 1 Hz, and 6 dB is the noise that the model adds for the receiver. For 125 kHz, the middle part is 50.97 dB. The noise floor is -174 + 50.97 + 6 = -117.03 dBm.
Step 4: Calculate the SNR and Compare
SNR = RSSI - noise floor
- 100 m: -77.22 + 117.03 = 39.81 dB. The reported value is limited to 10 dB.
- 2 km: -116.25 + 117.03 = 0.78 dB. SF7 needs -7.5 dB, so the packet is received.
- 5 km: -128.19 + 117.03 = -11.16 dB. This is below -7.5 dB, so the packet is too weak for SF7.
The weakest signal for a spreading factor is the noise floor plus its lowest SNR. For SF7, this is -117.03 - 7.5 = -124.53 dBm, which the panel shows as -125 dBm.
Calculate the Time on Air
The sender prints the time on air, so we can check the calculation against the terminal. We need these values: SF7, 125 kHz, coding rate 4/5, a preamble of 8 symbols, the explicit header, the CRC and a payload of 12 bytes.
- The symbol time is 2 to the power of SF, divided by the bandwidth. This is 128 / 125,000 = 1.024 ms.
- The preamble needs 8 + 4.25 = 12.25 symbols.
- For the payload, we calculate 8 × 12 + 16 - 4 × 7 + 8 + 20 = 112. The number 16 stands for the CRC, and the number 20 stands for the header.
- We divide 112 by 4 × 7 = 28. The result is exactly 4.
- The payload needs 8 + 4 × 5 = 28 symbols. The number 5 comes from the coding rate 4/5.
- The packet has 12.25 + 28 = 40.25 symbols, which take 40.25 × 1.024 = 41.2 ms. The terminal shows 41 ms.
From the message "Hello TEP #10" onwards, the payload has 13 bytes. The third step then gives 120, and 120 / 28 = 4.29 is rounded up to 5. The payload needs 8 + 5 × 5 = 33 symbols, and the packet has 45.25 symbols. They take 45.25 × 1.024 = 46.3 ms, and the terminal shows 46 ms. One more byte has cost five more symbols, because the payload grows in blocks.
Convert the Packet Status to dBm and dB
- The chip stores the RSSI as one byte. The driver calculates RSSI = -value / 2. At 100 m, the byte holds 154, and -154 / 2 = -77.0 dBm.
- The largest value of one byte is 255, which gives the end of the scale at -127.5 dBm.
- The chip stores the SNR in steps of 0.25 dB. The driver calculates SNR = value / 4. At 2 km, the byte holds 3, and 3 / 4 = 0.75 dB.
Calculate the Frequency Setting
The chip uses a 32 MHz reference. One frequency step is 32 MHz divided by 2 to the power of 25, which is 0.95 Hz. For 868 MHz, the driver calculates 868,000,000 × 33,554,432 / 32,000,000 = 910,163,968. In hexadecimal, this number is 0x36400000, and the driver sends it as four bytes with the frequency command.
SX1262 Together With Our SX1278 and RFM95W Modules
All three LoRa components use the same model file, so they can be placed in one design and exchange packets. The other two modules are explained in our SX1278 LoRa Proteus Library and RFM95W LoRa Proteus Library tutorials.
| Property | SX1262TEP | SX1278TEP | RFM95TEP |
|---|---|---|---|
| Chip | SX1262 | SX1278 | SX1276 |
| Frequency range of the model | 150 to 960 MHz | 137 to 525 MHz | 137 to 1020 MHz |
| Highest output power | +22 dBm | +20 dBm | +20 dBm |
| Spreading factors | 5 to 12 | 6 to 12 | 6 to 12 |
| Control | Commands and the BUSY pin | Registers | Registers |
| Interrupt pin | DIO1 | DIO0 | DIO0 |
| Arduino driver of the example | RadioLib | arduino-LoRa | arduino-LoRa |
| Board of the example | Arduino Mega 2560 | Arduino Uno | Arduino Uno |
| CRC of the example | On | Off | Off |
For a mixed design, keep these points in mind:
- Install the DLL of this package, which is version 1.2.
- Use the same frequency, spreading factor, bandwidth and sync word in all sketches. The frequency must lie inside the range of every chip.
- The sync word 0x12 of the older chips and the sync word 0x1424 of the SX1262 are the same word in two forms.
- Avoid SF11 at 125 kHz in a mixed design. At this setting, RadioLib switches on the low data rate optimization of the chip, and the arduino-LoRa driver does not. The two radios then do not understand each other.
- The CRC setting may differ, because the explicit header carries it.
Experiments to Try in Proteus
Change one thing at a time and predict the result before you press Run. The results below follow from the model's rules. The supplied project and the 5 km button were tested in Proteus. The package notes list the other cases as tests of the model on a PC, so check them in your own simulation.
| Change | Expected result |
|---|---|
| Click 5 km on either panel. | The receiver prints nothing, and its TOO WEAK counter increases. |
| Change the spreading factor to 9 in both sketches. | The link works at 5 km. The terminal shows -127.5 dBm and an SNR of -11.25 dB. |
| Change the spreading factor to 9 in one sketch only. | Nothing is received, and no counter of the receiver changes. |
| Change the output power of the sender to 22. | The receiver shows -69.0 dBm at 100 m, and the link works at 5 km with SF7. |
| Use +22 dBm and SF9, and click 10 km. | The receiver prints CRC error!, and CRC ERR appears on its panel. |
| Use the sync word RADIOLIB_SX126X_SYNC_WORD_PUBLIC in the sender only. | Nothing is received. The panels show 0x3444 and 0x1424. |
| Change the frequency to 915.0 in one sketch only. | Nothing is received, and the panels show different frequencies. |
| Change the frequency to 1000.0 in one sketch. | The terminal of this board shows Initializing ... failed, code -12. |
| Remove the BUSY wire of one module. | The start of this radio fails, and the terminal shows an error code. |
| Connect VCC of the receiver's module to ground. | The banner of this module turns red and shows NO POWER - CHECK VCC / GND. |
After each experiment, compare both panels before reading the code again. A difference in frequency, spreading factor, bandwidth or sync word is visible there.
Compile and Load Your Own Arduino Changes
- Open
Arduino Code/SX1262_Sender/SX1262_Sender.inoor the receiver sketch in Arduino IDE. - Install RadioLib by Jan Gromes from the Library Manager. For the same version as the example, copy
Arduino Code/libraries/RadioLibinto your sketchbook's libraries folder. - Select Arduino Mega or Mega 2560 as the board.
- Compile the sketch and use the Export Compiled Binary command.
- Select the new application HEX in the Program File property of the correct Arduino.
- Restart the simulation.
Remember that the project has two programs. If you change a radio setting, rebuild both sketches and load each HEX into its own board. The package also contains a rebuild script and the AVR core source archive.
Common Problems and Their Solutions
| Problem | What to check |
|---|---|
| SX1262TEP is missing from Pick Devices. | Check that TEPSX1262.LIB is in the active library folder and restart Proteus. |
| The module is placed, but its model cannot load. | Check TEPSX1278.DLL in MODELS and beside the project. |
| The panel title shows SX1278 instead of SX1262. | An older TEPSX1278.DLL is installed. Copy the file of this package into MODELS. |
| The terminal prints failed, code -2. | The chip was not found. Check SCK, MISO, MOSI, NSS, BUSY and RST, then VCC and GND. |
| The terminal prints failed, code -705. | The driver has waited too long for the chip. Check the BUSY wire first. |
| The sender prints Timeout! | The driver did not see the end of the transmission. Check the DIO1 wire to D2. |
| No packets are received. | Compare the frequency, the spreading factor, the bandwidth and the sync word on both panels. Check that the receiver shows RX CONTINUOUS and that its DIO1 wire goes to D2. |
| The TOO WEAK counter increases. | Select a shorter distance on both panels, raise the spreading factor or raise the power. |
| The receiver prints CRC error! | The signal is at the edge of the sensitivity. Use the next spreading factor or a shorter distance. |
| The sketch does not fit into the Arduino Uno. | Use the Arduino Mega 2560. The SX1262 driver of RadioLib is too large for the Uno. |
| A terminal is blank or unreadable. | Check the Program File, the 16 MHz clock, D1/TX0 to RXD and 9600 baud. |
If a problem remains, return to the unmodified project and change one thing at a time. When you ask for help, include both terminal windows and a screenshot of both control panels.
Practical Review and Model Limitations
This library is useful for learning the SX1262 and RadioLib before the hardware arrives. The BUSY pin, the interrupt on DIO1 and the error codes of the driver behave as on the chip, so a sketch that works in Proteus uses the same calls on the real module. The two panels show the settings of both radios side by side, and the distance buttons turn the link budget into an experiment that we can repeat.
What the Model Supports
- The commands of the chip over SPI, with the status byte and the BUSY pin.
- The modes sleep, standby, frequency synthesis, transmit, receive and channel activity detection.
- The interrupts of the chip and the DIO1 pin.
- The spreading factors 5 to 12, all LoRa bandwidths, the coding rates, the header modes, the CRC and the IQ inversion.
- The output power from -9 to +22 dBm.
- The RSSI and the SNR of every packet, and the time on air.
- The reset pin and the sleep modes with and without the stored configuration.
- A range calculation from output power, frequency, distance, bandwidth and spreading factor.
What the Model Does Not Simulate
- The GFSK, BPSK and LR-FHSS modes of the chip. Their commands are accepted, but nothing is sent or received.
- Collisions between transmitters that send at the same moment.
- Frequency errors between two oscillators.
- The receive duty cycle. It is treated as continuous reception.
- The outputs DIO2 and DIO3.
- Real antennas, terrain, fading and interference.
- The supply voltage and the current of the module.
Treat the range values as teaching examples. The range of real hardware depends on the antenna, its height, the surroundings and the local rules for the frequency band, so it must be measured with the actual devices. The times of the model follow the data sheet closely enough for the driver, but they are not exact to the microsecond.
More Proteus Libraries of This Series
This library belongs to a series of wireless and RFID libraries for Proteus. Every library has its own control panel and its own tutorial:
- SX1278 LoRa Proteus Library: a LoRa link at 433 MHz with the Ra-02 module.
- RFM95W LoRa Proteus Library: a LoRa link at 868 MHz with RSSI, SNR and spreading factor.
- nRF24L01 Proteus Library: a 2.4 GHz link between two Arduino Uno boards with the RF24 library.
- nRF24L01 PA LNA Proteus Library: the long-range 2.4 GHz module with a power amplifier and distance buttons up to 2 km.
- CC1101 Proteus Library: a link at 433.92 MHz with signal strength and distance buttons.
- RFM69HCW Proteus Library: a node and a gateway at 433 MHz with acknowledgements.
- MFRC522 RFID Proteus Library: a 13.56 MHz RFID reader with virtual MIFARE cards.
- EM-18 RFID Proteus Library: a 125 kHz RFID reader with serial output.
- PN532 NFC Proteus Library: an NFC reader for I2C and SPI with MIFARE Classic and NTAG213 cards.
Frequently Asked Questions
Can I Use the Arduino Uno With This Library?
The Proteus component works with every board that has SPI. The limit is the driver. The SX1262 part of RadioLib needs about 44 KB of program memory, and the Arduino Uno has 32 KB. Use the Arduino Mega 2560 with RadioLib.
Why Does the Panel Show the Sync Word 0x1424?
The SX1262 stores the sync word in two bytes. The value 0x1424 is the private sync word 0x12 in this form. The value 0x3444 is the public sync word 0x34.
Why Is the SNR Always 10.00 dB at a Short Distance?
The model limits the reported SNR to +10 dB, as real modules do at close range. Use the RSSI to compare short distances.
Why Does the Time on Air Change From 41 ms to 46 ms?
From message 10 onwards, the text has one more character. The payload of a LoRa packet grows in blocks of symbols, and the additional byte needs the next block.
Why Does the Sender Print a Message That Was Not Received?
The sketch sends a packet without asking for an answer. The sender only knows that the packet has left the radio. If you need a confirmation, the receiver must send a reply packet, and the sender must wait for it.
Can the SX1262 Talk to Our SX1278 and RFM95W Modules?
Yes, in the simulation. All three components share one radio band when the DLL of this package is installed. Use the same frequency, spreading factor, bandwidth and sync word, and avoid SF11 at 125 kHz.
Do I Need Arduino IDE to Run the Supplied Circuit?
No. Both compiled HEX files are included. You need Arduino IDE, or the documented build tools, only when you change a sketch.
That completes our SX1262 LoRa Proteus Library tutorial. Start with the supplied project, watch both panels and then change the distance step by step. Once the RSSI and SNR values make sense, change the spreading factor or the power and compare the results with your own calculation. Share your questions and simulation results in the comments below.
























Comments
0