Arduino UNO with Ai-Thinker RA-02 SX1278 LoRa Module


A set up guide for sending LoRa data using the Arduino UNO with the RA-02 module by Ai-Thinker.

I’ve seen a few people asking how to set this up in various places. It’s pretty easy once you know how to plug it together and which library to use. I’m using this library which is available in the Arduino IDE via Sketch > Include Library > Manage Libraries. Search for and then install LoRa by Sandeep Mistry as below.

Lora Library Screen Capture

If you have the same basic RA-02 Module that I bought, it’s going to be pretty tricky to solder connections. The module is 15mm wide so the pads on the back are tiny.

Lora ModuleModule Base

I couldn’t find a breakout board for this so I used one made for an ESP12 that I’d bought ( The spacing is the same and the pins I needed are all available.

The video below is a bit long-winded but explains perfectly how to solder this type of module to a breakout board.

My effort isn’t as clean as the video above!

The wiring is pretty simple. For background you can read this page about SPI on the Arduino – and this page for the wiring the SX1278 but it’s probably easier to just follow the diagram below.

UNO RA-02 Wiring

The pins on the RA-02 look like this with the board face up and the aerial socket top left.

RA-02 Pins

IMPORTANT ! Before connecting the module to power, install the aerial – push it firmly into place. The chip can be damaged if you try transmitting without the aerial.

Breadboard Wiring

This is how I wired things up. The red and brown wires look similar in the photo so use the diagram above.

Uno Wiring

The wiring on the UNO

When it’s all connected you can try some of the examples (File > Examples > LoRa) to see if things are generally working.

I have a Heltec 32 LoRa Kit set up to receive packets (tutorial coming soon for this board). When I upload the example Sketch ‘LoRaSender’ to the Arduino UNO I see this on the serial output of the Heltec Board.

Serial Output

Which shows that the loop in the Arduino code below is sending data via the SX1278 chip correctly.

void loop() {
  Serial.print("Sending packet: ");

  // send packet
  LoRa.print("hello ");



5 Replies to “Arduino UNO with Ai-Thinker RA-02 SX1278 LoRa Module”

  1. Mahesh says:

    Thank you for the informative post.
    I am planning to buy this module. So I wanted to ask whether you have tested its range. Does it really work for a distance of 10km?

    1. WordBot says:

      I’ve not tested this module that much but this one reached 3km line of sight. I’m going to test longer distances. It’s the same chip as the RA-02 but it comes with a better antenna.
      Here’s a video by another guy with distance tests:

  2. ChatBot says:

    Hi WordBot,

    I have used ESP32 with SX1278 LoRa Module, applied two similar units – sender and receiver. SX-1278 has a max packet size of 256 bytes with bit rate upto 300 kbps. but it only sends one packet per second. Not sure how to increase number of packets per second.
    I have a data of 1490 bytes that requires 6 packets (iterations)
    Sender end – data rate is 2 packets / second (512 bytes / second)
    Receiver end – data is 1 packet / second (256 bytes / second) second packet is constantly missing.

    Any idea why this happens?

    1. WordBot says:

      Do you have a sketch I could look at and maybe try?

    2. Bjorn says:

      It probably has to do with regulation. There is a duty cycle saying you cannot transmit more than 1 or 0.1% of the time. If you want higher duty cycles you have to look at other frequencies or different standards. Some limitations are form LoRa and some come with the ISM band (or at least that was my understanding of it)

Leave a Reply

Your email address will not be published. Required fields are marked *

scroll to top