Template: 10 DOF IMU Sensor D STM32 Guide
The example we provide is based on STM32F103RBT6, and the connection method provided is the corresponding pin of STM32F103RBT6 as an example. If you need to use other STM32, please connect according to the actual pin.
User Guides of STM32
Hardware connection
Sensor | STM32 | Description |
---|---|---|
VCC | 3.3V | Power input |
GMD | GND | Power ground |
SDA | SDA/PB9 | I2C data input |
SCL | SCL/PB8 | I2C clock pin |
Software Description
The examples are developed based on the HAL library. Please download the program in the data, find the STM32 program file directory, and open
PCF8591-Code\STM32\STM32F103RB\MDK-ARM.
PCF8591 AD DA Board.uvprojx in the directory, then you can see the demo.
Open main.c, recompile and download.
After the download is successful, run SSCOM to view the real-time status of the sensor.
Serial output data meaning
Roll, Pitch, Yaw | Roll (°), Pitch (°), Yaw (°) |
Acceleration | LSB, can be transferred to g① |
Gyroscope | GLSB, can be transferred to °/s② |
Magnetic | LSB, can be transferred μT③) |
Angle | Direction (°), it is equal to Yaw degree |
Pressure | hPa |
Altitude | m |
Temperature | ℃ |
Note:
①: The acceleration output by the serial port of the sample demo is the original value of the register (the value of the register). After this value is divided by 16384, it can be converted into a value in g (gravitational acceleration constant).
②: The angular velocity output by the serial port of the sample demo is the original value of the register (the value of the register). After this value is divided by 32.8, it can be converted into a value in dps (angle/second).
③: The value of the magnetic sensor output by the serial port of the sample demo is the original value of the register (that is, the value of the register). This value is multiplied by 0.15 to convert it into a value in μT (10-6 Tesla).