Feather 32U4 RFM95 LoRa Radiohead

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Talonsgrip
 
Posts: 16
Joined: Sun Feb 13, 2022 8:19 pm

Feather 32U4 RFM95 LoRa Radiohead

Post by Talonsgrip »

Hi everyone!
I'm a falconer and Adafruit/Lora/Arduino noob working on a telemetry setup for my Harris Hawk. I'm using two Adafruit Feather 32u4 RF 915 with Lora boards as my transmitter and receiver. I'll use the Radiohead library and Arduino IDE 2.0

I'm looking at the setup tutorial on the Adafruit site to set it all up. Can someone give me a hand with the tutorial? It looks like it works with 32u4 MO. Will it work with my boards? Any advice?

Thanks!
Matthew

User avatar
adafruit_support_carter
 
Posts: 29153
Joined: Tue Nov 29, 2016 2:45 pm

Re: Feather 32U4 RFM95 LoRa Radiohead

Post by adafruit_support_carter »

Which tutorial are you looking at? There's a dedicated guide for the 32u4 based LoRa Feather here:
https://learn.adafruit.com/adafruit-fea ... e/overview

Once you have Arduino configured and the basic Blink example working:
https://learn.adafruit.com/adafruit-fea ... nk-2854761
can then try the basic RX/TX example to test communications between two Feathers:
https://learn.adafruit.com/adafruit-fea ... m-9x-radio

User avatar
Talonsgrip
 
Posts: 16
Joined: Sun Feb 13, 2022 8:19 pm

Re: Feather 32U4 RFM95 LoRa Radiohead

Post by Talonsgrip »

I got the boards working with the blink sketch. When I attempt to verify the tx demo sketch, it gets stuck at...
// Singleton instance of the radio driver
RH_RF95 rf95(RFM95_CS, RFM95_INT);

The error says that RH_RF95 type is not defined.

Another interesting thing is that Arduino IDE 2.0 states 32u4 debugging is not supported. However, it does try to debug the Arduino code.

User avatar
Talonsgrip
 
Posts: 16
Joined: Sun Feb 13, 2022 8:19 pm

Re: Feather 32U4 RFM95 LoRa Radiohead

Post by Talonsgrip »

I'm also using 915 frequency on the boards.

User avatar
adafruit_support_carter
 
Posts: 29153
Joined: Tue Nov 29, 2016 2:45 pm

Re: Feather 32U4 RFM95 LoRa Radiohead

Post by adafruit_support_carter »

That sounds like a library install issue.

Did you download the zip file from the guide page and copy over the RH_RF95.cpp and RH_RF95.h files as indicated?
https://learn.adafruit.com/adafruit-fea ... le-2567678

User avatar
Talonsgrip
 
Posts: 16
Joined: Sun Feb 13, 2022 8:19 pm

Re: Feather 32U4 RFM95 LoRa Radiohead

Post by Talonsgrip »

Yes. I put them in the libraries folder

User avatar
Talonsgrip
 
Posts: 16
Joined: Sun Feb 13, 2022 8:19 pm

Re: Feather 32U4 RFM95 LoRa Radiohead

Post by Talonsgrip »

It must be that I didn't put the files correctly into their folders. I'll check when I'm at my computer.

User avatar
Talonsgrip
 
Posts: 16
Joined: Sun Feb 13, 2022 8:19 pm

Re: Feather 32U4 RFM95 LoRa Radiohead

Post by Talonsgrip »

OK... I'm working on the Feather 9x_TX sketch. I have the following errors:

