2.13.1 Gyroscope Accelerometer Wiring And Basic Readings
Overview
Modern aircraft are full of gyroscopes and accelerometers — from the attitude indicator in the cockpit to the stability augmentation system in the flight control computer. This project wires an MPU6050 6-axis sensor to an ESP32 and displays pitch, roll, and yaw rate as live graphs on the Arduino Serial Plotter. Students directly observe how the sensor responds to aircraft-like motions, apply a complementary filter to smooth the output, and map each measurement to its real cockpit instrument equivalent.
Required Components
| Item | Quantity | Notes |
|---|---|---|
| ESP32 development board | 1 | Kit 4 |
| MPU6050 gyroscope/accelerometer module | 1 | Kit 4 – I2C; address 0x68 |
| Jumper wires (male-to-male) | 6 | Kit 4 |
| USB-A to Micro-USB data cable | 1 | Kit 4 |
| Computer with Arduino IDE | 1 | School |
| MPU6050_light library | 1 | Arduino Library Manager: install before Lesson 1 |
Step-by-Step Assembly
Lesson 1 – Wiring & Basic Readings
| STEP 1 | Wire MPU6050 to ESP32 |
| * MPU6050 VCC → ESP32 3.3V * MPU6050 GND → ESP32 GND * MPU6050 SDA → ESP32 GPIO 21 * MPU6050 SCL → ESP32 GPIO 22 * Run I2C scanner sketch: confirm MPU6050 detected at address 0x68 * Install MPU6050_light library via Arduino Library Manager |
| STEP 2 | Upload Basic Reading Sketch |
| * Open the gyro_visualiser.ino sketch from Kit 4 USB drive * This sketch reads and prints: AccX, AccY, AccZ, GyroX, GyroY, GyroZ at 20 Hz * Upload; open Serial Monitor at 115200 baud * Tilt the board in various directions; observe which values change * Key: AccZ ≈ 1.0 g when flat (gravity pulling down); GyroX/Y/Z ≈ 0 when stationary |
Power & Safety
For safety instructions and power requirements, please refer to Safety Notes.