🤖 Robot Arm · MPU6050
📍 End Effector Position
X: 0.0 mm
Y: 0.0 mm
Z: 0.0 mm
Y: 0.0 mm
Z: 0.0 mm
🔌 MPU6050 Serial (COM)
Not connected
—
📖 Quick Start Guide
Setup Steps
1
Upload the Arduino code below to your board2
Wire MPU6050 → SDA→A4, SCL→A5, VCC→3.3V, GND→GND3
Click Connect to MPU6050 and pick the COM port4
Tilt the sensor — the 3D arm moves in real time5
Use sliders manually when sensor is not connected6
Left-drag to orbit · Right-drag to pan · Scroll to zoomArduino sketch — MPU6050
#include <Wire.h>
#include <MPU6050.h>
MPU6050 mpu;
void setup() {
Serial.begin(115200);
Wire.begin();
mpu.initialize();
if (!mpu.testConnection()) {
Serial.println("MPU6050 failed");
while(1);
}
}
void loop() {
int16_t ax, ay, az, gx, gy, gz;
mpu.getMotion6(&ax, &ay, &az,
&gx, &gy, &gz);
// Convert raw data to angles
float roll = atan2(ay, az) * 180.0 / PI;
float pitch = atan2(-ax,
sqrt((float)ay*ay + (float)az*az))
* 180.0 / PI;
float yaw = gz / 131.0;
// Clamp to simulator ranges
yaw = constrain(yaw, -180, 180);
pitch = constrain(pitch, -90, 90);
roll = constrain(roll, -180, 180);
// Send in required format
Serial.print("DATA:");
Serial.print(yaw, 1);
Serial.print(",");
Serial.print(pitch, 1);
Serial.print(",");
Serial.println(roll, 1);
delay(50); // 20 Hz
}
Any sensor works — just send DATA:v1,v2,v3 at 115200 baud. Works with joysticks, flex sensors, ultrasonic, potentiometers, and more. Requires Chrome or Edge.
Left-drag: rotate · Right-drag: pan · Scroll: zoom
Tags:
robotics