Difference between revisions of "HANcoder/Training Material/MPU6500"

From OpenMBD
Jump to: navigation, search
(Created page with "== MPU6500 3 Axis gyro and 3 axis accelerometer == The MPU6500 has a programmable scale for both the gyroscope and the accelerometer. It can measure angular rates up to 2000°...")
 
Line 9: Line 9:
  
 
== SPI control in Simulink ==
 
== SPI control in Simulink ==
As mentioned before the communication with the sensor is done via SPI. First the [[HANcoder/SPI_Master_Init| SPI Master Init]] block is used to initialize the SPI system. Channel 1 is chosen with a baud rate of 10500kHz or 10.5MHz. The
+
As mentioned before the communication with the sensor is done via SPI. First the [[HANcoder/SPI_Master_Init| SPI Master Init]] block is used to initialize the SPI system. Channel 1 is chosen with a baud rate of 10500kHz or 10.5MHz. The polarity is chosen to be 'Idle low' and phase 'Sample bit on 1st clock edge', these settings come from the datasheet of the MPU6500

Revision as of 08:07, 6 April 2017

MPU6500 3 Axis gyro and 3 axis accelerometer

The MPU6500 has a programmable scale for both the gyroscope and the accelerometer. It can measure angular rates up to 2000°/sec and up to 16G of acceleration. The sensor can be configured and read by using the SPI bus.

Connecting the MPU6500

First the MPU6500 must be soldered on the prototype PCB. It is wise to solder some female headers onto the PCB and male headers onto the MPU6500 so it can be replaced when broken. Make sure it is mounted ruggedly to make sure the sensor won't measure movements of the sensor relative to the board. Next the pins must be connected to the E407 pins, see the connection diagram below.

File:ConnectionDiagram.png


SPI control in Simulink

As mentioned before the communication with the sensor is done via SPI. First the SPI Master Init block is used to initialize the SPI system. Channel 1 is chosen with a baud rate of 10500kHz or 10.5MHz. The polarity is chosen to be 'Idle low' and phase 'Sample bit on 1st clock edge', these settings come from the datasheet of the MPU6500