C:\Users\Linda\Documents\Arduino\RH_RF95.h\Feather9x_TX.ino: In function 'void setup()':
C:\Users\Linda\Documents\Arduino\RH_RF95.h\Feather9x_TX.ino:54:13: error: 'rf95' was not declared in this scope
while (!rf95.init()) {
^~~~
C:\Users\Linda\Documents\Arduino\RH_RF95.h\Feather9x_TX.ino:54:13: note: suggested alternative: 'RF95'
while (!rf95.init()) {
^~~~
RF95
C:\Users\Linda\Documents\Arduino\RH_RF95.h\Feather9x_TX.ino:63:8: error: 'rf95' was not declared in this scope
if (!rf95.setFrequency(RF95_FREQ)) {
^~~~
C:\Users\Linda\Documents\Arduino\RH_RF95.h\Feather9x_TX.ino:63:8: note: suggested alternative: 'RF95'
if (!rf95.setFrequency(RF95_FREQ)) {
^~~~
RF95
C:\Users\Linda\Documents\Arduino\RH_RF95.h\Feather9x_TX.ino:76:3: error: 'rf95' was not declared in this scope
rf95.setTxPower(23, false);
^~~~
C:\Users\Linda\Documents\Arduino\RH_RF95.h\Feather9x_TX.ino:76:3: note: suggested alternative: 'RF95'
rf95.setTxPower(23, false);
^~~~
RF95
C:\Users\Linda\Documents\Arduino\RH_RF95.h\Feather9x_TX.ino: In function 'void loop()':
C:\Users\Linda\Documents\Arduino\RH_RF95.h\Feather9x_TX.ino:93:3: error: 'rf95' was not declared in this scope
rf95.send((uint8_t *)radiopacket, 20);
^~~~
C:\Users\Linda\Documents\Arduino\RH_RF95.h\Feather9x_TX.ino:93:3: note: suggested alternative: 'RF95'
rf95.send((uint8_t *)radiopacket, 20);
^~~~
RF95

exit status 1

Compilation error: 'rf95' was not declared in this scope

Here is my code:

Code: Select all

```cpp
// Feather9x_TX
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messaging client (transmitter)
// with the RH_RF95 class. RH_RF95 class does not provide for addressing or
// reliability, so you should only use RH_RF95 if you do not need the higher
// level messaging abilities.
// It is designed to work with the other example Feather9x_RX

#include <SPI.h>
#include <RH_RF95.h>

/* for feather32u4 
#define RFM95_CS 8
#define RFM95_RST 4
#define RFM95_INT 7
*/

#define RFM95_CS 8
#define RFM95_RST 4
#define RFM95_INT 7
// Change to 434.0 or other frequency, must match RX's freq!
#define RF95_FREQ 915.0

// Singleton instance of the radio driver

RH_RF95 RF95(RFM95_CS, RFM95_INT);

void setup() {
  
    pinMode(RFM95_RST, OUTPUT);
  digitalWrite(RFM95_RST, HIGH);

  Serial.begin(115200);
  while (!Serial) {
    delay(1);
  }

  delay(100);

  Serial.println("Feather LoRa TX Test!");

  // manual reset
  digitalWrite(RFM95_RST, LOW);
  delay(10);
  digitalWrite(RFM95_RST, HIGH);
  delay(10);
  (RFM95_RST, OUTPUT);
  digitalWrite(RFM95_RST, HIGH);

  Serial.begin(9600);
  delay(100);
  Serial.println("Feather LoRa RX Test!");

    while (!rf95.init()) {
    Serial.println("LoRa radio init failed");
    Serial.println("Uncomment '#define SERIAL_DEBUG' in RH_RF95.cpp for detailed debug info");
    while (1)
      ;
  }
  Serial.println("LoRa radio init OK!");

  // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM
  if (!rf95.setFrequency(RF95_FREQ)) {
    Serial.println("setFrequency failed");
    while (1)
      ;
  }
  Serial.print("Set Freq to: ");
  Serial.println(RF95_FREQ);

  // Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on

  // The default transmitter power is 13dBm, using PA_BOOST.
  // If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then
  // you can set transmitter powers from 5 to 23 dBm:
  rf95.setTxPower(23, false);
}

int16_t packetnum = 0;  // packet counter, we increment per xmission

void loop() {
  delay(1000);                        // Wait 1 second between transmits, could also 'sleep' here!
  Serial.println("Transmitting...");  // Send a message to rf95_server

  char radiopacket[20] = "Hello World #      ";
  itoa(packetnum++, radiopacket + 13, 10);
  Serial.print("Sending ");
  Serial.println(radiopacket);
  radiopacket[19] = 0;

  Serial.println("Sending...");
  delay(10);
  rf95.send((uint8_t *)radiopacket, 20);

  Serial.println("Waiting for packet to complete...");
  delay(10);
  rf95.waitPacketSent();
  // Now wait for a reply
  uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
  uint8_t len = sizeof(buf);

  Serial.println("Waiting for reply...");
  if (rf95.waitAvailableTimeout(1000)) {
    // Should be a reply message for us now
    if (rf95.recv(buf, &len)) {
      Serial.print("Got reply: ");
      Serial.println((char *)buf);
      Serial.print("RSSI: ");
      Serial.println(rf95.lastRssi(), DEC);
    } else {
      Serial.println("Receive failed");
    }
  } else {
    Serial.println("No reply, is there a listener around?");
  }
}
```
Can anyone help me with this? Thanks!

User avatar
Talonsgrip
 
Posts: 16
Joined: Sun Feb 13, 2022 8:19 pm

Re: Feather 32U4 RFM95 LoRa Radiohead

Post by Talonsgrip »

I still can't figure out why RF95 is not declared

User avatar
adafruit_support_carter
 
Posts: 29153
Joined: Tue Nov 29, 2016 2:45 pm

Re: Feather 32U4 RFM95 LoRa Radiohead

Post by adafruit_support_carter »

The full path location here looks odd:

Code: Select all

 C:\Users\Linda\Documents\Arduino\RH_RF95.h\Feather9x_TX.ino: In function 'void setup()':
It looks like you have a folder named "RH_RF95.h" in your Arduino sketchbook folder "C:\Users\Linda\Documents\Arduino".

Library files should be located under a folder named "C:\Users\Linda\Documents\Arduino\libraries".

Try adding the library a different way. Once you've downloaded the ZIP, add it with the menu option:
Sketch>Include Library>Add .ZIP Library...
and select the downloaded zip file.

User avatar
Talonsgrip
 
Posts: 16
Joined: Sun Feb 13, 2022 8:19 pm

Re: Feather 32U4 RFM95 LoRa Radiohead

Post by Talonsgrip »

Fixed! Thanks!
All compiles, uploads, and talks on serial.

Next issue:
I've got the Feather 32u4 RFM95 Lora receiver connected to its Android smart phone via a usb data cable. I'm using Locus Map (silver edition) with offline maps installed. I can't get to get the Locus app to see my receiver or transmitter. Any idea how to set it up? Is there a better map app for this?

I don't need to register on the TNN network, do I?

User avatar
TI545
 
Posts: 98
Joined: Tue Feb 27, 2018 5:25 pm

Re: Feather 32U4 RFM95 LoRa Radiohead

Post by TI545 »

That is a very different question. Maybe I'm not understanding what you're trying to do, but, LoRa doesn't have any mapping/GPS capabilities built in.

If you are trying to map where your LoRa device is, yes, TTN does have a (external) system TTNmapper that can do that, and yes, to use that you'd have to use LoRaWAN (not just simple LoRa) and join TTN. *But*, the 32u4 RFM95 is deprecated on TTN v3. (at least, I haven't gotten it to work, someone, please correct me and explain how, if I'm wrong) You would need an adafruit feather M0 RFM95 to work with TTN v3. And then get the TTNmapper integration working.

User avatar
Talonsgrip
 
Posts: 16
Joined: Sun Feb 13, 2022 8:19 pm

Re: Feather 32U4 RFM95 LoRa Radiohead

Post by Talonsgrip »

The offline maps are used with a LoRa transmitter, receiver and cell phone. The receiver is connected to the cell phone via an OTG data cable.

The offline map app only receives the packet data from the Lora gateways, interprets it, and plots the location of the Lora transmitter on its map.

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”