This repository demonstrates how to run IMU-based Edge Impulse models on Zephyr using the Edge Impulse Zephyr Module.
Drop in your model > build > flash > get real-time motion inference.
west init https://github.com/edgeimpulse/ei-zephyr-imu-inference.git
cd ei-zephyr-imu-inference
west updateThis fetches:
- Zephyr RTOS
- Edge Impulse Zephyr SDK module
- All module dependencies
In Edge Impulse Studio go to:
Deployment > Zephyr library > Build
Download the generated .zip
Extract into the model/ folder:
unzip -o ~/Downloads/your-model.zip -d model/Your model/ directory should contain:
CMakeLists.txtedge-impulse-sdk/model-parameters/tflite-model/
Choose your board (Example: Nucleo U585ZI):
west build --pristine -b nucleo_u585zi_qwest flashOr specify runner:
west flash --runner jlink
west flash --runner nrfjprog
west flash --runner openocdAll sensors accessible through I²C/SPI + Zephyr sensor drivers are compatible.
├── CMakeLists.txt # Build configuration
├── prj.conf # Zephyr config
├── west.yml # Manifest (declares Edge Impulse SDK module)
├── model/ # Your Edge Impulse model (Zephyr library)
└── src/
├── main.cpp
├── inference/ # Inference state machine
└── sensors/ # IMU interface
- Initialize - Sensor setup via Zephyr sensor API
- Sample - Continuous data collection at model frequency
- Buffer - Circular buffer stores samples
- Infer - Run classifier when buffer full
- Output - Print classification results
- Loop - Repeat
Key settings in prj.conf:
CONFIG_EDGE_IMPULSE_SDK=y # Enable Edge Impulse SDK
CONFIG_MAIN_STACK_SIZE=8192 # Adjust for your model size
CONFIG_SENSOR=y # Enable sensor subsystem
CONFIG_I2C=y # Enable I2C for sensorsFor larger models, increase stack size:
CONFIG_MAIN_STACK_SIZE=16384Add to your west.yml:
projects:
- name: edge-impulse-sdk-zephyr
path: modules/edge-impulse-sdk-zephyr
revision: v1.75.4 # See https://github.com/edgeimpulse/edge-impulse-sdk-zephyr/tags
url: https://github.com/edgeimpulse/edge-impulse-sdk-zephyrThen:
west updateAdd to your CMakeLists.txt:
list(APPEND ZEPHYR_EXTRA_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/model)Module not found
west updateInsufficient memory
# In prj.conf
CONFIG_MAIN_STACK_SIZE=16384Sensor not detected
# In prj.conf - enable debug logging
CONFIG_I2C_LOG_LEVEL_DBG=y
CONFIG_SENSOR_LOG_LEVEL_DBG=yClear BSD License - see LICENSE file
Copyright (c) 2025 EdgeImpulse Inc.