Klipper_ESP32 is an experimental wrapper for the Klipper protocol, enabling communication between Espressif ESP32 microcontrollers and the Klipper host software. This project leverages the original Klipper source code and adapts it for ESP32-based 3D printer control.
- Experimental Software: This project is under active development and is not considered stable. Use at your own risk.
- No Official Support: Klipper_ESP32 is not officially endorsed by the Klipper project. Do not request support from the main Klipper community.
- Potential for Hardware Damage: Incorrect configuration or usage may damage your 3D printer or electronics. Always double-check your wiring and configuration.
- Backup Your Data: Before flashing or updating firmware, back up your printer configuration and any important data.
- ESP-IDF v5.2.1 or newer: Install and set up the ESP-IDF development environment.
- Klipper Firmware Source: The Klipper source is included as a submodule.
- Supported Hardware: ESP32-based development boards.
- Python 3: Required for the build process and Klipper's build scripts.
components/klipper/klipper/) as it has been modified and configured specifically for ESP32 compatibility.
This project includes the complete Klipper firmware as a Git submodule located in components/klipper/klipper/. The CMake build system has been specifically designed to:
-
Extract Compile-Time Requests: During the build process, the system automatically extracts compile-time requests from object files using a custom Python script (
extract_compile_time_requests.py) -
Generate Build Artifacts: The CMake configuration automatically creates an
out/directory within the Klipper submodule (components/klipper/klipper/out/) and populates it with:klipper.bin- The compiled firmware binaryklipper.elf- The ELF executable filecompile_time_request.c- Generated C file containing compile-time configurationscompile_time_request.txt- Text file with extracted compile-time requestsklipper.dict- Dictionary file for protocol communication
-
Automatic Processing: The build system mimics the original Klipper Makefile behavior by:
- Scanning all compiled object files for
.compile_time_requestsections - Using
objcopyto extract these sections - Running Klipper's
buildcommands.pyscript to generate the final configuration files
- Scanning all compiled object files for
Note: The out/ folder is automatically created and managed by the CMake build system. You don't need to create it manually, and it will be populated with the necessary files after a successful build.
-
Clone the Repository (with Submodules):
git clone --recursive https://github.com/nikhil-robinson/klipper_esp32 cd klipper_esp32 -
Set Up ESP-IDF:
- Follow the ESP-IDF Getting Started Guide to install prerequisites and export environment variables.
- Example (on Windows PowerShell):
$env:IDF_PATH="C:\path\to\esp-idf" . $env:IDF_PATH\export.ps1
-
Configure the Project:
- You may customize build options using:
idf.py menuconfig
- You may customize build options using:
-
Build the Firmware:
idf.py build
-
Flash the Firmware:
- Connect your ESP32 board via USB.
- Replace
PORTwith your device's COM port (e.g.,COM3):idf.py -p PORT flash
-
Configure Klipper:
- Edit
printer.cfgto match your printer's hardware and requirements. - Refer to the example configs in
components/klipper/klipper/config/.
- Edit
-
Connect and Test:
- Connect your printer hardware to the ESP32.
- Power on and use your preferred G-code sender or Klipper host to communicate with the board.
- Build Errors: Ensure ESP-IDF is correctly installed and environment variables are set.
- Connection Issues: Verify the correct COM port and USB drivers.
- Firmware Not Responding: Double-check wiring, power supply, and configuration files.
Contributions are welcome! Please open issues or pull requests for bug reports, feature requests, or improvements.
See individual source files for licensing details.