LoRa RFM95 with Arduino Nano

I intend to turn an Led remotely by LoRa rfm95 and Arduino nano, set up the circuit and the 3.3 volt supply from
5v source of the nano by a 3.3 regulator.
the program runs up to the code " LoRa.beginPacket();" and stops there with no message or error,So transmitter
dose not transmit any thing.
Will some one help me in this promlem please?
Here is the code for Transmitter:

#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(915E6)) { // 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);
  Serial.print("value sent is ");
  Serial.println(val);  
  LoRa.beginPacket(); 
  LoRa.print(val);
  LoRa.endPacket();
  delay(50);
 
}

This is the code for receiver:

#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(915E6)) { // 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(); 
    //analogWrite(LED, HIGH);   
  }
   Serial.print("value is ");    
  Serial.println(val);  
  analogWrite(LED, val);
 
}

the image of the project:( both trans, and recei are the same)

This project has been copied from this link
"Interfacing SX1278 Ra-02 LORA Module with Arduino"
He has used sx1278 ,but mine is sx1276 with frequency of 915 mhz.

Can you communicate with the module - i.e. write to registers to configure it. Did you check if the module initialization code returned any errors?

What logic level conversion are you using between the 5V logic Level Nano and the 3.3V logic level LoRa device ?

Failure to use logic level conversion between the LoRa device and the Nano can exceed the maximum voltages specified for the LoRa device, so it may already be fried.

The Nano has a current capacity of 50mA on the 3.3V pin which is unlikley to be enough to power the LoRa device as a transmitter.

The attached program (too big to post) will check you have the connections to the LoRa device correct, but only use it when you have connected the LoRa device with appropriate logic level conversion components. No library install needed and it does not attempt the transmit or receive.

2_Register_Test.ino (9.01 KB)

Thank you for your help.
I downloaded the test program and got the same register data as mentioned in the commented section of the program.
So it means the connections and the Lora is ok?
For level conversion I used a 3.3 v regulator and in puted from 5 v of arduino nano,and connected the out put of the regulator to 3.3v pin of LoRa.
What else should I do?

For level conversion I used a 3.3 v regulator and in puted from 5 v of arduino nano,

that's power for SX1276, not level conversion for SPI signals !!
SX1276 needs 3V3 level signals, not 5V as those coming from Nano board.

Direct wiring between Nano and SX1276 is not a good idea, ok for 8Mhz 3V3 Pro Micro.

raminaziz:
For level conversion I used a 3.3 v regulator and in puted from 5 v of arduino nano,and connected the out put of the regulator to 3.3v pin of LoRa.

Thats not 'Logic Level Conversion' at all.

Try a Google search on 'Arduino Logic Level Conversion' for some hints.

Ok ,I will put a level converter to this circuit, but I am just wondering why in that link I mentioned , the guy has not used any of these convertors?

raminaziz:
Ok ,I will put a level converter to this circuit, but I am just wondering why in that link I mentioned , the guy has not used any of these convertors?

Because they do not know what they are doing ?

Just because something appears to work (for a while) it does not mean its to specification.

One last question:
I got a 4 channel level converter ,but I have 6 pins in Lora module, Mo, Mi, Sck, Nss, ,Dio0, and Reset.
which of the 6 pins need to be connected to level converter?

raminaziz:
which of the 6 pins need to be connected to level converter?

All of them is the right answer.

You might get it working by connectin the output pins of the LoRa device, MISO and DIO0 to the 5V Arduino.

I have found cheapo logic level conversion devices very marginal, the logic signals are very poor when looked at on scope, only just working really.

Far better not to use 5V Arduinos at all, with LoRa devices.

You might get it working by connectin the output pins of the LoRa device, MISO and DIO0 to the 5V Arduino.

Thank you for your help .
I did connect as you suggested, but it gave error.
So I connected Mi of LoRa to Mi of Arduino ,directly and DI0 to 5v,And it worked.
Just to help others.

So I connected Mi of LoRa to Mi of Arduino ,directly and DI0 to 5v,And it worked.

I get that "Mi" probably means the MISO signal. BUT DI0 to 5v?

I guess you meant DIO0 which is (unless configured differently) the interrupt output from the RFM95 module. If that's correct, then you should either leave DIO0 unconnected or connect it to one of the interrupt pins on the Arduino. If I recall correctly, the RFM95 libraries I've used in the past have all needed the interrupt signal from the RFM95 module connected in order to work.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.