Visualize roll, pitch, and yaw data from an IMU in real-time using three.js. This project integrates:
- Arduino Nicla Sense ME for IMU data.
- Python3 backend to process and write IMU data to JSON.
- Vanilla JavaScript frontend for rendering 3D models via three.js.
An Inertial Measurement Unit (IMU) tracks orientation via accelerometer, gyroscope, and magnetometer fusion. Widely used in:
- Robotics for stability control.
- Autonomous Vehicles for navigation.
- AI Models as sensor inputs.
This project uses Arduino’s onboard sensor fusion. Alternatively, you can extend it for boards like the Arduino Nano BLE Sense Rev 2, with unfinished sensor fusion code included.
- Customizable STL Models: Adapt any 3D STL file for visualization.
- Web-Based Interface: Fast rendering with three.js (via CDN).
- Cross-Language Integration: C++, Python, JavaScript.
- Install Dependencies:
- Python:
pip install pyserial
- Node.js: For serving files locally via
npx serve .
- Arduino IDE: Flash Nicla Sense ME with
IMU_Nicla_Sense_ME.ino
.
- Python:
- Run the Project:
python3 -m venv my_env source my_env/bin/activate pip install pyserial ./start.sh
repository/
├── IMU_Nicla_Sense_ME.ino # Arduino sketch for Nicla Sense ME
├── imu_process.py # Python backend for IMU data processing
├── main.js # Frontend logic with three.js
├── index.html # Web interface for visualization
├── extras/ # Optional tools and files
│ ├── synthetic.py # Generate synthetic IMU data
│ ├── mystl.stl # 3D model example
│ └── IMU_BLE_Sense_2.ino # Alternate BLE-based Arduino sketch
└── start.sh # Script to launch the app
- Python: pyserial (IMU-Arduino communication).
- JavaScript: three.js (STL rendering).
- Node.js: For lightweight local hosting.
- Arduino Nicla Sense ME
- USB Cable
- Adjust STL scale and camera parameters in main.js for your custom models.
- Supports any STL file for 3D orientation visualization.
╭━━╮╭━━━┳━━┳━━━┳━╮╱╭╮ ╭╮╱╱╭━━━┳━━━┳╮╭━┳━━━╮ ┃╭╮┃┃╭━╮┣┫┣┫╭━╮┃┃╰╮┃┃ ┃┃╱╱┃╭━━┫╭━╮┃┃┃╭┫╭━╮┃ ┃╰╯╰┫╰━╯┃┃┃┃┃╱┃┃╭╮╰╯┃ ┃┃╱╱┃╰━━┫╰━━┫╰╯╯┃┃╱┃┃ ┃╭━╮┃╭╮╭╯┃┃┃╰━╯┃┃╰╮┃┃ ┃┃╱╭┫╭━━┻━━╮┃╭╮┃┃┃╱┃┃ ┃╰━╯┃┃┃╰┳┫┣┫╭━╮┃┃╱┃┃┃ ┃╰━╯┃╰━━┫╰━╯┃┃┃╰┫╰━╯┃ ╰━━━┻╯╰━┻━━┻╯╱╰┻╯╱╰━╯ ╰━━━┻━━━┻━━━┻╯╰━┻━━━╯
follow all of these for pizza :)