Interfaçage Du Capteur MPU6050 Avec STM32 : Lecture Des Données IMU Via I2C
by Orange Digital Center in Circuits > Microcontrollers
18 Views, 0 Favorites, 0 Comments
Interfaçage Du Capteur MPU6050 Avec STM32 : Lecture Des Données IMU Via I2C
.jpeg)
This project was developed within the Orange Digital Center Morocco , a space dedicated to fostering innovation, creativity, and rapid prototyping. At the FabLab, individuals and teams have access to state-of-the-art tools, including 3D printers, laser cutters, and a variety of electronic and mechanical resources. The center provides a collaborative environment where innovators, entrepreneurs, and students can transform their ideas into tangible products. By focusing on sustainable and impactful solutions .
In many modern embedded applications such as mobile robots, drones, or motion detection systems, measuring orientation and acceleration is an essential component. The MPU6050 is a widely used sensor for this purpose: it combines a 3-axis accelerometer and a 3-axis gyroscope, making it a complete solution for obtaining motion data across six degrees of freedom.
In this article, we will see how to interface the MPU6050 sensor with an STM32 microcontroller using the I2C communication protocol. We will go through the hardware setup, project creation using STM32CubeIDE, sensor initialization, and the reading and display of raw data from the gyroscope and accelerometer. This tutorial will provide you with the foundation to integrate navigation or motion detection features into your embedded projects.
Supplies
Required Hardware :
- Carte STM32F401RE
- Capteur MPU6050
- Fils de connexion
- Breadboard
Wiring Diagram

Voici le schéma de câblage entre le STM32 et le Raspberry Pi 4.
Project Creation
Downloads
Configuration STM32 Project
Downloads
Example of Stm32 Mpu6050 Project
Après la génération du code C basé sur la couche HAL, ajoutez les fichiers suivants : MPU6050.c, i2c.c, i2c.h, puis modifiez les fichiers main.c et main.h.