🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Blue Lorawan Module

    Scheduled Pinned Locked Moved PRODUCTS
    3 Posts 2 Posters 9.2k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • qlionQ Offline
      qlion
      last edited by

      Hi

      Is there a example to connect a M5stack to the TTN network?

      https://m5stack.github.io/m5-docs/#/en/product_documents/modules/module_lorawan

      Thanks.

      m5-docsM 1 Reply Last reply Reply Quote 0
      • m5-docsM Offline
        m5-docs @qlion
        last edited by

        @qlion
        Sorry, we do not have example about TTN

        M5Stack documentation URL

        https://docs.m5stack.com

        1 Reply Last reply Reply Quote 0
        • qlionQ Offline
          qlion
          last edited by

          Hi

          I managed to get connected with the following.

          Thanks

          #include <M5Stack.h>

          HardwareSerial Serial2(2);

          int period = 158000;
          unsigned long time_now = 0;

          String cmd_DEF = "AT+FDEFAULT";
          String cmd_OTTA_mode = "AT+MODE=LWOTAA";
          String cmd_DevEui = "AT+ID=DevEui";
          String cmd_JOIN = "AT+JOIN=FORCE";
          String cmd_send_data = "AT+MSG="Data to send"";

          void setup() {

          M5.begin();
          Wire.begin();
          // Lcd display
          M5.Lcd.setBrightness(100);
          M5.Lcd.fillScreen(BLACK);
          M5.Lcd.setCursor(10, 10);
          M5.Lcd.setTextColor(WHITE);
          M5.Lcd.setTextSize(1);
          M5.Lcd.printf("LoraWAN Network");
          delay(300);
          M5.Lcd.fillScreen(BLACK);
          delay(150);
          M5.Lcd.setCursor(0, 10);
          M5.Lcd.fillScreen(BLACK);
          for(int i=0; i<200; i++) {
          M5.Lcd.setBrightness(i);
          delay(2);
          }

          Serial.begin(115200);

          Serial2.begin(9600, SERIAL_8N1, 16, 17);
          Serial2.flush();
          /* LoRaWAN Init */
          M5.Lcd.println("Setting up the LoraWAN Connetion");
          Serial2.println(cmd_DEF);
          delay(2000);
          Serial2.println(cmd_OTTA_mode);
          delay(1000);
          Serial2.println(cmd_DevEui);
          delay(1000);
          Serial2.println(cmd_OTTA_mode);
          delay(3000);
          M5.Lcd.println("Joining Network.");
          Serial2.println(cmd_JOIN);
          delay(3000);
          M5.Lcd.println("Message will be send in 155000ms, when next Band is availible");
          }

          void loop() {
          if(millis() > time_now + period){
          time_now = millis();
          M5.Lcd.println("Sending Data.");
          Serial2.println(cmd_send_data);
          }
          if(Serial2.available()) {
          int ch = Serial2.read();
          Serial.write(ch);
          }
          }

          1 Reply Last reply Reply Quote 0

          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
          • First post
            Last post