Sony Spresense IMU Example Code

  • Example Arduino code running an Edge Impulse Model that reads

    • a Rohm KX126 or Rohm KX224 IMU is here.
    • the Spresense camera is here.
    • the Spresense microphone is here.
  • Can a machine learning Model that reads IMU data and deployed from the Edge Impulse Studio run on a SubCore?

    • The answer is yes!
    • Sidenote: A ML Model that reads the Spresense camera or microphones cannot run on a SubCore.
  • Can a IMU based Model run on the MainCore and a different IMU based Model run on a SubCore?

    • The answer is probably not!
    • My trail code and deadbeef notes are here.
  • If you want to use the KX224 IMU sensor with the Sony Spresese Edge Impulse Firmware see HOWTO code here.

2 Likes

Code now works and will make inferences using different cores with the same Model that reads different input sensors depending on the core the Model is runnng on.

Mods made:

  • Changed KX224_I2C library to use Wire1. The KX224 was wired to the other I2C bus on the Spresense.
  • The "loop()" now does a mutex so only the MainCore or the SubCore is running an inference.
  • Since the different cores are now using seperate I2C busses, I thought they could collect data in parallel and outside of the mutex. However, the MainCore would not reliably sample data and eventually never comeback from ei_inertial_read_data().
1 Like

Awesome work here @MMarcial - thanks for the contributions!