Repository navigation
getting started installation
This guide covers all the different ways to install and set up painlessMesh for your development environment.
- Open Arduino IDE
- Go to Sketch → Include Library → Manage Libraries
- Search for "Alteriom PainlessMesh"
- Install the latest release and accept the dependencies it offers (ArduinoJson, TaskScheduler, PubSubClient)
- Also install AsyncTCP 3.4.7 or later for ESP32, or ESPAsyncTCP for ESP8266
The index follows a GitHub release within a day; until then the release ZIP below has the newest version.
- Download the latest release from GitHub
- Extract the ZIP file
- Copy the
painlessMeshfolder to your Arduino libraries directory:-
Windows:
Documents\Arduino\libraries\ -
macOS:
~/Documents/Arduino/libraries/ -
Linux:
~/Arduino/libraries/
-
Windows:
- Restart Arduino IDE
Add to your platformio.ini file:
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
sparck75/AlteriomPainlessMesh@^2.0.0
bblanchon/ArduinoJson@^7.4.2
arkhipenko/TaskScheduler@^4.0.0
# For ESP8266
[env:esp8266]
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps =
sparck75/AlteriomPainlessMesh@^2.0.0
bblanchon/ArduinoJson@^7.4.2
arkhipenko/TaskScheduler@^4.0.0# Install via PlatformIO CLI
pio pkg install --library "sparck75/AlteriomPainlessMesh@^2.0.0"painlessMesh supports all ESP32 variants:
- ESP32 DevKit
- ESP32-S2
- ESP32-S3
- ESP32-C3
- ESP32-WROOM
- ESP32-WROVER
All ESP8266 boards are supported:
- NodeMCU
- Wemos D1 Mini
- ESP-12E/F
- ESP-01 (with limitations due to memory)
painlessMesh requires these libraries:
- ArduinoJson (v7.4+) - JSON parsing and generation
- TaskScheduler (v4.0+) - Task scheduling system
- ESP32 Arduino Core (v2.0.0+) for ESP32 boards
- ESP8266 Arduino Core (v3.0.0+) for ESP8266 boards
If you plan to contribute to painlessMesh or need the latest development version:
# Clone the repository
git clone https://github.com/Alteriom/painlessMesh.git
cd painlessMesh
# Initialize submodules
git submodule init
git submodule update
# Install test dependencies (for desktop testing)
cd test
git clone https://github.com/bblanchon/ArduinoJson.git
git clone https://github.com/arkhipenko/TaskScheduler.git
cd ..
# Build tests (requires CMake and Ninja)
cmake -G Ninja .
ninjaFor development and testing on your computer:
- CMake 3.10+
- Ninja build system
- Boost libraries
- C++14 compatible compiler
sudo apt update
sudo apt install cmake ninja-build libboost-all-dev build-essential
# Clone and build
git clone https://github.com/Alteriom/painlessMesh.git
cd painlessMesh
git submodule update --init
cmake -G Ninja .
ninja
# Run tests
run-parts --regex catch_ bin/# Install dependencies
brew install cmake ninja boost
# Clone and build
git clone https://github.com/Alteriom/painlessMesh.git
cd painlessMesh
git submodule update --init
cmake -G Ninja .
ninja
# Run tests
run-parts --regex catch_ bin/Use Visual Studio with CMake support or install dependencies via vcpkg:
# Install vcpkg first, then:
vcpkg install boost:x64-windows
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=path/to/vcpkg.cmake .
ninja- AlteriomPainlessMesh: 2.0.x
- ArduinoJson: 7.4+
- TaskScheduler: 4.0+
- ESP32 Arduino Core: 2.0+
- ESP8266 Arduino Core: 3.0+
- RAM: ~50KB minimum for basic mesh functionality
- Flash: ~200KB for core library + your application
- Recommended: 320KB+ RAM for complex applications
- RAM: ~20KB minimum for basic mesh functionality
- Flash: ~150KB for core library + your application
- Recommended: 80KB+ RAM for stable operation
- Note: ESP-01 (512KB flash) may have limitations
Add these to your build configuration if needed:
# platformio.ini
build_flags =
-DPAINLESSMESH_ENABLE_DEBUG=1 # Enable debug output
-DPAINLESSMESH_MAX_CONNECTIONS=10 # Maximum connections
-DTASK_SCHEDULER_DEBUG=1 # TaskScheduler debugAdd at the top of your sketch:
#define PAINLESSMESH_ENABLE_DEBUG 1
#define PAINLESSMESH_MAX_CONNECTIONS 10- Install the PlatformIO IDE extension
- Create new project or open existing
- Add library dependencies to
platformio.ini - Use Ctrl+Shift+P → "PlatformIO: Build" to compile
- Install via Library Manager (same as Arduino IDE 1.x)
- Use the new autocomplete features for better development experience
- Debugging support available with compatible boards
Test your installation with this minimal example:
#include "painlessMesh.h"
painlessMesh mesh;
void setup() {
Serial.begin(115200);
Serial.println("painlessMesh installation test");
// If this compiles and uploads successfully, installation is correct
mesh.init("TestNetwork", "password", 5555);
Serial.println("painlessMesh initialized successfully!");
}
void loop() {
mesh.update();
}If this compiles and uploads without errors, your installation is complete!
- Try the Quick Start Guide to create your first mesh
- Explore Basic Examples
- Read about Mesh Architecture
Library not found errors?
- Check that ArduinoJson and TaskScheduler are installed
- Verify library versions are compatible
- Try cleaning and rebuilding your project
Compilation errors?
- Ensure you're using a supported ESP32/ESP8266 core version
- Check that your board selection matches your hardware
- See Common Issues for more help