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

    Lora Module ASR6501 with Arduino

    Modules
    7
    10
    12.1k
    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.
    • F
      Filq
      last edited by

      Hi,

      I'm working on my first Arduino project using LoraWAN8688 ASR6501 M5 module. I would like left nano to send message, and right nano to receive and read it.

      I think however, that my Lora module must be configured before it will send and receive data from Arduino. I don't know even how to send it it

      How can I send AT+ commands to the LORA module to configure it? Do I need any additional cables or connectors, or can I use Arduino to set it up?

      Can I use Serial.println("AT+ADDRESS=1"); to set address via andruino?

      alt text

      RECEIVER CODE:
      String incomingString;

      void setup() {
      // put your setup code here, to run once:
      Serial.begin(9600);
      Serial.println("AT+ADDRESS=3");
      }

      void loop() {
      // put your main code here, to run repeatedly:
      if(Serial.available()){
      incomingString = Serial.readString();
      if (incomingString.indexOf("TeamA") >0){
      delay(500);
      }
      }
      }

      TRANSMITTER CODE:
      unsigned long lastTransmission;
      const int interval = 1000;

      void setup() {
      // put your setup code here, to run once:
      Serial.begin(9600);
      Serial.println("AT+ADDRESS=2");
      }

      void loop()
      {
      if (millis() > lastTransmission + interval) {
      Serial.println("AT+SEND=1,6,TeamA");
      delay(2000);
      lastTransmission = millis();
      }
      }

      C 1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by felmue

        Hello @Filq

        looking at the LoRaWAN Unit 868 documentation and its AT commands I think these units can only be setup and used for LoRaWAN (e.g. connecting to some cloud like TTN) and not for LoRa (e.g. point to point connection). Also in above mentioned documentation I cannot find the AT+ADDRESS= command - where did you find that?

        But yes, you should be able to use an Arduino to setup your units using Serial.println() and the AT commands from above AT commands documentation.

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        1 Reply Last reply Reply Quote 0
        • F
          Filq
          last edited by

          Hi @felmue ,

          Thanks for fast reply.

          From what I read online LoraWAN units can be used as Lora units, but Lora units can not be used as LoraWAN. I hope it is the case here as well!

          I thought that AT commands are standardized and I used something found in online tutorial. IT turned out they are not and I went through your documentation briefly.

          Using documentation provided by you I changed Tx command to:
          Serial.println("AT+DTRX=1,2,10,012345");
          As well set boundrate at the beginning of the program by:
          Serial.println("AT+CGBR=9600");

          Sadly it made no difference. I still can not see Rx diode to flash on the receiver unit and only Tx on the transmitter.

          There is long example code made by the manufacturer, but it uses libraries I can not find and have no clue how to use them.

          https://github.com/m5stack/M5Stack/blob/master/examples/Unit/LoRaWAN868/LoRaWAN868.ino

          1 Reply Last reply Reply Quote 0
          • felmueF
            felmue
            last edited by felmue

            Hello @Filq

            Yes, you are correct, most LoraWAN ICs can be used for both, Lora and LoraWAN. That said, the M5Stack LoraWAN unit internally uses a Ai-Thinker Ra-07/Ra-07H module as you can see from the schematic. This module contains the ASR6501 which integrates LoRa with an MCU. The Lora part most likely can do both, Lora and LoraWAN, however the AT commands implemented into the MCU firmware seem to only support LoraWAN. (I don't have the LoraWAN unit, so I cannot verify this myself. My conclusion is based on the AT commands datasheet and could be wrong.)

            Some AT commands are standardized but each vendor is free to implement whatever AT commands it sees fit for a given device. Therefore you'll need to consult the AT commands datasheet the vendor provides for a given device.

            The AT+DTRX command can only be used after joining the LoraWAN network. See notice at the bottom of the command description: Notice: It is need to first join into the network, then send data later.

            The example code is made for an M5Stack (which has an LCD display). You don't need most of the code, just concentrate on the AT commands. But beware, this example is for LoraWAN (and not Lora).

            BTW: My previous help regarding sending commands was most likely incorrect. You probably need to use the second serial interface, e.g. Serial2. Serial normally is used to program the Arduino and get debug output. Sorry about that.

            Thanks
            Felix

            GPIO translation table M5Stack / M5Core2
            Information about various M5Stack products.
            Code examples

            F 1 Reply Last reply Reply Quote 1
            • F
              Filq @felmue
              last edited by

              @felmue

              Thanks Felix for explaining all of it in plain English for me. I will check if there is a IoT in my are and try connect with it.

              It's a good lesson as well - always read full documentation and make sure you will be able to and know how to use parts for your project.

              1 Reply Last reply Reply Quote 0
              • K
                kd4pba
                last edited by

                I'm just getting started with a ASR6501 UART version of Lorawan with a WioD51R.
                Kinda in the same boat looking for some simple code examples.

                Not sure if you saw this, might be helpful at least for a list of AT commands.
                https://www.hoperf.com/data/upload/back/20190605/ASR6501_ASR6502_QA.pdf

                1 Reply Last reply Reply Quote 0
                • C
                  christianc @Filq
                  last edited by

                  @filq
                  Hi,
                  After a long time, I succeeded to transmit a signal directly between 2 lorawan units without going through a router. but without being able to pass data
                  My configuration: 2 m5stack core + 2 lorawan unit, identical program.
                  I use the test functions:
                  the first m5stack, button A: "AT+CTX=868123000,0,22\r\n"
                  the second m5stack, button B: "AT+CRX=868123000,0\r\n"
                  or vice versa, it works.

                  Bonne journée

                  Christian

                  void setup()
                  {
                  init();
                  M5.Lcd.print("start\r\n");
                  Serial2.begin(115200, SERIAL_8N1, RX_PIN, TX_PIN); //Serial port 2 initialization
                  delay(500);
                  if (LoraWaitMsg(200))Serial.println(response);
                  LoraSendCmd("AT+CGSN?\r\n");// read serial number, optional
                  if (LoraWaitMsg(200))Serial.println(response);
                  }

                  void loop()
                  {
                  if (M5.BtnA.wasPressed())
                  {
                  M5.Lcd.print("send tx \r\n");
                  LoraSendCmd("AT+CTX=868123000,0,22\r\n");// set tx test
                  if (LoraWaitMsg(200))Serial.println(response);
                  }

                  if (M5.BtnB.wasPressed())
                  {
                  M5.Lcd.print("receive rx \r\n");
                  LoraSendCmd("AT+CRX=868123000,0\r\n");// set rx test
                  if (LoraWaitMsg(200))Serial.println(response);
                  }

                  if (M5.BtnC.wasPressed())
                  {
                  M5.Lcd.clear();
                  DispBtn();
                  M5.Lcd.setCursor(0, 10);
                  }

                  if (LoraWaitMsg(200))
                  {
                  M5.Lcd.clear();
                  M5.Lcd.setCursor(0, 10);

                  Serial.println(response);
                  M5.Lcd.print("receive : ");
                  M5.Lcd.print(response + "\r\n");
                  

                  }
                  delay (100);
                  M5.update();
                  }

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    sasoo @christianc
                    last edited by

                    @christianc hello what do you mean by this variable LoraWaitMsg ??

                    E 1 Reply Last reply Reply Quote 0
                    • E
                      emfivestacker @sasoo
                      last edited by emfivestacker

                      @sasoo The code by christianc is incomplete and does not work

                      The AT+CRX and AT+CTX are test commands, not meant for this application, and take your asr6501 in a dead loop, see documentation

                      When doing this with an antenna connected, you might transmit without knowing you do, and cause interference for others

                      In fact it seems Peer to Peer LoRa with asr6501 is not possible, it is designed for only LoRaWan, if I am not mistaken...

                      from documentation:
                      Notice, When enter into CTX Test, system enter into dead-loop, if you need other test then reboot the board for the next other test command.
                      from documentation:
                      Notice, When enter into CRX Test, system enter into dead-loop, if you need other test then reboot the board for the next other test command.

                      1 Reply Last reply Reply Quote 0
                      • M
                        markram14
                        last edited by

                        Did someone make Lora work for asr6501?
                        i bought multiple lorawan470 units and feel i am headed nowhere.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post