example

Example of the component espp/qmi8658 v1.0.16
# QMI8658 Example

This example shows how to use the `espp::Qmi8658` component to initialize and
communicate with an QMI8658 6-axis IMU.

<img width="3952" height="2247" alt="CleanShot 2025-07-12 at 18 18 49" src="https://github.com/user-attachments/assets/d9e09dae-2568-46c5-b500-104714704e4c" />

## How to use example

### Hardware Required

This example is designed to run on a custom board with a QMI8658 IMU.
You will need to configure the I2C pins for your specific hardware.

### Build and Flash

Build the project and flash it to the board, then run monitor tool to view
serial output:

```
idf.py -p PORT flash monitor
```

(Replace PORT with the name of the serial port to use.)

(To exit the serial monitor, type ``Ctrl-]``.)

See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.

## Example Output

<img width="2032" height="1179" alt="CleanShot 2025-07-12 at 18 19 39" src="https://github.com/user-attachments/assets/b8c1ebb2-8516-4d22-a36e-3cc56cbf3f63" />

```console
I (304) main_task: Calling app_main()
[QMI8658 Example/I][0.035]: Starting example!
[QMI8658 Example/I][0.041]: Creating IMU
% Time (s), Accel X (m/s^2), Accel Y (m/s^2), Accel Z (m/s^2), Gyro X (rad/s), Gyro Y (rad/s), Gyro Z (rad/s), Temp (C), Kalman Roll (rad), Kalman Pitch (rad), Kalman Yaw (rad), Kalman Gravity X, Kalman Gravity Y, Kalman Gravity Z, Madgwick Roll (rad), Madgwick Pitch (rad), Magwick Yaw (rad), Madgwick Gravity X, Madgwick Gravity Y, Madgwick Gravity Z
[QMI8658 Example/I][0.075]: Starting IMU task
0.091,0.969,0.141,0.069,0.984,-1.484,0.891,38.6,1.115,-1.409,0.000,-0.987,-0.144,-0.071,0.000,-0.000,0.000,-0.000,-0.000,-1.000
0.104,0.983,0.141,0.072,1.359,-1.969,0.953,38.6,1.099,-1.412,0.000,-0.987,-0.141,-0.072,0.001,-0.003,0.000,-0.003,-0.001,-1.000
0.117,0.990,0.140,0.069,1.078,-2.812,1.047,38.6,1.115,-1.414,0.000,-0.988,-0.140,-0.069,0.001,-0.006,0.000,-0.006,-0.001,-1.000
0.130,0.979,0.143,0.068,0.750,-0.984,0.625,38.6,1.129,-1.411,0.000,-0.987,-0.144,-0.068,0.002,-0.009,0.001,-0.009,-0.002,-1.000
0.143,0.966,0.146,0.070,0.656,0.906,-0.312,38.6,1.122,-1.405,0.000,-0.986,-0.149,-0.072,0.002,-0.011,0.001,-0.011,-0.002,-1.000
0.156,0.957,0.146,0.073,0.562,1.031,-0.828,38.6,1.107,-1.401,0.000,-0.986,-0.151,-0.075,0.003,-0.014,0.000,-0.014,-0.003,-1.000
0.169,0.965,0.144,0.075,1.297,-2.125,1.016,38.6,1.089,-1.404,0.000,-0.986,-0.147,-0.077,0.004,-0.017,0.001,-0.017,-0.004,-1.000
0.182,0.979,0.142,0.068,1.750,-5.609,3.156,38.6,1.125,-1.411,0.000,-0.987,-0.143,-0.069,0.004,-0.021,0.001,-0.021,-0.004,-1.000
0.195,0.985,0.137,0.063,1.859,-6.734,4.016,38.6,1.139,-1.418,0.000,-0.988,-0.138,-0.064,0.005,-0.025,0.002,-0.025,-0.005,-1.000
0.208,0.979,0.135,0.057,1.281,-3.359,2.359,38.6,1.170,-1.422,0.000,-0.989,-0.137,-0.058,0.006,-0.028,0.003,-0.028,-0.006,-1.000
0.221,0.969,0.137,0.059,0.203,2.172,-0.594,38.6,1.163,-1.418,0.000,-0.988,-0.140,-0.061,0.006,-0.030,0.003,-0.030,-0.006,-1.000
0.234,0.960,0.139,0.065,-0.109,5.188,-2.547,38.6,1.133,-1.413,0.000,-0.988,-0.143,-0.067,0.006,-0.031,0.002,-0.031,-0.006,-0.999
0.247,0.965,0.142,0.074,0.125,4.453,-3.250,38.6,1.091,-1.406,0.000,-0.987,-0.145,-0.076,0.007,-0.033,0.001,-0.033,-0.007,-0.999
0.260,0.981,0.145,0.074,1.000,0.812,-0.594,38.6,1.098,-1.407,0.000,-0.987,-0.146,-0.074,0.008,-0.035,0.001,-0.035,-0.008,-0.999
0.273,0.990,0.146,0.075,1.266,-3.250,1.234,38.6,1.095,-1.407,0.000,-0.987,-0.145,-0.075,0.008,-0.039,0.001,-0.039,-0.008,-0.999
0.286,0.986,0.146,0.072,1.125,-2.641,1.500,38.6,1.110,-1.407,0.000,-0.987,-0.146,-0.072,0.009,-0.042,0.002,-0.042,-0.009,-0.999
0.299,0.973,0.147,0.073,0.531,-0.516,0.031,38.6,1.111,-1.404,0.000,-0.986,-0.149,-0.074,0.009,-0.045,0.002,-0.044,-0.009,-0.999
0.312,0.965,0.146,0.073,0.188,1.625,-0.812,38.6,1.110,-1.403,0.000,-0.986,-0.150,-0.074,0.010,-0.047,0.001,-0.047,-0.010,-0.999
0.325,0.965,0.146,0.076,0.594,0.359,-0.500,38.6,1.089,-1.402,0.000,-0.986,-0.149,-0.078,0.010,-0.049,0.001,-0.049,-0.010,-0.999
0.338,0.972,0.145,0.076,1.328,-3.547,1.969,38.6,1.088,-1.404,0.000,-0.986,-0.147,-0.077,0.011,-0.053,0.002,-0.053,-0.011,-0.999
0.351,0.976,0.142,0.070,1.750,-5.719,3.656,38.6,1.115,-1.410,0.000,-0.987,-0.144,-0.070,0.012,-0.056,0.003,-0.056,-0.012,-0.998
0.364,0.979,0.138,0.066,1.656,-5.156,3.219,38.6,1.123,-1.415,0.000,-0.988,-0.140,-0.067,0.012,-0.060,0.003,-0.060,-0.012,-0.998
0.377,0.980,0.137,0.063,1.203,-2.859,1.109,38.6,1.141,-1.418,0.000,-0.988,-0.138,-0.063,0.013,-0.063,0.003,-0.063,-0.013,-0.998
0.390,0.978,0.141,0.061,0.891,-0.547,-3.969,38.6,1.161,-1.415,0.000,-0.988,-0.143,-0.062,0.014,-0.066,0.002,-0.066,-0.014,-0.998
0.403,0.973,0.144,0.064,-0.062,2.141,-1.172,38.6,1.150,-1.410,0.000,-0.987,-0.146,-0.065,0.014,-0.068,0.002,-0.068,-0.014,-0.998
0.416,0.972,0.145,0.073,0.516,3.078,-1.188,38.6,1.104,-1.405,0.000,-0.986,-0.147,-0.074,0.015,-0.070,0.002,-0.070,-0.014,-0.997
0.429,0.969,0.148,0.076,0.594,0.828,-0.500,38.6,1.095,-1.400,0.000,-0.986,-0.151,-0.078,0.015,-0.072,0.002,-0.072,-0.015,-0.997
0.442,0.969,0.145,0.075,1.094,-2.031,1.484,38.6,1.090,-1.404,0.000,-0.986,-0.147,-0.077,0.016,-0.075,0.002,-0.075,-0.016,-0.997
0.455,0.968,0.141,0.073,1.656,-5.109,3.062,38.6,1.095,-1.409,0.000,-0.987,-0.144,-0.074,0.016,-0.079,0.003,-0.079,-0.016,-0.997
0.468,0.972,0.139,0.066,2.234,-6.969,4.094,38.6,1.130,-1.414,0.000,-0.988,-0.141,-0.067,0.017,-0.083,0.004,-0.083,-0.017,-0.996
0.481,0.977,0.136,0.056,1.859,-5.938,3.375,38.6,1.179,-1.421,0.000,-0.989,-0.138,-0.057,0.018,-0.087,0.004,-0.087,-0.018,-0.996
0.494,0.982,0.137,0.055,1.078,-1.797,1.328,38.6,1.190,-1.422,0.000,-0.989,-0.138,-0.055,0.018,-0.090,0.005,-0.090,-0.018,-0.996
0.507,0.978,0.137,0.060,0.141,4.328,-2.516,38.6,1.159,-1.419,0.000,-0.989,-0.138,-0.060,0.019,-0.092,0.004,-0.092,-0.019,-0.996
0.520,0.969,0.142,0.071,-0.781,8.203,-4.453,38.6,1.106,-1.409,0.000,-0.987,-0.144,-0.072,0.019,-0.092,0.003,-0.092,-0.019,-0.996
0.533,0.968,0.148,0.084,-0.656,7.719,-3.906,38.6,1.057,-1.397,0.000,-0.985,-0.151,-0.085,0.020,-0.093,0.002,-0.093,-0.019,-0.995
0.546,0.971,0.150,0.088,0.844,0.750,-1.594,38.6,1.042,-1.394,0.000,-0.984,-0.152,-0.089,0.020,-0.095,0.002,-0.095,-0.020,-0.995
0.559,0.980,0.154,0.086,1.969,-5.188,1.484,38.6,1.059,-1.393,0.000,-0.984,-0.154,-0.087,0.021,-0.099,0.002,-0.099,-0.021,-0.995
0.572,0.977,0.150,0.073,2.562,-9.938,5.984,38.6,1.121,-1.401,0.000,-0.986,-0.152,-0.073,0.022,-0.104,0.003,-0.104,-0.022,-0.994
0.585,0.970,0.141,0.064,2.391,-9.188,6.594,38.6,1.141,-1.412,0.000,-0.987,-0.144,-0.066,0.023,-0.109,0.005,-0.108,-0.022,-0.994
0.598,0.969,0.135,0.059,1.562,-4.500,3.219,38.6,1.157,-1.420,0.000,-0.989,-0.138,-0.061,0.023,-0.112,0.005,-0.112,-0.023,-0.993
0.611,0.974,0.135,0.058,0.672,-0.047,-0.219,38.6,1.167,-1.421,0.000,-0.989,-0.138,-0.059,0.024,-0.115,0.005,-0.115,-0.024,-0.993
```

Running with `esp-cpp/uart-serial-plotter`:
<img width="3952" height="2247" alt="CleanShot 2025-07-12 at 18 18 49" src="https://github.com/user-attachments/assets/d9e09dae-2568-46c5-b500-104714704e4c" />
 

To create a project from this example, run:

idf.py create-project-from-example "espp/qmi8658=1.0.16:example"

or download archive (~6.15 KB)