Skip to content

Simulation

The simulations/ folder contains Wokwi projects for testing firmware logic without hardware. Each project simulates a subset of the wearable:

Project What it simulates
stm32_bno055_test STM32 read from 1 MPU6050 (IMU stand-in) over I2C, print to Serial
stm32_full_test STM32 + 4 IMUs + 2 EMG + 4 FSR, full main-loop simulation
kb2040_bno055_test KB2040 + 2 IMUs over I2C, UART TX to serial monitor

Opening in Wokwi

  1. Go to wokwi.com
  2. Click New ProjectImport from disk
  3. Drag-and-drop the project folder (e.g., simulations/stm32_bno055_test/)
  4. The simulation starts automatically

Or create a blank project and copy-paste diagram.json and sketch.ino.

Limitations

Board differences

Wokwi does not have STM32F405 Feather Express or KB2040 in its parts library. The simulations use: - Raspberry Pi Pico (RP2040) as the stand-in for both MCUs - MPU6050 as the stand-in for the BNO055 IMU

The Pico's pin mapping differs from the Feather boards. The simulations match the I²C bus logic (two buses, two addresses) but the physical pin numbers are illustrative.

Real board Wokwi stand-in I²C pins
STM32F405 I2C1 RP2040 I2C0 GP4/GP5
STM32F405 I2C2 RP2040 I2C1 GP6/GP7
KB2040 I2C0 RP2040 I2C0 GP4/GP5
KB2040 I2C1 RP2040 I2C1 GP6/GP7

Sensor differences

  • Wokwi's MPU6050 only provides raw accelerometer/gyroscope data, not fused quaternions like the BNO055. The sketch reads raw accel values instead of quat + linacc.
  • Wokwi has no MyoWare or FSR analog models. The analog pins are driven by a potentiometer in the full test for illustrative purposes.

No UART bridge simulation

The KB2040→STM32 UART bridge cannot be simulated (Wokwi runs one MCU at a time). The kb2040_bno055_test prints the 70-byte frame to the serial monitor instead.

What the simulations cover

  • I²C multi-bus routing (two buses, shared 0x28 address → separate reads)
  • ADC read with oversampling
  • Frame assembly and CRC32
  • 100 Hz timing loop
  • Byte-wise float packing (M0+ alignment safety)

What the simulations DON'T cover

  • BNO055 sensor fusion (quaternion output)
  • Actual MyoWare/FSR analog signals
  • UART bridge between two MCUs
  • USB CDC streaming (Wokwi serial monitor only)
  • Real-time performance (Wokwi runs at variable speed)