Requires I2CDev Library for reading MPU6050 on Arduino.
-
Connect hardware. The wiring diagram is documented inside Arduino script. Should be straghtforward, just an Arduino controller + two MPU6050s connected with I2C wires. The wires cannot be too long (I'm using a total length of ~600mm).
-
Upload Arduino code to MCU.
-
Open Blender and change the
MCU_COM_PORT
value to what Arduino is currently using (can be checked in Device Manager, or just Arduino IDE). -
Run the script. The MPU6050 needs ~8 seconds to initialize before start transmitting data, so initially the armature won't move, and the script will prompt something like
2023-01-25 18:01:28 WARNING [BPY]: Invalid joint data
-
Press ESC at the main Blender window to stop the script.
Data is streamed from the sensor to the host computer in JSON key-value pair encoding format.
{"key": "/joint/joint_name", "value": [0, 0, 0, 0]}\n
where pos
is in format [x, y, z]
, and rot
is in format [w, x, y, z]
.
{"key": "/log", "value": "INFO: log message"}\n
Code in this repository is under MIT License and GPLv3 License.
Model in Blender file is under Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0) License.