ESP-MDF, or Espressif Mesh Development Framework, is a development framework for ESP-WIFI-MESH, a networking protocol built on top of the Wi-Fi protocol. ESP-MDF is based on the ESP32 chip.
ESP-MDF is based on the ESP-WIFI-MESH protocol stack to facilitate your development of ESP-WIFI-MESH. ESP-MDF provides the following features:
Fast network configuration: In addition to manual configuration with the network configuration apps, such as ESP-WIFI-MESH App or similar third-party apps, ESP-MDF offers a chained way of network configuration, during which devices autonomously and quickly establish a network, and form a greater coverage area.
Stable upgrade: The upgrading process has become more efficient with such features as automatic retransmission of failed fragments, data compression, reverting to an earlier version, firmware check, etc.
Efficient debugging: Various debugging approaches are supported, such as wireless transmission of logs and wireless debugging, debugging through a command terminal, etc.
LAN control: Network can be controlled by an app, sensor, etc.
Various application demos: It offers comprehensive solutions based on ESP-WIFI-MESH in the areas of lighting, etc.
ESP-MDF consists of Utils, Components and Examples (see the below figure). Utils is the encapsulation and third-party library of ESP-IDF APIs. Components are the ESP-MDF functional modules that use Utils APIs. Examples are the ESP-WIFI-MESH solutions based on the Components.
Utils:
Third Party: the third-party items
Transmission: the way of data transmission between devices
Mcommon: modules shared by all ESP-MDF components
Components:
Examples:
Function demo: Example of use of each function module
Debug: Performance Testing and Debugging Tools
Console Test: Test the ESP-WIFI-MESH throughput, network configuration, and packet delay by entering commands through the serial port.
Wireless Debug: ESP-MDF debugging via wireless
Development Kit: ESP32-MeshKit usage example for research and understanding of ESP-WIFI-MESH
ESP32-MeshKit-Light: Smart lighting solution with ESP-WIFI-MESH functioning as the master network. The kit consists of light bulbs with integrated ESP32 chips. Support BLE + ESP-MDF for BLE gateway, ibeacon and BLE scanning
ESP32-MeshKit-Sense: Development board, specifically designed for applications where ESP-WIFI-MESH is in Light-sleep or Deep-sleep mode. The board provides solutions for:
ESP32-MeshKit-Button: Smart button solution, tailored for ESP-WIFI-MESH applications with ultra-low power consumption. The device wakes up only for a short time when the buttons are pressed and transmits packets to ESP-WIFI-MESH devices via ESP-NOW.
Cloud Platform: ESP-MDF docking cloud platform
Aliyun Linkkit: Example of ESP-MDF access to Alibaba Cloud platform
AWS: ESP-MDF Access AWS Platform Example
You first need to read ESP-WIFI-MESH Communication Protocol and ESP-MDF Programming Guide and research and learn about ESP-WIFI-MESH through the ESP32-MeshKit development kit. Secondly, based on Function demo for your project development, when you can encounter problems in development, you can first go to BBS and Issues to find out if a similar problem already exists. If there is no similar problem, you can also ask directly on the website.
ESP32-MeshKit offers a complete ESP-WIFI-MESH Lighting Solution (see the below figure), complemented by ESP-Mesh App (iOS version and Android) for research, development and better understanding of ESP-WIFI-MESH.
ESP32-MeshKit Light |
ESP32-MeshKit Sense |
Products:
ESP32-MeshKit-Light: The RGBCW smart lights that show control results visually. They can be used to test network configuration time, response speed, stability performance, and measure distance, etc.
ESP32-MeshKit-Sense: This kit is equipped with a light sensor as well as a temperature & humidity sensor. It can measure power consumption and develop low power applications. The kit may also be used with ESP-Prog for firmware downloading and debugging.
ESP32-MeshKit-Button: Serves as an on/off controller, ready for the development of low power applications. It can be used with ESP-Prog for firmware downloading and debugging.
ESP32-Buddy is a development board specifically designed to test the development of ESP-WIFI-MESH. With its small size and USB power input, the board can be conveniently used for testing a large number of devices and measure distances between them.
This section provides the steps for quick start with your development of ESP-MDF applications. For more details, please refer to ESP-IDF Get Started.
The directory ~/esp
will be used further to install the compiling toolchain, ESP-MDF and demo programs. You can use another directory, but make sure to modify the commands accordingly.
Setup Toolchain: please set up according to your PC's operating system (Windows, Linux or Mac OS). If you use linux, you can use this commands.
git clone -b v4.3.1 --recursive https://github.com/espressif/esp-idf.git
cd ~/esp/esp-idf
./install.sh
. ./export.sh
Get ESP-MDF:
git clone --recursive https://github.com/espressif/esp-mdf.git
If you clone without the --recursive
option, please navigate to the esp-mdf directory and run the command git submodule update --init
Set up ESP-MDF Path: Toolchain uses the environment variable MDF_PATH
to access ESP-MDF. The setup of this variable is similar to that of the variable IDF_PATH
. Please refer to Add IDF_PATH & idf.py PATH to User Profile
. If you use linux, you can use this commands.
cd ~/esp/esp-mdf
export MDF_PATH=~/esp/esp-mdf
Start a Project: The word project refers to the communication example between two ESP-WIFI-MESH devices.
cp -r $MDF_PATH/examples/get-started/ .
cd get-started/
Build and Flash: For the rest, just keep the default configuration untouched.
idf.py menuconfig
idf.py -p [port] -b [baudrate] erase_flash flash
Monitor/Debugging: If you want to exit the monitor, please use the shortcut key Ctrl+]
.
idf.py monitor
Update ESP-MDF:
cd ~/esp/esp-mdf
git pull
git submodule update --init --recursive
Easy setup: ESP-WIFI-MESH expands the original Wi-Fi hotspot range to the reach of the most distant node in the mesh cloud. Such a network is automatically formed, self-healing and self-organizing. It saves the efforts of laying cables. All you need to do is configure the router password.
Gateway free: The decentralized structure of ESP-WIFI-MESH with the absence of a gateway precludes the overall network breakdown if one single node fails. Even if there is a single ESP-WIFI-MESH device, the network still works as usual.
Safer transmission: Both the data link layer and the application layer can be encrypted.
More reliable transmission: The transmission and data flow control between two devices are more reliable. Also, unicast, multicast and broadcast transmissions are supported.
Large network capacity: ESP-WIFI-MESH takes the form of a tree topology, so one single device can connect to 10 devices at maximum, and an entire network can have over 1,000 nodes.
Wider transmission coverage: The transmission distance between two devices is 30 m through walls, and 200 m without any obstacles in between (relevant to ESP32-DevKitC).
High transmission speed: For Wi-Fi transmission, the speed can reach up to 10 Mbps.
Simultaneously run Wi-Fi and BLE protocol stacks: ESP32 chips can run both Wi-Fi and BLE protocol stacks side by side and use ESP-WIFI-MESH as the main network to transmit data, receive BLE probe beacon, send BLE broadcasts and connect BLE devices.