Skip to content

M5StickC with BG96#

Integrate your ESP32-based device with Quectel BG96 module to manage it via Coiote IoT DM.

Prerequisites#

  • An M5StickC device.
  • A BG96 module with internet connection (it is strongly recommended to have a BG96 with firmware version BG96MAR03A06M1G).
  • Installed ESP-IDF and dependencies (installation steps 1-4 from ESP32 official documentation). Supported ESP-IDF version is v4.4.
  • A user with access to the Coiote IoT Device Management platform.

Step 1: Prepare project#

  1. Create a project directory for the integration.
  2. Open a command line interface and run git clone https://github.com/AVSystem/Anjay-esp32-client --recursive.
  3. Run . $HOME/esp/esp-idf/export.sh and idf.py set-target esp32.
  4. Open the menuconfig with the idf.py menuconfig command, navigate to Component config -> anjay-esp32-client.
    • In Choose targeted development board, select M5StickC from the list of supported boards.
    • In Choose an interface, select External BG96 module.
    • In BG96 module configuration, specify the UART port, Tx pin and Rx pin for the BG96 module. Example port and pin numbers are provided in the screenshot below. BG96 UART example configuration
    • In Client options, provide device credentials and Server URI:
      • Endpoint name - your device endpoint name
      • Server URI - the address and port of your Coiote IoT DM installation, e.g. coaps://eu.iot.avsystem.cloud:5684
      • Security mode - the PSK security mode
      • PSK configuration - the PSK identity and PSK key
    • In the Connection configuration, set APN name to internet for the sake of this tutorial. However, APN name depends on your SIM card operator.
    • Press s on the keyboard to Save the configuration.

Step 2: Connect BG96 module to a M5StickC#

Connect the Tx, Rx and GND pins, respectively, to the M5StickC pins selected in the previous step on the basis of the following example connection:

M5StickC and BG96 pinout

  • M5Stick GND > BG96 6 GND
  • M5Stick G26 > BG96 10 UART Rx
  • M5Stick G0 > BG96 8 UART Tx

Step 3: Add device to Coiote IoT DM#

To connect your M5StickC to the Coiote IoT Device Management platform, use your access to a Coiote IoT DM installation, or register at https://eu.iot.avsystem.cloud/ to get access.

To connect the board, log in to the platform and follow onboarding guide.

Step 4: Flash M5StickC#

  1. Connect the M5Stick board to a USB port of your machine.
  2. Open the command line interface, go to your project directory, and run idf.py -b 750000 flash monitor.

Next steps#

If you want to develop your own LwM2M-enabled application based on M5Stick, check Anjay-esp32-client and start prototyping!