Resources:
- ESP32 and IMU: https://github.com/tuupola/micropython-mpu9250
- Calibration: https://github.com/michaelwro/accelerometer-calibration
- Madgwick: https://github.com/micropython-IMU/micropython-fusion
- PC visualization: https://github.com/nagyf/mpu9250-visualization : https://github.com/nagyf/mpu9250-arduino
- Sensor Design
1.1 Calibration - Sensor software
2.1. Bluetooth - PC Visualization
3.1. Installation Dependencies
3.2 Running the Application
Description and details of the circuit diagram.

The magentometer, gyro and accelerometer require calibration.
| Magnetometer | Gyro | Accelerometer | |
|---|---|---|---|
| Time required to calibrate the sensor | About 20 seconds | About 2 seconds | Difficult. May takes more than 1 hour |
| Frequency of calibration | require to calibrate at new location | Every measurement | One time only |
| Methods of calibration | Move in circle in three axis | put flat on table | Measure all three axis without moving it (and measure all three axis with respect to gravity) |
Before and After calibration.
| Magnetometer | Accelerometer |
|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
The simplest setup involves using an ESP32 connected to a PC via USB. The gait sensor sends data to the ESP32 using Bluetooth.
-sensor folder consisted the software for the gait sensor.
-receiverfolder consisted the software to receive the bluetooth data and send to PC.
Execute these commands to run the application:
> python -m venv myenv
> \myenv\Scripts\activate
> pip install -r requirements.txt
> myenv\Scripts\deactivate.bat
The command is: python main.py -d <device_id> -b <data_rate> -o <test_csv_file>
python main.py -d COM10 -b 115200 -o text_20-5-2023.cvs
Noting that you need to go to Thonny and check what <device_id> is it.
Where:
device_idis the name of the serial port on which the arduino is connected. The easiest way to find it out is to launch the Arduino IDE and in the you search for itTools -> Portmenu, it will be something like/dev/cu.usbmodem14411on a Mac.baud_rateis the data rate used to communicate on the serial porttest_csv_fileis the filename of a file to write data to (this parameter is optional).





