Description
Pinout
Features
- LoRa ™ Spread Spectrum modulation technology
- Constant RF power output at + 20dBm-100mW voltage change
- Half-duplex SPI communication
- Supports FSK, GFSK, MSK, GMSK, LoRa ™ and OOK modulation modes
- Automatic RF signal detection, CAD mode and very high speed AFC
- Packet engine with CRC up to 256 bytes
- Small footprint dual-row stamp-hole patch package
- Shielded housing
- Spring Antenna
Specifications
- Communication distance: 15KM
- Sensitivity: down to -148dBm
- Programmable bit rates: up to 300kbps
- RSSI dynamic range: 127dB
- Wireless frequency: 433MHz
- Working voltage: 1.8-3.7v
- Working temperature: -40-+80 ℃
Package include: LoRa Ra-02 SX1278 433M Wireless Module x 1
Interfacing the module with arduino:the module usually can be configured as transmitter and receiver, in this tutorial we will employ the two modules where one will behave like transmitter and the other as receiver. the aim will be to control the brightness of the led wirelessly the transmitter and receiver circuits are hooked as follows:
TRANSMITTER
The circuit is made of 3 components which are: Arduino, jumper wires,Lora and a Potentiometer to adjust resolution to be sent to receiver
RECEIVER
The receiving circuit is made of Lora module, arduino, jumper wires and Led to comvert the resolution received from the transmitter into visual light alterations as shown in circuit below:
Codes
After finishing to hook up the circuit, download the library through library manager then copy the codes, paste them to IDE and upload them to your arduinos respectively:
Receiver codes
#include <SPI.h> #include <LoRa.h> int LED = 3; String inString = ""; // string to hold input int val = 0; void setup() { Serial.begin(9600); pinMode(LED,OUTPUT); while (!Serial); Serial.println("LoRa Receiver"); if (!LoRa.begin(433E6)) { // or 915E6 Serial.println("Starting LoRa failed!"); while (1); } } void loop() { // try to parse packet int packetSize = LoRa.parsePacket(); if (packetSize) { // read packet while (LoRa.available()) { int inChar = LoRa.read(); inString += (char)inChar; val = inString.toInt(); } inString = ""; LoRa.packetRssi(); } Serial.println(val); analogWrite(LED, val); }
Transmitter codes
#include <SPI.h> #include <LoRa.h> int pot = A0; void setup() { Serial.begin(9600); pinMode(pot,INPUT); while (!Serial); Serial.println("LoRa Sender"); if (!LoRa.begin(433E6)) { // or 915E6, the MHz speed of yout module Serial.println("Starting LoRa failed!"); while (1); } } void loop() { int val = map(analogRead(pot),0,1024,0,255); LoRa.beginPacket(); LoRa.print(val); LoRa.endPacket(); delay(50); }