• LoRa/LoRaWAN, M5Stack, MicroPython
    2 min | 715

    #M5Stack: LoRaWAN and MicroPython on the 'Fire'

    LoRa/LoRaWAN, M5Stack, MicroPython | 2 min | 715

    I've just updated the LoRa/LoRaWAN repository for MicroPython and added a configuration that works on the M5Stack Fire using the LoRa868 Module. Therefore, this will help you connect the M5Stack Fire to the "The Things Network (TTN)"!

    If you're new to MicroPython read this tutorial: Tutorial: Getting Started with MicroPython on ESP32, M5Stack, and ESP8266If you want to know more about the LoRaWAN and MicroPython, read this article: Tutorial: ESP32 running MicroPython sends data over LoRaWAN

    Hardware and Software

    The following hardware and software will be used in this article.


    You can combine the M5Stack Fire with a LoRa868 module and M5GO/FIRE base to make a portable LoRaWAN node (see Fig. 1). Fig. 2 shows that the LoRa868 module has a Ra-01 chip (sx127x), and it can be used using the lemariva/uPyLoRaWAN repository. As I mentioned before, I've just updated the repository. The application, board, and LoRa/LoRaWAN settings are now in a single config file. Therefore, follow these steps to deploy the app on your M5Stack Fire:

    1. Clone the uPyLoRaWAN repository:
      git clone https://github.com/lemariva/uPyLoRaWAN.git -b LoRaWAN
    2. Rename the file config.sample.py to config.py
    3. Configure the SPI pins to connect to the SX127x module. I've included the following example connections:
    4. Configure the LoRaWAN settings (devaddr, nwkey, app, and country) as described here
    5. Upload the code to the M5Stack using VSCode as explained in this tutorial
    M5Stack LoRa Module
    Fig. 1: M5Stack Fire with a LoRa868 module and a M5GO base.
    M5Stack LoRa Module
    Fig. 2: RA-01 LoRa chip (sx127x)
    The downlink (from TTN to the device) is not working for me right now, but I don't know if it is my gateway forwarder or the M5Stack. If you can test the code on an M5Stack connected to a different gateway and it works, please write a comment! The decryption on the ESP32 of the "downlinked" packages is still in my ToDo list.