<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[LoRaWAN EU868 RAK3172(H) program issue]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">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<br />
This error appears to come from a library that is automatically added when I configure the RAK module's pins.</p>
<p dir="auto">While searching for a solution, I visited the product's documentation page:</p>
<ul>
<li><a href="https://docs.m5stack.com/en/unit/Unit%20LoRaWAN-EU868" target="_blank" rel="noopener noreferrer nofollow ugc">https://docs.m5stack.com/en/unit/Unit LoRaWAN-EU868</a><br />
There, it states that UIFlow1 and UIFlow2 support is coming soon — meaning it’s not currently available.</li>
</ul>
<p dir="auto">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.</p>
<p dir="auto">According to the official documentation, the library to use is the one following :</p>
<ul>
<li><a href="https://github.com/m5stack/M5-LoRaWAN-RAK" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/M5-LoRaWAN-RAK</a></li>
</ul>
<p dir="auto">The example I tried to compile was:<br />
Examples &gt; LoRaWAN &gt; OTAA,<br />
with the correct pin configuration and OTAA identification (DevEUI, AppEUI, AppKey).</p>
<p dir="auto">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) :</p>
<hr />
<p dir="auto">#include &lt;Wire.h&gt;<br />
#include &lt;M5Unified.h&gt;<br />
#include &lt;M5UnitKmeterISO.h&gt;<br />
#include "rak3172_lorawan.hpp"<br />
#include &lt;string.h&gt;</p>
<p dir="auto">RAK3172LoRaWAN lorawan;<br />
M5UnitKmeterISO kmeter;</p>
<p dir="auto">// Définir les paramètres OTAA<br />
#define DEVEUI "<em><strong><strong><strong><strong>"<br />
#define APPEUI "</strong></strong></strong></strong></em>"<br />
#define APPKEY "*********"</p>
<p dir="auto">// Déclaration des broches pour LoRa<br />
#define TX 15<br />
#define RX 13</p>
<p dir="auto">void joinCallback(bool status)<br />
{<br />
if (status) {<br />
Serial.println("[LoRaWAN] Join réseau réussi !");<br />
} else {<br />
Serial.println("[LoRaWAN] Échec de la jonction !");<br />
}<br />
}</p>
<p dir="auto">void sendCallback()<br />
{<br />
Serial.println("[LoRaWAN] Envoi confirmé par le serveur");<br />
}</p>
<p dir="auto">void errorCallback(char* error)<br />
{<br />
Serial.print("[LoRaWAN] Erreur : ");<br />
Serial.println(error);<br />
}</p>
<p dir="auto">void setup() {<br />
M5.begin();<br />
Serial.begin(115200);</p>
<pre><code>// Initialisation du capteur KMeterISO
Wire.begin(9, 7);  // Utilisation des broches spécifiques pour I2C (SCL, SDA)
while (!kmeter.begin(&amp;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(&amp;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.");
</code></pre>
<p dir="auto">}</p>
<p dir="auto">void loop() {<br />
M5.update();</p>
<pre><code>// 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
</code></pre>
<p dir="auto">}</p>
]]></description><link>https://community.m5stack.com/topic/7548/lorawan-eu868-rak3172-h-program-issue</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 04:00:20 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/7548.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 05 May 2025 13:54:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to LoRaWAN EU868 RAK3172(H) program issue on Sat, 12 Jul 2025 08:44:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/charlesrd" aria-label="Profile: charlesRD">@<bdi>charlesRD</bdi></a> I also found this to be a problem with UiFlow2, and found that the unit <strong>init</strong>.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.</p>
]]></description><link>https://community.m5stack.com/post/29469</link><guid isPermaLink="true">https://community.m5stack.com/post/29469</guid><dc:creator><![CDATA[mikeluyten]]></dc:creator><pubDate>Sat, 12 Jul 2025 08:44:32 GMT</pubDate></item><item><title><![CDATA[Reply to LoRaWAN EU868 RAK3172(H) program issue on Wed, 07 May 2025 13:58:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/charlesrd" aria-label="Profile: charlesRD">@<bdi>charlesRD</bdi></a> said in <a href="/post/29033">LoRaWAN EU868 RAK3172(H) program issue</a>:</p>
<blockquote>
<p dir="auto">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.</p>
</blockquote>
]]></description><link>https://community.m5stack.com/post/29036</link><guid isPermaLink="true">https://community.m5stack.com/post/29036</guid><dc:creator><![CDATA[charlesRD]]></dc:creator><pubDate>Wed, 07 May 2025 13:58:29 GMT</pubDate></item></channel></rss>