mDash QuickStart for ESP-IDF

This guide describes how to connect a ESP32 device using ESP-IDF to mDash.

Prerequisites

  • Install ESP-IDF framework by following the ESP-IDF guide
  • Create a project, build and flash it on ESP32 device

So, you have an ESP-IDF project successfully built and flashed on your ESP32 device. Now it is time to get your device managed via mdash.net.

Process

  1. Login to https://mdash.net
  2. On the "Devices" tab, click on "add device" button to add a new device
  3. Click on a device settings link. A management dialog should appear
  4. Click on a device token to copy it to the clipboard
  1. Make sure you use ESP-IDF release 3.2. Go to the ESP-IDF directory, and branch the 3.2 release:

    git checkout -b v3.2 v3.2
    git submodule update --init --recursive
  2. Go to your project directory. In your project directory, execute the following command to clone the mDash libary:

    git clone https://github.com/cesanta/mDash
  3. In your project's app_main() function, initialize mDash library:

    #include "../mDash/src/mDash.h"
    ...
    void app_main() {
       ...
      mDashStartWithWifi(WIFI_NAME, WIFI_PASS, DEVICE_ID, DEVICE_PASS);
      ...
    }

    NOTE: If your code already handles WiFi setup, call mDashStart(DEVICE_ID, DEVICE_PASS);. Make sure that mDashStart() is called only when device obtains IP address.

  4. Add a line to your project's Makefile to link against the mDash library:

    PROJECT_NAME := hello-world
    EXTRA_LDFLAGS = -L$(CURDIR)/mDash/src/esp32 -lmDash  # <-- add this line
    include $(IDF_PATH)/make/project.mk
  5. Rebuild, reflash, and see your device connected:

    make flash monitor