ESP32 and LoRa

malcmail
Posts: 6
Joined: Tue May 16, 2023 1:56 pm

Re: ESP32 and LoRa

Postby malcmail » Mon May 22, 2023 9:21 am

The tutorial has it linking to a Seeeduino Lotus. Tried it on an Arduino Uno, Hero and Seeeduino v4 but all the same issue. not sure about it working by itself. As you say everything else I've seen involves more than the Groves but the board doesn't have a DIO pin so hadn't tried any other way. I'll take a look at the other forum - hadn't spotted that. thanks for the help.

a2800276
Posts: 78
Joined: Sat Jan 23, 2016 1:59 pm

Re: ESP32 and LoRa

Postby a2800276 » Mon May 22, 2023 4:22 pm

Unfortunately the seeed docs are crap. I think they just had some intern make up something.

You are absolutely correct that the Grove connector provides a UART. If you have a look at the schematics linked in the datasheet, though, the grove connector is connected to the ATMega processor not the actual Lora module (RFM98 on the schematic). The RFM module, in turn, is connected to the Atmega via SPI. The way I'm piecing things together is that the intended use of the Grove connector is to hook up some sensors that the Atmega can query and send send the sensor readings via the Lora radio.

I think the documentation they provided is pure bullshit: they suggest you can use the whole thing as a Lora Radio and use the Radiohead RFM driver code to connect to it. I can't see how that can possibly work, because the Radiohead library expects a RFM9x module connected via SPI and not a Grove module connected via UART. Maybe they're providing a custom very of the Lora library that can connect to firmware running on the ATMega!?

a2800276
Posts: 78
Joined: Sat Jan 23, 2016 1:59 pm

Re: ESP32 and LoRa

Postby a2800276 » Mon May 22, 2023 4:34 pm

So, I had a closer look at the Arduino code that seed provides and the situation is stupider than I expected.

While all the names (e.g. the header named Radiohead.h and the RH_ prefixes) suggest they are using the Radiohead library they are in fact using their own dumb, bastardized, undocumented, unsupported version. Which does connect via UART because they wrote some weird UART protocol that wraps the actual SPI calls to the module in serial messages passed via UART.

If you're wondering why: I assume the reason is that they want to cram their stupid grove connector down everyone's throat and because it's limited to 2 data pins it can't even do standard SPI, let alone handle Semtech's 5 interrupt lines (all but one of which are unnecessary).

Sorry I don't have better news, I had no idea it would be this dumb. Honestly a bit disappointed in seeed.

westman
Posts: 1
Joined: Thu May 25, 2023 2:28 pm

Re: ESP32 and LoRa

Postby westman » Thu May 25, 2023 2:46 pm

I have a working ESP32/LoRa prototype using the hardware linked below. You mentioned problems with initialization. Please see my init function below. Not sure if this ports to your hardware. Hope this helps.

Regards, Mark

https://www.adafruit.com/product/3591
https://www.adafruit.com/product/3072
  1. /******************************************************************************
  2.  * Includes
  3.  *******************************************************************************/
  4. #include <RH_RF95.h>
  5.  
  6. #include "hal/radio.hpp"
  7.  
  8. /******************************************************************************
  9.  * Macro defines
  10.  *******************************************************************************/
  11. #define RFM95_CS 27
  12. #define RFM95_RST 13
  13. #define RFM95_INT 12
  14. #define RF95_FREQ 915.0
  15.  
  16. RH_RF95 rf95(RFM95_CS, RFM95_INT);
  17.  
  18. /******************************************************************************
  19.  * Function Definitions
  20.  *******************************************************************************/
  21. void initializeRadio(void)
  22. {
  23.     pinMode(RFM95_RST, OUTPUT);
  24.     digitalWrite(RFM95_RST, HIGH);
  25.     delay(10);
  26.     digitalWrite(RFM95_RST, LOW);
  27.     delay(10);
  28.     digitalWrite(RFM95_RST, HIGH);
  29.     delay(10);
  30.  
  31.     while (!rf95.init())
  32.     {
  33.         Serial.println("LoRa radio init failed");
  34.         while (1)
  35.             ;
  36.     }
  37.     Serial.println("LoRa radio init OK!");
  38.  
  39.     if (!rf95.setFrequency(RF95_FREQ))
  40.     {
  41.         Serial.println("setFrequency failed");
  42.         while (1)
  43.             ;
  44.     }
  45.     Serial.print("Set Freq to: ");
  46.     Serial.println(RF95_FREQ);
  47.  
  48.     // Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on
  49.  
  50.     // The default transmitter power is 13dBm, using PA_BOOST.
  51.     // If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then
  52.     // you can set transmitter powers from 5 to 23 dBm:
  53.     rf95.setTxPower(23, false);
  54. }

Who is online

Users browsing this forum: No registered users and 46 guests