You can test Arduino code for an MPU6050 without wiring a physical sensor. This guide uses Wokwi as its documented simulator example: its MPU6050 component communicates over I2C and works with the Adafruit_MPU6050 library. The original title’s “2022” is not needed for this current, simulator-specific walkthrough.
What the Wokwi MPU6050 simulator supports
Wokwi provides a simulated MPU6050 component with three-axis accelerometer, three-axis gyroscope and temperature readings. It communicates over I2C, uses address 0x68 by default, and uses 0x69 when its AD0 pin is connected to VCC. The component documentation also supplies an Arduino example using the Adafruit library. See Wokwi’s MPU6050 component documentation.
As an Amazon Associate I earn from qualifying purchases.
The simulator exposes starting acceleration, rotation and temperature attributes, so you can choose values to exercise your sketch. Its XDA and XCL pins are not implemented. These controls let you test code against simulated readings; they do not establish that the simulator models every behavior of a physical sensor.
Set up the sketch and libraries
Use an Arduino project in Wokwi and add the MPU6050 component. For a typical Uno wiring setup, connect VCC to 5V, GND to GND, SDA to A4 and SCL to A5. The component’s usual required connections are VCC, GND, SDA and SCL. If you use another board or change the I2C address, check the board and component details rather than assuming the Uno pin mapping applies.
#1 Best Overall
- MPU-6050 MPU6050 6-axis Accelerometer Gyroscope Sensor
- Communication mode: standard IIC communication protocol
- Chip built-in 16bit AD converter, 16bit data output
- Gyroscopes range: +/- 250 500 1000 2000 degree/sec
- Acceleration range: ±2 ±4 ±8 ±16g
In the Arduino IDE, install Adafruit MPU6050 through Library Manager. Install its documented dependencies, Adafruit BusIO and Adafruit Unified Sensor, as well. The Adafruit guide includes a basic_readings sketch that reads acceleration, rotation and temperature. See the Adafruit Arduino MPU6050 guide and the Adafruit_MPU6050 library repository.
Read and print sensor values
This minimal sketch starts the sensor, checks that it responds, and prints acceleration values. It uses the same library and basic initialization pattern as the documented Wokwi example.
Rank #2
- MPU-6050 MPU6050 Module: adopts the standard IIC communication for communication and is powered by 3V-5V for sustainable use.
- 3 Axis Accelerometer Gyroscope Module: Gyroscope range: ± 250 500 1000 2000 ° / s; Acceleration range: ± 2 ± 4 ± 8 ± 16 g; Transmission can pass I2C up to 400kHz or SPI up to 20MHz.
- MPU 6050 Chip built-in: with three 16-bit analog-to-digital converters (ADCs) for digitizing the gyroscope outputs and another three ones for digitizing the accelerometer outputs.
- Universally Compatible: This sensor is easy to use with just about any microcontroller that has an I2C interface, for Raspberry Pi and ESP32 models.
- What You Will Get: 3pcs Pre-Soldered GY-521 mpu-6050 mpu6050 3 axis accelerometer sensor. Ready to plug in and go.
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
Adafruit_MPU6050 mpu;
void setup() {
Serial.begin(115200);
if (!mpu.begin()) {
Serial.println("MPU6050 not found");
while (1) {
delay(10);
}
}
}
void loop() {
sensors_event_t accel, gyro, temp;
mpu.getEvent(&accel, &gyro, &temp);
Serial.print("Acceleration X: ");
Serial.print(accel.acceleration.x);
Serial.print(" Y: ");
Serial.print(accel.acceleration.y);
Serial.print(" Z: ");
Serial.println(accel.acceleration.z);
delay(500);
}
In Wokwi, start the simulation and open Serial Monitor to see the output. The Adafruit guide specifies 115200 baud for viewing its example output. To print the other measurements, use gyro.gyro.x, gyro.gyro.y and gyro.gyro.z for rotation, and temp.temperature for temperature.
Free tools Windows power users keep installed
One-click scans. No signup required.
Change the simulated readings
Wokwi’s MPU6050 component lets you set initial accelerometer values in g, gyroscope values in degrees per second, and temperature. One g is 9.80665 m/s². Use the component’s documented attributes and units when selecting values, then run the sketch again to see how your code responds. These are simulator inputs—not physical movement or a guarantee that all real-sensor effects are reproduced.
Rank #3
- Product Name MPU-6050 MPU6050 6-Axis Accelerometer Gyro Sensor, which is a key component for motion sensing applications.
- Communication Protocol Utilizes the standard IIC communication protocol, enabling reliable data transfer between the sensor and other connected devices.
- AD Converter and Data Output Incorporates a built-in 16-bit AD converter, providing precise 16-bit data output for accurate measurement and analysis.
- Gyroscope Range Offers a gyroscope range of +/- 250, 500, 1000, and 2000 degrees per second, allowing for the detection of various rotational speeds and movements.
- Acceleration Range The acceleration range spans ±2, ±4, ±8, and ±16 grams, facilitating the measurement of different levels of linear acceleration in various applications such as inertial navigation and motion tracking.
What changes when you use a physical sensor
A real breakout measures actual motion and temperature, and its wiring and voltage limits depend on that specific board. Adafruit’s own breakout supports 3.3V and 5V logic; its guide says to connect VCC to 5V when using a 5V Arduino, or to the 3V supply on a 3V board, then connect ground, SCL and SDA to their matching pins. Do not assume a third-party MPU6050 board has the same voltage support or pinout. Check its documentation before connecting it. See Adafruit’s MPU6050 guide and its MPU-6050 breakout description.
Simulation is useful for developing and exercising the I2C/library path and trying chosen values. It does not replace checking electrical compatibility, wiring, or behavior on the hardware you intend to use.
Quick Recap
Best Value
- 【6-Axis Accelerometer & Gyroscope】The GY-521 MPU6050 sensor module combines a 3-axis accelerometer and a 3-axis gyroscope to provide 6-axis motion data, including acceleration and angular velocity information for motion sensing, tilt detection, rotation and robotics projects.
- 【16-Bit Digital Motion Data】Built-in 16-bit ADCs provide digital acceleration and gyroscope data. The accelerometer supports selectable ±2g, ±4g, ±8g and ±16g ranges, while the gyroscope supports ±250, ±500, ±1000 and ±2000°/s ranges for different motion sensing applications.
- 【I2C/IIC Communication Interface】The MPU6050 module communicates with microcontrollers and development boards through a standard I2C/IIC interface. Clearly labeled VCC, GND, SCL, SDA, XDA, XCL, AD0 and INT pins help simplify wiring, prototyping and project integration.
- 【Compact GY-521 IMU Sensor Module】The compact GY-521 breakout board integrates the MPU6050 motion sensor and supporting components into a convenient module for breadboards, prototypes, embedded systems and DIY electronics projects.
- 【For Robotics & DIY Electronics】Suitable for robotics, balancing projects, motion tracking, tilt detection, orientation sensing, gesture detection, embedded electronics and educational projects. Package includes 3 GY-521 MPU6050 accelerometer gyroscope sensor modules.
Rank #4
- 【ProductMaterial】: MPU6050 Module using immersion gold PCB, machine welding process to ensure quality
- 【Chip built-in】: With three 16 bit AD converter, 16 bits of data output, for digitizing the gyroscope outputs and accelerometer outputs
- 【Application】: The sensor can be used to develop various entertaining applications and systems to proceed with Reality enhancement,Electronic Image Stabilization,Optical lmage Stabilization, Compatible with Arduino and Raspberry Pi
- 【Basic Features】: Digitally output 6-axis or 9-axis rotation matrix, quaternion, and Euler Angle format fusion calculation data, Removed sensitivity between accelerator and gyroscope axes, reducing setting effects and sensor drift
- 【MPU6050 sensing range】: The angular velocity sensing range is ±250、±500、±1000 and ±2000°/sec,can accurately track fast and slow movements. The accelerator sensing range is ±2g、±4g±8g and ±16g; Transmission can pass I2C up to 400kHz
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problems

