Has anyone used the waveshare sx1262 hf lora module with the arduino uno.
I could not get it to work ...i dont know where to start
Most LoRa modules are 3.3V logic and cannot be directly connected to 5V logic Arduinos such as the UNO.
Maybe provide some useful information such as the code you are using, the schematic\connections and links to the modules your are using.
Hi, @lamshuwa
Welcome to the forum.
Can you please post your codes?
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
Thanks.. Tom...
Micro Controller: Arduino Uno
Lora Module: Waveshare sx1262 HF
Antenna Used: 698 – 960 MHz & 1710 – 2690 MHz 6/7 dBi Gain Magnetic Mount Antenna (0.5m)
Pin Configuration:
|SX1261 Pin|Arduino Pin|Description|
|MOSI |11 |Master Out Slave In (Data)|
|MISO |12 |Master In Slave Out (Data)|
|CLK |13 |Serial Clock|
|CS |10 |Chip Select|
|RESET | 9 |Reset Pin|
|DIO1 | 2 |Interrupt Pin|
|GND |GND |Ground|
|VCC |3.3V |Power Supply|
Transmitter Code:
#include <SPI.h>
#include <LoRa.h>
#define CS_PIN 10 // Chip Select pin
#define RESET_PIN 9 // Reset pin
#define DIO0_PIN 2 // DIO0 pin for interrupt
void setup() {
Serial.begin(9600);
while (!Serial); // Wait for serial port to open
Serial.println("LoRa Transmitter Setup");
pinMode(RESET_PIN, OUTPUT);
digitalWrite(RESET_PIN, HIGH);
delay(10);
digitalWrite(RESET_PIN, LOW);
delay(50); // Reset delay
digitalWrite(RESET_PIN, HIGH);
delay(100); // Delay for module to stabilize
Serial.print("Initializing LoRa... ");
if (!LoRa.begin(868E6)) { // Set frequency to 868 MHz
Serial.println("LoRa init failed!");
while (1); // Stop further execution
}
Serial.println("LoRa init successful!");
LoRa.setTxPower(13); // Set transmission power
}
void loop() {
const char *msg = "Hello LoRa!";
Serial.print("Sending: ");
Serial.println(msg);
LoRa.beginPacket();
LoRa.print(msg);
LoRa.endPacket();
Serial.println("Packet sent!");
delay(2000); // Wait 2 seconds before sending again
}
Receiver Code:
#include <SPI.h>
#include <LoRa.h>
#define CS_PIN 10 // Chip Select pin
#define RESET_PIN 9 // Reset pin
#define DIO0_PIN 2 // DIO0 pin for interrupt
void setup() {
Serial.begin(9600);
while (!Serial); // Wait for serial port to open
Serial.println("LoRa Receiver Setup");
pinMode(RESET_PIN, OUTPUT);
digitalWrite(RESET_PIN, HIGH);
delay(10);
digitalWrite(RESET_PIN, LOW);
delay(50); // Reset delay
digitalWrite(RESET_PIN, HIGH);
delay(100); // Delay for module to stabilize
Serial.print("Initializing LoRa... ");
if (!LoRa.begin(868E6)) { // Set frequency to 868 MHz
Serial.println("LoRa init failed!");
while (1); // Stop further execution
}
Serial.println("LoRa init successful!");
}
void loop() {
int packetSize = LoRa.parsePacket();
if (packetSize) {
String receivedMessage = "";
while (LoRa.available()) {
receivedMessage += (char)LoRa.read();
}
Serial.print("Received: ");
Serial.println(receivedMessage);
} else {
Serial.println("No packet received.");
}
delay(1000); // Delay between checks
}
You need bidirectional logic level shifters to connect that 3.3V module to a 5V Uno.
If you have connected the two without using the level shifters, one or both may already be damaged. It is best to use a 3.3V Arduino with that radio.
arduino uno board have the 3.3v pin
The Arduino UNO will put out 5V logic level signals. These signals do not convert the UNO 5V logic\GPIO signals to 3.3V levels just because you connect the LoRa module to the UNOs 3.3V power supply pin.
On some UNOs, the 3.3V pin cannot provide enough current for someting like a LoRa transmitter.
Using 3.3V logic Arduinos or Micros for 3.3V logic modules (such as LoRa) is heaps easier.
I did what you guys suggested using the logic level cobverter ....but it fail to initialize
Some logic level converters are not so good.
Much easier when using 3.3V modules to use 3.3V Microcontrollers\ Arduinos.
Hi, @lamshuwa
Can you post some images of your project?
So we can see your component layout.
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
Thanks.. Tom...
That LoRa library does not support SX1262 LoRa devices.
So i have been doing so far:
Firstly i use only the sx1262 module and arduino uno...Initialization was success and also i can send and receive although the rssi is terrible and the data received is gibberish
Then i learn that we need a logic level converter, and a voltage regulator, but when i connected all those it always fail to initialize even when checking the wiring and configuration many times...
Then i tried again like how i did the first time ...initialization success but this time i cannot receive data sending by the Transmitter
Library Used: RadioLib by jgromes
Example code from his github Sx126x_PingPong
Wire Configuration :
CS-10
CLK-13
MOSI-11
MISO-12
RESET-3
BUZY-9
DIO1-2