Lora Module ASR6501 with Arduino



  • 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();
    }
    }



  • 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



  • 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



  • 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



  • @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.



  • 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