LoRaWAN EU868 RAK3172(H) program issue
-
Hello,
I’m encountering an issue while using the LoRaWAN EU868 RAK3172(H). I created a program to read temperature data using a KMeterISO sensor in UIFlow2, which works perfectly with the older and simpler LoRaWAN868 ASR6501. However, when I switched to the RAK module and updated the configuration in the "Unit" section of UIFlow2, I encountered the following error: AttributeError: LoRaWANUnit_RUI3
This error appears to come from a library that is automatically added when I configure the RAK module's pins.While searching for a solution, I visited the product's documentation page:
- https://docs.m5stack.com/en/unit/Unit LoRaWAN-EU868
There, it states that UIFlow1 and UIFlow2 support is coming soon — meaning it’s not currently available.
As a result, I decided to switch to the Arduino IDE. I downloaded the appropriate library and attempted to run an example program, but even the basic example fails to work with this module, i got stuck in the 1st while loop.
According to the official documentation, the library to use is the one following :
The example I tried to compile was:
Examples > LoRaWAN > OTAA,
with the correct pin configuration and OTAA identification (DevEUI, AppEUI, AppKey).So i try on my own a program but here again, i got stuck in the 1st while loop again. Here's the program that i can compile but not working (I know the OTAA identification is not submit here) :
#include <Wire.h>
#include <M5Unified.h>
#include <M5UnitKmeterISO.h>
#include "rak3172_lorawan.hpp"
#include <string.h>RAK3172LoRaWAN lorawan;
M5UnitKmeterISO kmeter;// Définir les paramètres OTAA
#define DEVEUI ""
#define APPEUI ""
#define APPKEY "*********"// Déclaration des broches pour LoRa
#define TX 15
#define RX 13void joinCallback(bool status)
{
if (status) {
Serial.println("[LoRaWAN] Join réseau réussi !");
} else {
Serial.println("[LoRaWAN] Échec de la jonction !");
}
}void sendCallback()
{
Serial.println("[LoRaWAN] Envoi confirmé par le serveur");
}void errorCallback(char* error)
{
Serial.print("[LoRaWAN] Erreur : ");
Serial.println(error);
}void setup() {
M5.begin();
Serial.begin(115200);// Initialisation du capteur KMeterISO Wire.begin(9, 7); // Utilisation des broches spécifiques pour I2C (SCL, SDA) while (!kmeter.begin(&Wire, KMETER_DEFAULT_ADDR)) { Serial.println("Capteur KMeterISO non trouvé !"); delay(1000); // Attente avant de réessayer } Serial.println("Capteur KMeterISO initialisé."); // Initialisation du module LoRaWAN while (!lorawan.init(&Serial2, RX, TX, RAK3172_BPS_115200)) { Serial.println("[Init] Failed to initialize module, retrying..."); delay(1000); } Serial.println("Module LoRaWAN initialisé."); // Configuration LoRaWAN lorawan.onJoin(joinCallback); lorawan.onSend(sendCallback); lorawan.onError(errorCallback); // Configurer OTAA lorawan.setOTAA(DEVEUI, APPEUI, APPKEY); // Tentative de jonction au réseau LoRaWAN if (lorawan.join(true, false, 10, 10)) { Serial.println("Start Join..."); } else { Serial.println("Join Fail"); } // Configuration du mode LoRaWAN lorawan.setMode(CLASS_A); lorawan.setLinkCheck(ALLWAYS_LINKCHECK); lorawan.setDR(4); // Data Rate DR4 Serial.println("Initialisation terminée.");}
void loop() {
M5.update();// Lire la température du capteur KMeterISO float temp = kmeter.getCelsiusTempValue() / 100.0; Serial.printf("Température du capteur: %.2f °C\n", temp); // Préparer le message à envoyer String message = "Temp: " + String(temp, 2) + " °C"; // Envoyer le message via LoRaWAN if (lorawan.send(message)) { Serial.println("Données envoyées avec succès !"); } else { Serial.println("Échec de l'envoi des données."); } delay(15000); // Attente de 15 secondes avant de lire et envoyer à nouveau}
- https://docs.m5stack.com/en/unit/Unit LoRaWAN-EU868
-
@charlesRD said in LoRaWAN EU868 RAK3172(H) program issue:
As a result, I decided to switch to the Arduino IDE (even if i wanted to stick with UIFlow2). I downloaded the appropriate library and attempted to run an example program, but even the basic example fails to work with this module, i got stuck in the 1st while loop.
-
@charlesRD I also found this to be a problem with UiFlow2, and found that the unit init.py file is missing the required entry for the LoRaWAN module. I have raised an issue in Github, and submitted a pull request to get it fixed.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login