LoRa Module for ESP32 DIY Development Kit

via M5Stack
$22.28
SKU M5-M005
Description

LoRa integrated LoRa Module Ra-02, designed and produced by Ai-Thinker. On the board has some extra space left over, so we give you a prototyping area, it's great for adding on your customized circult working with the LoRa Module.

LoRa enables long-range transmissions (more than 10 km in rural areas) with low power consumption,The technology is presented in two parts: LoRa, the physical layer and LoRaWAN (Long Range Wide Area Network), the upper layers.

LoRa and LoRaWAN permit long-range connectivity for Internet of Things (IoT) devices in different types of industries.

Product Features

  • Lora Module: Ra-02 (by Ai-Thinker)
  • Series Communication Protocol: SPI
  • Universal Perboard
  • Working Frequency: 433 MHz
  • Supports FSK, GFSK, MSK, GMSK, LoRa ™ and OOK modulation modes
  • Receive sensitivity: lowest to -141 dBm
  • Programmable bit rate up to 300Kbps
  • Build-in PCB Antenna
  • External Antenna port
  • Program platform: Arduino, Mrcropython, UIFlow(Blockly)

Kit includes

  • 1x M5Stack LoRa Module

Applications

  • Automatic meter reading
  • Home building automation
  • Remote irrigation system
Documents
Learn

Example

Arduino IDE

These are the point-to-point communication examples between two LORA modules. The LoRa nodes send and receive messages.

  • Blue string indicates send succeed.

  • Yellow string display the received messages.

  • Red string indicates initialization failed.

To get complete code, please click here

#include <M5Stack.h>
#include <M5LoRa.h>

//declaration
String outgoing;                     // outgoing message
byte msgCount = 0;                   // count of outgoing messages
byte localAddress = 0xBB;            // address of this device
byte destination = 0xFF;             // destination to send to

//initialization
M5.begin();
LoRa.setPins();                      // set CS, reset, IRQ pin
LoRa.begin(433E6);                   // initialize ratio at 915 MHz

//send message
void sendMessage(String outgoing) {
  LoRa.beginPacket();                // start packet
  LoRa.write(destination);           // add destination address
  LoRa.write(localAddress);          // add sender address
  LoRa.write(msgCount);              // add message ID
  LoRa.write(outgoing.length());     // add payload length
  LoRa.print(outgoing);              // add payload
  LoRa.endPacket();                  // finish packet and send it
  msgCount++;                        // increment message ID
}

//receive message
void onReceive(int packetSize) {
  if (packetSize == 0) return;       // if there's no packet, return
  int recipient = LoRa.read();       // recipient address
  byte sender = LoRa.read();         // sender address
  byte incomingMsgId = LoRa.read();  // incoming msg ID
  byte incomingLength = LoRa.read(); // incoming msg length

  String incoming = "";

  while (LoRa.available()) {
    incoming += (char)LoRa.read();
  }
}

onReceive(LoRa.parsePacket());

More information

Schematic