Skip to content

LoRa Testing and Code Examples

Dave Williams | DitroniX | G8PUO edited this page Mar 26, 2026 · 3 revisions

A number of example LoRa Arduino code samples are provided in repository for the ESPRanger.

Typically these are basic examples of getting the LoRa E22-900MM22S talking to the ESP32-C6.

Fast SPI communications is used, rather than slower UART control.

LoRa Enable:

Remember to put the LoRa Enable jumper on, or no LoRa code will work.

This jumper adds 3V3 supply to the E22-900MM22S.

Important:

More importantly, you MUST ENSURE AN ANTENNA, OR RF LOAD, IS CONNECTED TO THE LORA MODULE - BEFORE TX

Failure to do so, may damage the LoRa Transmitter PA and invalidate all warranty.

Point to Point Test

An example application is provided called 'LoRa_Point_to_Point_Test'. This can be used to send and/or receive an example message between, two or more ESPRanger / LoRa devices.

Simply flash the same code to two, or more devices, and by pressing the USER button, the device will then broadcast a LoRa message.

  • BLUE Led = TX Message
  • GREEN Led = RX Received

Example Serial Monitor Output

[SX1262] Initializing ... [SX1262] Initializing ... Initialise Success!

Ready!

ESPRanger - LoRa Point-to-Point Messaging

Press USER Button to send Message

Received:  RSSI: -30.00 dBm   SNR: 11.00 dB	 Msg: Hello from ESPKnack 408278CC  #2

Received:  RSSI: -29.00 dBm   SNR: 11.00 dB	 Msg: Hello from ESPKnack 408278CC  #3

Received:  RSSI: -40.00 dBm   SNR: 10.75 dB	 Msg: Hello from AQIL 4087F30C  #0  #3

Button Pressed	Sending: Hello from ESPRanger #0

Button Pressed	Sending: Hello from ESPRanger #1

Received:  RSSI: -30.00 dBm   SNR: 10.75 dB	 Msg: Hello from ESPKnack 408278CC  #4

Received:  RSSI: -39.00 dBm   SNR: 10.75 dB	 Msg: Hello from AQIL 4087F30C  #2  #4

Received:  RSSI: -30.00 dBm   SNR: 11.00 dB	 Msg: Hello from ESPKnack 408278CC  #5

Received:  RSSI: -30.00 dBm   SNR: 10.50 dB	 Msg: Hello from ESPKnack 408278CC  #6

Clone this wiki locally